Search in sources :

Example 1 with ServerCapabilities

use of org.graalvm.tools.lsp.server.types.ServerCapabilities in project graal by oracle.

the class CompletionTest method setTriggerCharacters.

private void setTriggerCharacters() {
    ServerCapabilities capabilities = ServerCapabilities.create();
    CompletionOptions completionProvider = CompletionOptions.create();
    completionProvider.setTriggerCharacters(Collections.singletonList("."));
    capabilities.setCompletionProvider(completionProvider);
    truffleAdapter.setServerCapabilities("sl", capabilities);
}
Also used : CompletionOptions(org.graalvm.tools.lsp.server.types.CompletionOptions) ServerCapabilities(org.graalvm.tools.lsp.server.types.ServerCapabilities)

Example 2 with ServerCapabilities

use of org.graalvm.tools.lsp.server.types.ServerCapabilities in project graal by oracle.

the class LanguageServerImpl method initialize.

@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams initializeParams) {
    // TODO: Read params.getCapabilities();
    ServerCapabilities capabilities = ServerCapabilities.create();
    capabilities.setTextDocumentSync(TEXT_DOCUMENT_SYNC_KIND);
    capabilities.setDocumentSymbolProvider(false);
    capabilities.setWorkspaceSymbolProvider(false);
    capabilities.setDefinitionProvider(false);
    capabilities.setDocumentHighlightProvider(true);
    capabilities.setCodeLensProvider(CodeLensOptions.create().setResolveProvider(false));
    capabilities.setCompletionProvider(CompletionOptions.create().setResolveProvider(false));
    capabilities.setCodeActionProvider(true);
    capabilities.setSignatureHelpProvider(SignatureHelpOptions.create());
    capabilities.setHoverProvider(true);
    capabilities.setReferencesProvider(false);
    List<String> commands = new ArrayList<>(truffleAdapter.getExtensionCommandNames());
    commands.add(DRY_RUN);
    commands.add(GET_COVERAGE);
    capabilities.setExecuteCommandProvider(ExecuteCommandOptions.create(commands));
    truffleAdapter.initializeLSPServer(new LSPServerAccessor() {

        public void sendCustomNotification(String method, Object params) {
            client.sendCustomNotification(method, params);
        }

        public Map<URI, String> getOpenFileURI2LangId() {
            return openedFileUri2LangId;
        }

        public Source getSource(URI uri) {
            return truffleAdapter.getSource(uri);
        }
    });
    this.serverCapabilities = capabilities;
    return CompletableFuture.completedFuture(InitializeResult.create(capabilities));
}
Also used : LSPServerAccessor(org.graalvm.tools.api.lsp.LSPServerAccessor) ArrayList(java.util.ArrayList) JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) ServerCapabilities(org.graalvm.tools.lsp.server.types.ServerCapabilities) Map(java.util.Map) HashMap(java.util.HashMap) URI(java.net.URI) Source(com.oracle.truffle.api.source.Source)

Aggregations

ServerCapabilities (org.graalvm.tools.lsp.server.types.ServerCapabilities)2 Source (com.oracle.truffle.api.source.Source)1 JSONObject (com.oracle.truffle.tools.utils.json.JSONObject)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 LSPServerAccessor (org.graalvm.tools.api.lsp.LSPServerAccessor)1 CompletionOptions (org.graalvm.tools.lsp.server.types.CompletionOptions)1