GH-682: fixed broken symbols in symbols dialogs for Eclipse

This commit is contained in:
Martin Lippert
2021-09-10 14:02:35 +02:00
parent 224b47e217
commit 82cd1e1302
4 changed files with 11 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2020 Pivotal, Inc.
* Copyright (c) 2017, 2021 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -103,8 +103,7 @@ public class InFileSymbolsProvider implements SymbolsProvider {
private static LSPDocumentInfo getLSPDocumentInfo(IDocument document) {
if (document!=null) {
Collection<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor(
document,
capabilities -> Boolean.TRUE.equals(capabilities.getDocumentSymbolProvider()));
document, capabilities -> LSPEclipseUtils.hasCapability(capabilities.getDocumentSymbolProvider()));
if (infos.isEmpty()) {
return null;
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 Pivotal, Inc.
* Copyright (c) 2019, 2021 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,8 +41,8 @@ public class InProjectSymbolsProvider implements SymbolsProvider {
return p == null
? ImmutableList.of()
: LanguageServiceAccessor.getLanguageServers(
project.getValue(),
capabilities -> Boolean.TRUE.equals(capabilities.getWorkspaceSymbolProvider()),
project.getValue(),
capabilities -> LSPEclipseUtils.hasCapability(capabilities.getWorkspaceSymbolProvider()),
true
);
});

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2019, 2020 Pivotal, Inc.
* Copyright (c) 2017, 2021 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,6 +21,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.lsp4e.LSPEclipseUtils;
import org.eclipse.lsp4e.LanguageServiceAccessor;
import org.eclipse.lsp4j.DocumentSymbol;
import org.eclipse.lsp4j.ServerCapabilities;
@@ -42,7 +43,7 @@ import reactor.core.publisher.Mono;
@SuppressWarnings("restriction")
public class InWorkspaceSymbolsProvider implements SymbolsProvider {
private static final Predicate<ServerCapabilities> WS_SYMBOL_CAP = capabilities -> Boolean.TRUE.equals(capabilities.getWorkspaceSymbolProvider());
private static final Predicate<ServerCapabilities> WS_SYMBOL_CAP = capabilities -> LSPEclipseUtils.hasCapability(capabilities.getWorkspaceSymbolProvider());
public static InWorkspaceSymbolsProvider createFor(Supplier<IProject> _project) {
return new InWorkspaceSymbolsProvider(() -> {
@@ -58,7 +59,7 @@ public class InWorkspaceSymbolsProvider implements SymbolsProvider {
public static InWorkspaceSymbolsProvider createFor(IProject project) {
List<LanguageServer> languageServers = LanguageServiceAccessor.getLanguageServers(project,
capabilities -> Boolean.TRUE.equals(capabilities.getWorkspaceSymbolProvider()), true);
capabilities -> LSPEclipseUtils.hasCapability(capabilities.getWorkspaceSymbolProvider()), true);
if (!languageServers.isEmpty()) {
return new InWorkspaceSymbolsProvider(() -> languageServers);
}

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2019 Rogue Wave Software Inc. and others.
* Copyright (c) 2016, 2021 Rogue Wave Software Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -102,7 +102,7 @@ public class GotoSymbolHandler extends AbstractHandler {
debug("activePart instanceof ITextEditor");
List<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor(
LSPEclipseUtils.getDocument((ITextEditor) part),
(capabilities) -> Boolean.TRUE.equals(capabilities.getDocumentSymbolProvider()));
capabilities -> LSPEclipseUtils.hasCapability(capabilities.getDocumentSymbolProvider()));
return !infos.isEmpty();
}
debug("activePart not ITextEditor: "+part);