Java Code Examples for org.eclipse.lsp4j.DocumentSymbolCapabilities#setHierarchicalDocumentSymbolSupport()
The following examples show how to use
org.eclipse.lsp4j.DocumentSymbolCapabilities#setHierarchicalDocumentSymbolSupport() .
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: LSPBindings.java From netbeans with Apache License 2.0 | 5 votes |
private static InitializeResult initServer(Process p, LanguageServer server, FileObject root) throws InterruptedException, ExecutionException { InitializeParams initParams = new InitializeParams(); initParams.setRootUri(Utils.toURI(root)); initParams.setRootPath(FileUtil.toFile(root).getAbsolutePath()); //some servers still expect root path initParams.setProcessId(0); TextDocumentClientCapabilities tdcc = new TextDocumentClientCapabilities(); DocumentSymbolCapabilities dsc = new DocumentSymbolCapabilities(); dsc.setHierarchicalDocumentSymbolSupport(true); dsc.setSymbolKind(new SymbolKindCapabilities(Arrays.asList(SymbolKind.values()))); tdcc.setDocumentSymbol(dsc); WorkspaceClientCapabilities wcc = new WorkspaceClientCapabilities(); wcc.setWorkspaceEdit(new WorkspaceEditCapabilities()); wcc.getWorkspaceEdit().setDocumentChanges(true); wcc.getWorkspaceEdit().setResourceOperations(Arrays.asList(ResourceOperationKind.Create, ResourceOperationKind.Delete, ResourceOperationKind.Rename)); initParams.setCapabilities(new ClientCapabilities(wcc, tdcc, null)); CompletableFuture<InitializeResult> initResult = server.initialize(initParams); while (true) { try { return initResult.get(100, TimeUnit.MILLISECONDS); } catch (TimeoutException ex) { if (p != null && !p.isAlive()) { InitializeResult emptyResult = new InitializeResult(); emptyResult.setCapabilities(new ServerCapabilities()); return emptyResult; } } } }
Example 2
Source File: ClientPreferencesTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Test public void testIsHierarchicalDocumentSymbolSupported() throws Exception { DocumentSymbolCapabilities capabilities = new DocumentSymbolCapabilities(); assertFalse(prefs.isHierarchicalDocumentSymbolSupported()); when(text.getDocumentSymbol()).thenReturn(capabilities); assertFalse(prefs.isHierarchicalDocumentSymbolSupported()); capabilities.setHierarchicalDocumentSymbolSupport(false); when(text.getDocumentSymbol()).thenReturn(capabilities); assertFalse(prefs.isHierarchicalDocumentSymbolSupported()); capabilities.setHierarchicalDocumentSymbolSupport(true); when(text.getDocumentSymbol()).thenReturn(capabilities); assertTrue(prefs.isHierarchicalDocumentSymbolSupported()); }