GH-682: fixed broken symbols in symbols dialogs for Eclipse
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user