diff --git a/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/server/WorkspaceFoldersTest.java b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/server/WorkspaceFoldersTest.java index d2707338190..fc1ef8428c0 100644 --- a/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/server/WorkspaceFoldersTest.java +++ b/org.eclipse.xtext.ide.tests/src/org/eclipse/xtext/ide/tests/server/WorkspaceFoldersTest.java @@ -14,7 +14,6 @@ import java.util.concurrent.CompletableFuture; import org.eclipse.lsp4j.ClientCapabilities; -import org.eclipse.lsp4j.DidChangeNotebookDocumentParams; import org.eclipse.lsp4j.DidChangeWorkspaceFoldersParams; import org.eclipse.lsp4j.InitializeParams; import org.eclipse.lsp4j.InitializeResult; @@ -80,7 +79,6 @@ public void testInitializeWithWorkspaceFolders() throws Exception { new WorkspaceFolder(uriExtensions.toUriString(rootFolder2.toURI()), "root2"))); }); Assert.assertEquals(true, capabilities.getCapabilities().getWorkspace().getWorkspaceFolders().getSupported()); - ; Assert.assertEquals(2, getDiagnostics().size()); Assert.assertEquals(1, getDiagnostics().get(twoUri).size()); withBuild(() -> { diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java index ef45b51dd71..06c75cf7496 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/server/LanguageServerImpl.java @@ -231,7 +231,7 @@ public CompletableFuture initialize(InitializeParams params) { result.setCapabilities(createServerCapabilities(params)); access.addBuildListener(this); return requestManager.runWrite(() -> { - if (isWorkspaceFoldersSupported() && workspaceManager.isSupportsWorkspaceFolders()) { + if (clientSupportsWorkspaceFolders() && workspaceManager.isSupportsWorkspaceFolders()) { List workspaceFolders = params.getWorkspaceFolders(); if (workspaceFolders == null) workspaceFolders = Collections.emptyList(); @@ -244,7 +244,7 @@ public CompletableFuture initialize(InitializeParams params) { }, (cancelIndicator, it) -> it).thenApply(it -> initializeResult = it); } - protected boolean isWorkspaceFoldersSupported() { + protected boolean clientSupportsWorkspaceFolders() { return this.initializeParams.getCapabilities() != null && this.initializeParams.getCapabilities().getWorkspace() != null && this.initializeParams.getCapabilities().getWorkspace().getWorkspaceFolders() == Boolean.TRUE; diff --git a/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend b/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend index f8a2838eee2..8a4a2da8c37 100644 --- a/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend +++ b/org.eclipse.xtext.testing/src/org/eclipse/xtext/testing/AbstractLanguageServerTest.xtend @@ -229,7 +229,6 @@ abstract class AbstractLanguageServerTest implements Endpoint { new WorkspaceFolder(root.toURI.normalize.toUriString, '') ] ] - initializer?.apply(params) if (!useRootPath) { if (params.capabilities === null) { params.capabilities = new ClientCapabilities @@ -239,6 +238,7 @@ abstract class AbstractLanguageServerTest implements Endpoint { } params.capabilities.workspace.workspaceFolders = true } + initializer?.apply(params) hierarchicalDocumentSymbolSupport = params.capabilities?.textDocument?.documentSymbol?. hierarchicalDocumentSymbolSupport ?: false; val result = languageServer.initialize(params).get