Skip to content

Commit 82cd1e1

Browse files
committed
GH-682: fixed broken symbols in symbols dialogs for Eclipse
1 parent 224b47e commit 82cd1e1

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

eclipse-language-servers/org.springframework.tooling.ls.eclipse.gotosymbol/src/org/springframework/tooling/ls/eclipse/gotosymbol/dialogs/InFileSymbolsProvider.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017, 2020 Pivotal, Inc.
2+
* Copyright (c) 2017, 2021 Pivotal, Inc.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -103,8 +103,7 @@ public static SymbolsProvider createFor(ITextEditor textEditor) {
103103
private static LSPDocumentInfo getLSPDocumentInfo(IDocument document) {
104104
if (document!=null) {
105105
Collection<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor(
106-
document,
107-
capabilities -> Boolean.TRUE.equals(capabilities.getDocumentSymbolProvider()));
106+
document, capabilities -> LSPEclipseUtils.hasCapability(capabilities.getDocumentSymbolProvider()));
108107
if (infos.isEmpty()) {
109108
return null;
110109
}

eclipse-language-servers/org.springframework.tooling.ls.eclipse.gotosymbol/src/org/springframework/tooling/ls/eclipse/gotosymbol/dialogs/InProjectSymbolsProvider.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019 Pivotal, Inc.
2+
* Copyright (c) 2019, 2021 Pivotal, Inc.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -41,8 +41,8 @@ public static InProjectSymbolsProvider createFor(LiveExpression<IProject> projec
4141
return p == null
4242
? ImmutableList.of()
4343
: LanguageServiceAccessor.getLanguageServers(
44-
project.getValue(),
45-
capabilities -> Boolean.TRUE.equals(capabilities.getWorkspaceSymbolProvider()),
44+
project.getValue(),
45+
capabilities -> LSPEclipseUtils.hasCapability(capabilities.getWorkspaceSymbolProvider()),
4646
true
4747
);
4848
});

eclipse-language-servers/org.springframework.tooling.ls.eclipse.gotosymbol/src/org/springframework/tooling/ls/eclipse/gotosymbol/dialogs/InWorkspaceSymbolsProvider.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017, 2019, 2020 Pivotal, Inc.
2+
* Copyright (c) 2017, 2021 Pivotal, Inc.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -21,6 +21,7 @@
2121
import org.eclipse.core.resources.IResource;
2222
import org.eclipse.core.runtime.IAdaptable;
2323
import org.eclipse.jface.viewers.IStructuredSelection;
24+
import org.eclipse.lsp4e.LSPEclipseUtils;
2425
import org.eclipse.lsp4e.LanguageServiceAccessor;
2526
import org.eclipse.lsp4j.DocumentSymbol;
2627
import org.eclipse.lsp4j.ServerCapabilities;
@@ -42,7 +43,7 @@
4243
@SuppressWarnings("restriction")
4344
public class InWorkspaceSymbolsProvider implements SymbolsProvider {
4445

45-
private static final Predicate<ServerCapabilities> WS_SYMBOL_CAP = capabilities -> Boolean.TRUE.equals(capabilities.getWorkspaceSymbolProvider());
46+
private static final Predicate<ServerCapabilities> WS_SYMBOL_CAP = capabilities -> LSPEclipseUtils.hasCapability(capabilities.getWorkspaceSymbolProvider());
4647

4748
public static InWorkspaceSymbolsProvider createFor(Supplier<IProject> _project) {
4849
return new InWorkspaceSymbolsProvider(() -> {
@@ -58,7 +59,7 @@ public static InWorkspaceSymbolsProvider createFor(Supplier<IProject> _project)
5859

5960
public static InWorkspaceSymbolsProvider createFor(IProject project) {
6061
List<LanguageServer> languageServers = LanguageServiceAccessor.getLanguageServers(project,
61-
capabilities -> Boolean.TRUE.equals(capabilities.getWorkspaceSymbolProvider()), true);
62+
capabilities -> LSPEclipseUtils.hasCapability(capabilities.getWorkspaceSymbolProvider()), true);
6263
if (!languageServers.isEmpty()) {
6364
return new InWorkspaceSymbolsProvider(() -> languageServers);
6465
}

eclipse-language-servers/org.springframework.tooling.ls.eclipse.gotosymbol/src/org/springframework/tooling/ls/eclipse/gotosymbol/handlers/GotoSymbolHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2016, 2019 Rogue Wave Software Inc. and others.
2+
* Copyright (c) 2016, 2021 Rogue Wave Software Inc. and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -102,7 +102,7 @@ public boolean _isEnabled() {
102102
debug("activePart instanceof ITextEditor");
103103
List<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor(
104104
LSPEclipseUtils.getDocument((ITextEditor) part),
105-
(capabilities) -> Boolean.TRUE.equals(capabilities.getDocumentSymbolProvider()));
105+
capabilities -> LSPEclipseUtils.hasCapability(capabilities.getDocumentSymbolProvider()));
106106
return !infos.isEmpty();
107107
}
108108
debug("activePart not ITextEditor: "+part);

0 commit comments

Comments
 (0)