org.eclipse.lsp4j.CompletionItemCapabilities Java Examples
The following examples show how to use
org.eclipse.lsp4j.CompletionItemCapabilities.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActionScriptServices.java From vscode-as3mxml with Apache License 2.0 | 6 votes |
public void setClientCapabilities(ClientCapabilities value) { completionSupportsSnippets = false; clientCapabilities = value; TextDocumentClientCapabilities textDocument = clientCapabilities.getTextDocument(); if(textDocument != null) { CompletionCapabilities completion = textDocument.getCompletion(); if(completion != null) { CompletionItemCapabilities completionItem = completion.getCompletionItem(); if(completionItem != null) { completionSupportsSnippets = completionItem.getSnippetSupport(); } } } }
Example #2
Source File: LanguageServerWrapper.java From lsp4intellij with Apache License 2.0 | 5 votes |
private InitializeParams getInitParams() { InitializeParams initParams = new InitializeParams(); initParams.setRootUri(FileUtils.pathToUri(projectRootPath)); //TODO update capabilities when implemented WorkspaceClientCapabilities workspaceClientCapabilities = new WorkspaceClientCapabilities(); workspaceClientCapabilities.setApplyEdit(true); workspaceClientCapabilities.setDidChangeWatchedFiles(new DidChangeWatchedFilesCapabilities()); workspaceClientCapabilities.setExecuteCommand(new ExecuteCommandCapabilities()); workspaceClientCapabilities.setWorkspaceEdit(new WorkspaceEditCapabilities()); workspaceClientCapabilities.setSymbol(new SymbolCapabilities()); workspaceClientCapabilities.setWorkspaceFolders(false); workspaceClientCapabilities.setConfiguration(false); TextDocumentClientCapabilities textDocumentClientCapabilities = new TextDocumentClientCapabilities(); textDocumentClientCapabilities.setCodeAction(new CodeActionCapabilities()); textDocumentClientCapabilities.setCompletion(new CompletionCapabilities(new CompletionItemCapabilities(true))); textDocumentClientCapabilities.setDefinition(new DefinitionCapabilities()); textDocumentClientCapabilities.setDocumentHighlight(new DocumentHighlightCapabilities()); textDocumentClientCapabilities.setFormatting(new FormattingCapabilities()); textDocumentClientCapabilities.setHover(new HoverCapabilities()); textDocumentClientCapabilities.setOnTypeFormatting(new OnTypeFormattingCapabilities()); textDocumentClientCapabilities.setRangeFormatting(new RangeFormattingCapabilities()); textDocumentClientCapabilities.setReferences(new ReferencesCapabilities()); textDocumentClientCapabilities.setRename(new RenameCapabilities()); textDocumentClientCapabilities.setSemanticHighlightingCapabilities(new SemanticHighlightingCapabilities(false)); textDocumentClientCapabilities.setSignatureHelp(new SignatureHelpCapabilities()); textDocumentClientCapabilities.setSynchronization(new SynchronizationCapabilities(true, true, true)); initParams.setCapabilities( new ClientCapabilities(workspaceClientCapabilities, textDocumentClientCapabilities, null)); initParams.setInitializationOptions( serverDefinition.getInitializationOptions(URI.create(initParams.getRootUri()))); return initParams; }
Example #3
Source File: PrologCompletionExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private SharedSettings createSharedSettings(boolean autoCloseTags, boolean isSnippetsSupported) { SharedSettings sharedSettings = new SharedSettings(); CompletionCapabilities capabilities = new CompletionCapabilities(); CompletionItemCapabilities itemCapabilities = new CompletionItemCapabilities(isSnippetsSupported); capabilities.setCompletionItem(itemCapabilities); sharedSettings.getCompletionSettings().setCapabilities(capabilities); sharedSettings.getCompletionSettings().setAutoCloseTags(autoCloseTags); return sharedSettings; }
Example #4
Source File: XMLModelCompletionExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private static void testCompletionFor(String xml, boolean isSnippetsSupported, Integer expectedCount, CompletionItem... expectedItems) throws BadLocationException { CompletionCapabilities completionCapabilities = new CompletionCapabilities(); CompletionItemCapabilities completionItem = new CompletionItemCapabilities(isSnippetsSupported); // activate // snippets completionCapabilities.setCompletionItem(completionItem); SharedSettings sharedSettings = new SharedSettings(); sharedSettings.getCompletionSettings().setCapabilities(completionCapabilities); XMLAssert.testCompletionFor(new XMLLanguageService(), xml, "src/test/resources/catalogs/catalog.xml", null, null, expectedCount, sharedSettings, expectedItems); }
Example #5
Source File: DTDCompletionExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private void testCompletionFor(String xml, boolean isSnippetsSupported, Integer expectedCount, CompletionItem... expectedItems) throws BadLocationException { CompletionCapabilities completionCapabilities = new CompletionCapabilities(); CompletionItemCapabilities completionItem = new CompletionItemCapabilities(isSnippetsSupported); // activate // snippets completionCapabilities.setCompletionItem(completionItem); SharedSettings sharedSettings = new SharedSettings(); sharedSettings.getCompletionSettings().setCapabilities(completionCapabilities); XMLAssert.testCompletionFor(new XMLLanguageService(), xml, "src/test/resources/catalogs/catalog.xml", null, null, expectedCount, sharedSettings, expectedItems); }
Example #6
Source File: XMLSchemaCompletionExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private void testCompletionMarkdownSupportFor(String xml, CompletionItem... expectedItems) throws BadLocationException { CompletionCapabilities completionCapabilities = new CompletionCapabilities(); CompletionItemCapabilities completionItem = new CompletionItemCapabilities(false); completionItem.setDocumentationFormat(Arrays.asList(MarkupKind.MARKDOWN)); completionCapabilities.setCompletionItem(completionItem); SharedSettings sharedSettings = new SharedSettings(); sharedSettings.getCompletionSettings().setCapabilities(completionCapabilities); XMLAssert.testCompletionFor(new XMLLanguageService(), xml, "src/test/resources/catalogs/catalog.xml", null, null, null, sharedSettings, expectedItems); }
Example #7
Source File: XMLSchemaCompletionExtensionsTest.java From lemminx with Eclipse Public License 2.0 | 5 votes |
private void testCompletionSnippetSupportFor(String xml, String fileURI, Integer expectedCount, CompletionItem... expectedItems) throws BadLocationException { CompletionCapabilities completionCapabilities = new CompletionCapabilities(); CompletionItemCapabilities completionItem = new CompletionItemCapabilities(true); completionItem.setDocumentationFormat(Arrays.asList(MarkupKind.MARKDOWN)); completionCapabilities.setCompletionItem(completionItem); SharedSettings sharedSettings = new SharedSettings(); sharedSettings.getCompletionSettings().setCapabilities(completionCapabilities); XMLAssert.testCompletionFor(new XMLLanguageService(), xml, null, null, fileURI, null, sharedSettings, expectedItems); }
Example #8
Source File: ClientPreferencesTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Test public void testIsCompletionSnippetsSupported() throws Exception { assertFalse(prefs.isCompletionSnippetsSupported()); when(text.getCompletion()).thenReturn(new CompletionCapabilities()); assertFalse(prefs.isCompletionSnippetsSupported()); when(text.getCompletion()).thenReturn(new CompletionCapabilities(new CompletionItemCapabilities(true))); assertTrue(prefs.isCompletionSnippetsSupported()); }
Example #9
Source File: DefaultLanguageServerWrapper.java From MSPaintIDE with MIT License | 4 votes |
@Override public InitializeParams getInitParams() { InitializeParams initParams = new InitializeParams(); if (this.rootPath != null) { var root = rootPath.toURI().toString(); if (this.useInputForWorkspace) { root = rootPath.toPath().relativize(inputFile.toPath()).toUri().toString(); } initParams.setRootUri(root); LOGGER.info("Workspace root is {}", root); } WorkspaceClientCapabilities workspaceClientCapabilities = new WorkspaceClientCapabilities(); workspaceClientCapabilities.setApplyEdit(true); workspaceClientCapabilities.setDidChangeWatchedFiles(new DidChangeWatchedFilesCapabilities()); workspaceClientCapabilities.setExecuteCommand(new ExecuteCommandCapabilities()); workspaceClientCapabilities.setWorkspaceEdit(new WorkspaceEditCapabilities()); // workspaceClientCapabilities.setSymbol(new SymbolCapabilities()); workspaceClientCapabilities.setWorkspaceFolders(true); workspaceClientCapabilities.setConfiguration(true); TextDocumentClientCapabilities textDocumentClientCapabilities = new TextDocumentClientCapabilities(); textDocumentClientCapabilities.setCodeAction(new CodeActionCapabilities()); textDocumentClientCapabilities.setCompletion(new CompletionCapabilities(new CompletionItemCapabilities(false))); textDocumentClientCapabilities.setDefinition(new DefinitionCapabilities()); // textDocumentClientCapabilities.setDocumentHighlight(new DocumentHighlightCapabilities()); textDocumentClientCapabilities.setFormatting(new FormattingCapabilities()); // textDocumentClientCapabilities.setHover(new HoverCapabilities()); // textDocumentClientCapabilities.setOnTypeFormatting(new OnTypeFormattingCapabilities()); // textDocumentClientCapabilities.setRangeFormatting(new RangeFormattingCapabilities()); textDocumentClientCapabilities.setReferences(new ReferencesCapabilities()); textDocumentClientCapabilities.setRename(new RenameCapabilities()); textDocumentClientCapabilities.setSemanticHighlightingCapabilities(new SemanticHighlightingCapabilities(false)); textDocumentClientCapabilities.setSignatureHelp(new SignatureHelpCapabilities()); textDocumentClientCapabilities.setSynchronization(new SynchronizationCapabilities(true, true, true)); initParams.setCapabilities( new ClientCapabilities(workspaceClientCapabilities, textDocumentClientCapabilities, null)); // initParams.setInitializationOptions(null); // initParams.setInitializationOptions( // serverDefinition.getInitializationOptions(URI.create(initParams.getRootUri()))); return initParams; }
Example #10
Source File: CompletionCapabilities.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
public CompletionCapabilities(final CompletionItemCapabilities completionItem) { this.completionItem = completionItem; }
Example #11
Source File: CompletionCapabilities.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
/** * The client supports the following `CompletionItem` specific * capabilities. */ @Pure public CompletionItemCapabilities getCompletionItem() { return this.completionItem; }
Example #12
Source File: CompletionCapabilities.java From lsp4j with Eclipse Public License 2.0 | 2 votes |
/** * The client supports the following `CompletionItem` specific * capabilities. */ public void setCompletionItem(final CompletionItemCapabilities completionItem) { this.completionItem = completionItem; }