updated lsp4j to 0.9.0 release
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2020 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
|
||||
@@ -18,10 +18,10 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.commons.languageserver.definition.SimpleDefinitionFinder;
|
||||
@@ -38,7 +38,7 @@ import org.yaml.snakeyaml.nodes.Node;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableList.Builder;
|
||||
|
||||
public class BoshDefintionFinder extends SimpleDefinitionFinder<SimpleLanguageServer> {
|
||||
public class BoshDefintionFinder extends SimpleDefinitionFinder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(BoshDefintionFinder.class);
|
||||
|
||||
@@ -73,9 +73,9 @@ public class BoshDefintionFinder extends SimpleDefinitionFinder<SimpleLanguageSe
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocationLink> handle(TextDocumentPositionParams params) {
|
||||
public List<LocationLink> handle(DefinitionParams params) {
|
||||
try {
|
||||
TextDocument doc = server.getTextDocumentService().get(params);
|
||||
TextDocument doc = server.getTextDocumentService().get(params.getTextDocument().getUri());
|
||||
if (doc!=null) {
|
||||
YamlFileAST ast = asts.getSafeAst(doc, false);
|
||||
if (ast!=null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2020 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
|
||||
@@ -18,7 +18,7 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.lsp4j.Hover;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.HoverParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.commons.languageserver.completion.CompositeCompletionEngine;
|
||||
@@ -105,13 +105,13 @@ public class CompositeLanguageServerComponents implements LanguageServerComponen
|
||||
//Create composite hover handler
|
||||
this.hoverHandler = new HoverHandler() {
|
||||
@Override
|
||||
public Hover handle(TextDocumentPositionParams params) {
|
||||
TextDocument doc = server.getTextDocumentService().get(params);
|
||||
public Hover handle(HoverParams params) {
|
||||
TextDocument doc = server.getTextDocumentService().get(params.getTextDocument().getUri());
|
||||
LanguageId language = doc.getLanguageId();
|
||||
LanguageServerComponents subComponents = componentsByLanguageId.get(language);
|
||||
if (subComponents!=null) {
|
||||
HoverHandler subEngine = subComponents.getHoverProvider();
|
||||
if (subEngine!=null) {
|
||||
if (subEngine != null) {
|
||||
return subEngine.handle(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2020 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
|
||||
@@ -13,9 +13,9 @@ package org.springframework.ide.vscode.commons.languageserver.definition;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.commons.languageserver.util.DefinitionHandler;
|
||||
@@ -28,20 +28,20 @@ import com.google.common.collect.ImmutableList;
|
||||
* {@link SimpleDefinitionFinder} provides a 'dummy' implementation of
|
||||
* @author Kris De Volder
|
||||
*/
|
||||
public class SimpleDefinitionFinder<T extends SimpleLanguageServer> implements DefinitionHandler {
|
||||
public class SimpleDefinitionFinder implements DefinitionHandler {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SimpleDefinitionFinder.class);
|
||||
|
||||
protected final T server;
|
||||
protected final SimpleLanguageServer server;
|
||||
|
||||
public SimpleDefinitionFinder(T server) {
|
||||
public SimpleDefinitionFinder(SimpleLanguageServer server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocationLink> handle(TextDocumentPositionParams params) {
|
||||
public List<LocationLink> handle(DefinitionParams params) {
|
||||
try {
|
||||
TextDocument doc = server.getTextDocumentService().get(params);
|
||||
TextDocument doc = server.getTextDocumentService().get(params.getTextDocument().getUri());
|
||||
if (doc != null) {
|
||||
int offset = doc.toOffset(params.getPosition());
|
||||
int start = offset;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2020 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
|
||||
@@ -10,18 +10,15 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.commons.languageserver.hover;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.eclipse.lsp4j.Hover;
|
||||
import org.eclipse.lsp4j.HoverParams;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.commons.languageserver.util.HoverHandler;
|
||||
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
|
||||
import org.springframework.ide.vscode.commons.languageserver.util.SimpleTextDocumentService;
|
||||
import org.springframework.ide.vscode.commons.util.Log;
|
||||
import org.springframework.ide.vscode.commons.util.Renderable;
|
||||
import org.springframework.ide.vscode.commons.util.StringUtil;
|
||||
import org.springframework.ide.vscode.commons.util.text.IRegion;
|
||||
@@ -60,11 +57,11 @@ public class VscodeHoverEngineAdapter implements HoverHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hover handle(TextDocumentPositionParams params) {
|
||||
public Hover handle(HoverParams params) {
|
||||
try {
|
||||
SimpleTextDocumentService documents = server.getTextDocumentService();
|
||||
TextDocument doc = documents.get(params);
|
||||
if (doc!=null) {
|
||||
TextDocument doc = documents.get(params.getTextDocument().getUri());
|
||||
if (doc != null) {
|
||||
int offset = doc.toOffset(params.getPosition());
|
||||
|
||||
Tuple2<Renderable, IRegion> hoverTuple = hoverInfoProvider.getHoverInfo(doc, offset);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2017, 2020 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
|
||||
@@ -12,10 +12,10 @@ package org.springframework.ide.vscode.commons.languageserver.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface DefinitionHandler {
|
||||
List<LocationLink> handle(TextDocumentPositionParams position);
|
||||
List<LocationLink> handle(DefinitionParams definitionParams);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2020 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
|
||||
@@ -13,11 +13,11 @@ package org.springframework.ide.vscode.commons.languageserver.util;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.lsp4j.DocumentHighlight;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.DocumentHighlightParams;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface DocumentHighlightHandler {
|
||||
|
||||
List<? extends DocumentHighlight> handle(TextDocumentPositionParams position);
|
||||
List<? extends DocumentHighlight> handle(DocumentHighlightParams highligtParams);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016-2018 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2020 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
|
||||
@@ -8,13 +8,12 @@
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.springframework.ide.vscode.commons.languageserver.util;
|
||||
|
||||
import org.eclipse.lsp4j.Hover;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.HoverParams;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface HoverHandler {
|
||||
Hover handle(TextDocumentPositionParams params);
|
||||
Hover handle(HoverParams params);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2020 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
|
||||
@@ -28,6 +28,7 @@ import org.eclipse.lsp4j.Command;
|
||||
import org.eclipse.lsp4j.CompletionItem;
|
||||
import org.eclipse.lsp4j.CompletionList;
|
||||
import org.eclipse.lsp4j.CompletionParams;
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.eclipse.lsp4j.DidChangeTextDocumentParams;
|
||||
import org.eclipse.lsp4j.DidCloseTextDocumentParams;
|
||||
@@ -35,11 +36,13 @@ import org.eclipse.lsp4j.DidOpenTextDocumentParams;
|
||||
import org.eclipse.lsp4j.DidSaveTextDocumentParams;
|
||||
import org.eclipse.lsp4j.DocumentFormattingParams;
|
||||
import org.eclipse.lsp4j.DocumentHighlight;
|
||||
import org.eclipse.lsp4j.DocumentHighlightParams;
|
||||
import org.eclipse.lsp4j.DocumentOnTypeFormattingParams;
|
||||
import org.eclipse.lsp4j.DocumentRangeFormattingParams;
|
||||
import org.eclipse.lsp4j.DocumentSymbol;
|
||||
import org.eclipse.lsp4j.DocumentSymbolParams;
|
||||
import org.eclipse.lsp4j.Hover;
|
||||
import org.eclipse.lsp4j.HoverParams;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||
@@ -47,6 +50,7 @@ import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.ReferenceParams;
|
||||
import org.eclipse.lsp4j.RenameParams;
|
||||
import org.eclipse.lsp4j.SignatureHelp;
|
||||
import org.eclipse.lsp4j.SignatureHelpParams;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.TextDocumentContentChangeEvent;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
@@ -327,20 +331,20 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Hover> hover(TextDocumentPositionParams position) {
|
||||
log.debug("hover requested for {}", position);
|
||||
public CompletableFuture<Hover> hover(HoverParams hoverParams) {
|
||||
log.debug("hover requested for {}", hoverParams.getPosition());
|
||||
long timeout = props.getHoverTimeout();
|
||||
return timeout <= 0 ? async.invoke(() -> computeHover(position)) : async.invoke(Duration.ofMillis(timeout), () -> computeHover(position), Mono.fromRunnable(() -> {
|
||||
return timeout <= 0 ? async.invoke(() -> computeHover(hoverParams)) : async.invoke(Duration.ofMillis(timeout), () -> computeHover(hoverParams), Mono.fromRunnable(() -> {
|
||||
log.error("Hover Request handler timed out after {} ms.", timeout);
|
||||
}));
|
||||
}
|
||||
|
||||
private Hover computeHover(TextDocumentPositionParams position) {
|
||||
private Hover computeHover(HoverParams hoverParams) {
|
||||
try {
|
||||
log.debug("hover handler starting");
|
||||
HoverHandler h = hoverHandler;
|
||||
if (h!=null) {
|
||||
return hoverHandler.handle(position);
|
||||
if (h != null) {
|
||||
return hoverHandler.handle(hoverParams);
|
||||
}
|
||||
log.debug("no hover because there is no handler");
|
||||
return null;
|
||||
@@ -350,18 +354,18 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<SignatureHelp> signatureHelp(TextDocumentPositionParams position) {
|
||||
public CompletableFuture<SignatureHelp> signatureHelp(SignatureHelpParams signatureHelpParams) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definition(
|
||||
TextDocumentPositionParams position) {
|
||||
DefinitionParams definitionParams) {
|
||||
|
||||
DefinitionHandler h = this.definitionHandler;
|
||||
if (h != null) {
|
||||
return async.invoke(() -> {
|
||||
List<LocationLink> locations = h.handle(position);
|
||||
List<LocationLink> locations = h.handle(definitionParams);
|
||||
if (locations==null) {
|
||||
// vscode client does not like to receive null result. See: https://github.com/spring-projects/sts4/issues/309
|
||||
locations = ImmutableList.of();
|
||||
@@ -524,11 +528,11 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(TextDocumentPositionParams position) {
|
||||
public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams highlightParams) {
|
||||
return async.invoke(() -> {
|
||||
DocumentHighlightHandler handler = this.documentHighlightHandler;
|
||||
if (handler != null) {
|
||||
return handler.handle(position);
|
||||
return handler.handle(highlightParams);
|
||||
}
|
||||
return NO_HIGHLIGHTS;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2016, 2020 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
|
||||
@@ -8,7 +8,6 @@
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.springframework.ide.vscode.languageserver.testharness;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -36,6 +35,7 @@ import javax.swing.text.BadLocationException;
|
||||
import org.eclipse.lsp4j.CodeLens;
|
||||
import org.eclipse.lsp4j.CompletionItem;
|
||||
import org.eclipse.lsp4j.CompletionList;
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.eclipse.lsp4j.DocumentSymbol;
|
||||
import org.eclipse.lsp4j.Hover;
|
||||
@@ -47,7 +47,6 @@ import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.TextEdit;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.junit.Assert;
|
||||
@@ -752,7 +751,7 @@ public class Editor {
|
||||
}
|
||||
assertTrue("Not found in editor: '"+hoverOver+"'", pos>=0);
|
||||
|
||||
TextDocumentPositionParams params = new TextDocumentPositionParams(new TextDocumentIdentifier(getUri()), doc.toPosition(pos));
|
||||
DefinitionParams params = new DefinitionParams(new TextDocumentIdentifier(getUri()), doc.toPosition(pos));
|
||||
List<? extends LocationLink> definitions = harness.getDefinitions(params);
|
||||
|
||||
assertEquals(ImmutableSet.copyOf(expectedLocations), ImmutableSet.copyOf(definitions));
|
||||
@@ -765,7 +764,7 @@ public class Editor {
|
||||
}
|
||||
assertTrue("Not found in editor: '"+hoverOver+"'", pos>=0);
|
||||
|
||||
TextDocumentPositionParams params = new TextDocumentPositionParams(new TextDocumentIdentifier(getUri()), doc.toPosition(pos));
|
||||
DefinitionParams params = new DefinitionParams(new TextDocumentIdentifier(getUri()), doc.toPosition(pos));
|
||||
List<? extends LocationLink> definitions = harness.getDefinitions(params);
|
||||
|
||||
assertTrue(definitions == null || definitions.isEmpty());
|
||||
@@ -838,7 +837,7 @@ public class Editor {
|
||||
|
||||
public void assertGotoDefinition(Position pos, Range expectedTarget, Range highlightRange) throws Exception {
|
||||
TextDocumentIdentifier textDocumentId = doc.getId();
|
||||
TextDocumentPositionParams params = new TextDocumentPositionParams(textDocumentId, textDocumentId.getUri(), pos);
|
||||
DefinitionParams params = new DefinitionParams(textDocumentId, pos);
|
||||
List<? extends LocationLink> defs = harness.getDefinitions(params);
|
||||
assertEquals(1, defs.size());
|
||||
assertEquals(new LocationLink(textDocumentId.getUri(), expectedTarget, expectedTarget, highlightRange), defs.get(0));
|
||||
|
||||
@@ -55,6 +55,7 @@ import org.eclipse.lsp4j.CompletionItemCapabilities;
|
||||
import org.eclipse.lsp4j.CompletionList;
|
||||
import org.eclipse.lsp4j.CompletionParams;
|
||||
import org.eclipse.lsp4j.CreateFile;
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.DeleteFile;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.eclipse.lsp4j.DiagnosticSeverity;
|
||||
@@ -71,6 +72,7 @@ import org.eclipse.lsp4j.ExecuteCommandParams;
|
||||
import org.eclipse.lsp4j.FileChangeType;
|
||||
import org.eclipse.lsp4j.FileEvent;
|
||||
import org.eclipse.lsp4j.Hover;
|
||||
import org.eclipse.lsp4j.HoverParams;
|
||||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
@@ -92,7 +94,6 @@ import org.eclipse.lsp4j.TextDocumentContentChangeEvent;
|
||||
import org.eclipse.lsp4j.TextDocumentEdit;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentItem;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.TextDocumentSyncKind;
|
||||
import org.eclipse.lsp4j.TextDocumentSyncOptions;
|
||||
import org.eclipse.lsp4j.TextEdit;
|
||||
@@ -597,7 +598,7 @@ public class LanguageServerHarness {
|
||||
}
|
||||
|
||||
public Hover getHover(TextDocumentInfo document, Position cursor) throws Exception {
|
||||
TextDocumentPositionParams params = new TextDocumentPositionParams();
|
||||
HoverParams params = new HoverParams();
|
||||
params.setPosition(cursor);
|
||||
params.setTextDocument(document.getId());
|
||||
return getServer().getTextDocumentService().hover(params ).get();
|
||||
@@ -726,7 +727,7 @@ public class LanguageServerHarness {
|
||||
assertEquals(expected, completion.getLabel());
|
||||
}
|
||||
|
||||
public List<? extends LocationLink> getDefinitions(TextDocumentPositionParams params) throws Exception {
|
||||
public List<? extends LocationLink> getDefinitions(DefinitionParams params) throws Exception {
|
||||
waitForReconcile(); //goto definitions relies on reconciler infos! Must wait or race condition breaking tests occasionally.
|
||||
return getServer().getTextDocumentService().definition(params).get().getRight();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<mockito-version>1.10.19</mockito-version>
|
||||
<jackson-2-version>2.5.0</jackson-2-version>
|
||||
<jersey-2-version>2.10</jersey-2-version>
|
||||
<lsp4j-version>0.7.2</lsp4j-version>
|
||||
<lsp4j-version>0.9.0</lsp4j-version>
|
||||
<!-- NOTE: Reactor version must match version used by the CF client -->
|
||||
<cloudfoundry-client-version>3.8.0.RELEASE</cloudfoundry-client-version>
|
||||
<reactor-version>3.1.5.RELEASE</reactor-version>
|
||||
|
||||
@@ -16,10 +16,10 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.commons.languageserver.definition.SimpleDefinitionFinder;
|
||||
@@ -37,7 +37,7 @@ import org.yaml.snakeyaml.nodes.Node;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableList.Builder;
|
||||
|
||||
public class ConcourseDefinitionFinder extends SimpleDefinitionFinder<SimpleLanguageServer> {
|
||||
public class ConcourseDefinitionFinder extends SimpleDefinitionFinder {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ConcourseDefinitionFinder.class);
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ConcourseDefinitionFinder extends SimpleDefinitionFinder<SimpleLang
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocationLink> handle(TextDocumentPositionParams params) {
|
||||
public List<LocationLink> handle(DefinitionParams params) {
|
||||
try {
|
||||
TextDocument doc = server.getTextDocumentService().get(params);
|
||||
if (doc!=null) {
|
||||
|
||||
@@ -14,9 +14,9 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -61,13 +61,13 @@ public class PropertiesJavaDefinitionHandler implements DefinitionHandler, Langu
|
||||
private BootLanguageServerParams params;
|
||||
|
||||
@Override
|
||||
public List<LocationLink> handle(TextDocumentPositionParams position) {
|
||||
public List<LocationLink> handle(DefinitionParams definitionParams) {
|
||||
try {
|
||||
TextDocument doc = documents.get(position);
|
||||
TextDocument doc = documents.get(definitionParams);
|
||||
TypeUtil typeUtil = params.typeUtilProvider.getTypeUtil(sourceLinks, doc);
|
||||
FuzzyMap<PropertyInfo> index = params.indexProvider.getIndex(doc).getProperties();
|
||||
int offset;
|
||||
offset = doc.toOffset(position.getPosition());
|
||||
offset = doc.toOffset(definitionParams.getPosition());
|
||||
return getDefinitions(index, typeUtil, doc, offset);
|
||||
} catch (BadLocationException e) {
|
||||
return ImmutableList.of();
|
||||
|
||||
@@ -54,9 +54,9 @@ import org.eclipse.lemminx.dom.DOMParser;
|
||||
import org.eclipse.lemminx.dom.parser.Scanner;
|
||||
import org.eclipse.lemminx.dom.parser.TokenType;
|
||||
import org.eclipse.lemminx.dom.parser.XMLScanner;
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.links.JavaElementLocationProvider;
|
||||
@@ -140,17 +140,17 @@ public class XmlBeansConfigDefinitionHandler implements DefinitionHandler, Langu
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocationLink> handle(TextDocumentPositionParams position) {
|
||||
public List<LocationLink> handle(DefinitionParams params) {
|
||||
try {
|
||||
if (config.isSpringXMLSupportEnabled() && config.areXmlHyperlinksEnabled()) {
|
||||
TextDocument doc = documents.get(position);
|
||||
TextDocument doc = documents.get(params);
|
||||
if (doc != null) {
|
||||
String content = doc.get();
|
||||
|
||||
DOMParser parser = DOMParser.getInstance();
|
||||
DOMDocument dom = parser.parse(content, "", null);
|
||||
|
||||
int offset = doc.toOffset(position.getPosition());
|
||||
int offset = doc.toOffset(params.getPosition());
|
||||
|
||||
DOMNode node = dom.findNodeBefore(offset);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018, 2019 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2020 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
|
||||
@@ -14,10 +14,10 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.lsp4j.DefinitionParams;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -68,10 +68,10 @@ public class YamlPropertiesJavaDefinitionHandler implements DefinitionHandler, L
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocationLink> handle(TextDocumentPositionParams position) {
|
||||
public List<LocationLink> handle(DefinitionParams definitionParams) {
|
||||
try {
|
||||
TextDocument doc = documents.get(position);
|
||||
int offset = doc.toOffset(position.getPosition());
|
||||
TextDocument doc = documents.get(definitionParams);
|
||||
int offset = doc.toOffset(definitionParams.getPosition());
|
||||
YamlFileAST ast = getAst(doc);
|
||||
if (ast != null) {
|
||||
YamlDocument ymlDoc = new YamlDocument(doc, structureProvider);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018 Pivotal, Inc.
|
||||
* Copyright (c) 2018, 2020 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
|
||||
@@ -15,8 +15,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.lsp4j.DocumentHighlight;
|
||||
import org.eclipse.lsp4j.DocumentHighlightParams;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
|
||||
@@ -40,7 +40,7 @@ public class BootJavaDocumentHighlightEngine implements DocumentHighlightHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DocumentHighlight> handle(TextDocumentPositionParams params) {
|
||||
public List<DocumentHighlight> handle(DocumentHighlightParams params) {
|
||||
SimpleTextDocumentService documents = server.getTextDocumentService();
|
||||
String docURI = params.getTextDocument().getUri();
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
|
||||
import org.eclipse.jdt.core.dom.TypeDeclaration;
|
||||
import org.eclipse.lsp4j.CodeLens;
|
||||
import org.eclipse.lsp4j.Hover;
|
||||
import org.eclipse.lsp4j.HoverParams;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -71,7 +71,7 @@ public class BootJavaHoverProvider implements HoverHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hover handle(TextDocumentPositionParams params) {
|
||||
public Hover handle(HoverParams params) {
|
||||
SimpleTextDocumentService documents = server.getTextDocumentService();
|
||||
if (documents.get(params) != null) {
|
||||
TextDocument doc = documents.get(params).copy();
|
||||
|
||||
Reference in New Issue
Block a user