use of org.graalvm.tools.lsp.server.types.CompletionOptions 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);
}
use of org.graalvm.tools.lsp.server.types.CompletionOptions in project graal by oracle.
the class DelegateServers method supportsMethod.
static boolean supportsMethod(String method, JSONObject params, ServerCapabilities capabilities) {
Object capability;
switch(method) {
case "textDocument/codeAction":
capability = capabilities.getCodeActionProvider();
break;
case "textDocument/codeLens":
capability = capabilities.getCodeLensProvider();
break;
case "codeLens/resolve":
CodeLensOptions clp = capabilities.getCodeLensProvider();
capability = (clp != null) ? clp.getResolveProvider() : null;
break;
case "textDocument/colorPresentation":
capability = capabilities.getColorProvider();
break;
case "textDocument/completion":
capability = capabilities.getCompletionProvider();
break;
case "completionItem/resolve":
CompletionOptions co = capabilities.getCompletionProvider();
capability = (co != null) ? co.getResolveProvider() : null;
break;
case "textDocument/declaration":
capability = capabilities.getDeclarationProvider();
break;
case "textDocument/definition":
capability = capabilities.getDefinitionProvider();
break;
case "textDocument/formatting":
capability = capabilities.getDocumentFormattingProvider();
break;
case "textDocument/documentHighlight":
capability = capabilities.getDocumentHighlightProvider();
break;
case "textDocument/documentLink":
capability = capabilities.getDocumentLinkProvider();
break;
case "documentLink/resolve":
DocumentLinkOptions dlo = capabilities.getDocumentLinkProvider();
capability = (dlo != null) ? dlo.getResolveProvider() : null;
break;
case "textDocument/onTypeFormatting":
capability = capabilities.getDocumentOnTypeFormattingProvider();
break;
case "textDocument/rangeFormatting":
capability = capabilities.getDocumentRangeFormattingProvider();
break;
case "textDocument/documentSymbol":
capability = capabilities.getDocumentSymbolProvider();
break;
case "workspace/executeCommand":
ExecuteCommandOptions eco = capabilities.getExecuteCommandProvider();
return eco.getCommands().contains(params.getString("command"));
case "textDocument/foldingRange":
capability = capabilities.getFoldingRangeProvider();
break;
case "textDocument/hover":
capability = capabilities.getHoverProvider();
break;
case "textDocument/implementation":
capability = capabilities.getImplementationProvider();
break;
case "textDocument/references":
capability = capabilities.getReferencesProvider();
break;
case "textDocument/rename":
capability = capabilities.getRenameProvider();
break;
case "textDocument/prepareRename":
Object renameProvider = capabilities.getRenameProvider();
capability = (renameProvider != null) ? ((RenameOptions) renameProvider).getPrepareProvider() : null;
break;
case "textDocument/signatureHelp":
capability = capabilities.getSignatureHelpProvider();
break;
case "textDocument/didChange":
capability = capabilities.getTextDocumentSync();
if (capability instanceof TextDocumentSyncOptions) {
capability = ((TextDocumentSyncOptions) capability).getChange();
}
capability = (capability == TextDocumentSyncKind.Full || capability == TextDocumentSyncKind.Incremental) ? true : null;
break;
case "textDocument/typeDefinition":
capability = capabilities.getTypeDefinitionProvider();
break;
case "workspace/symbol":
capability = capabilities.getWorkspaceSymbolProvider();
break;
default:
return true;
}
return capability != null && !Boolean.FALSE.equals(capability);
}
use of org.graalvm.tools.lsp.server.types.CompletionOptions in project graal by oracle.
the class TruffleAdapter method setServerCapabilities.
public void setServerCapabilities(String languageId, ServerCapabilities capabilities) {
CompletionOptions completionProvider = capabilities.getCompletionProvider();
if (completionProvider != null) {
List<String> triggerCharacters = completionProvider.getTriggerCharacters();
if (triggerCharacters != null) {
completionTriggerCharacters.add(languageId, triggerCharacters);
}
}
SignatureHelpOptions signatureHelpProvider = capabilities.getSignatureHelpProvider();
if (signatureHelpProvider != null) {
List<String> triggerCharacters = signatureHelpProvider.getTriggerCharacters();
if (triggerCharacters != null) {
signatureTriggerCharacters.add(languageId, triggerCharacters);
}
}
}
Aggregations