use of org.graalvm.tools.api.lsp.LSPServerAccessor 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));
}
Aggregations