mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
[#1244] lsp4j 0.9.0
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
parent
3f597184aa
commit
0766f69605
8 changed files with 39 additions and 36 deletions
|
@ -14,8 +14,8 @@ Require-Bundle: org.eclipse.xtext;visibility:=reexport,
|
|||
org.eclipse.core.runtime;bundle-version="3.13.0",
|
||||
org.eclipse.xtext.ide,
|
||||
org.junit;bundle-version="4.12.0",
|
||||
org.eclipse.lsp4j;bundle-version="[0.8.1,0.9.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.8.1,0.9.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j;bundle-version="[0.9.0,0.10.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.9.0,0.10.0)";resolution:=optional,
|
||||
org.eclipse.xtext.testlanguages,
|
||||
org.eclipse.xtext.testlanguages.ide
|
||||
Import-Package: org.apache.log4j;version="1.2.15"
|
||||
|
|
|
@ -15,8 +15,10 @@ import java.util.List
|
|||
import org.eclipse.emf.ecore.EObject
|
||||
import org.eclipse.lsp4j.ParameterInformation
|
||||
import org.eclipse.lsp4j.SignatureHelp
|
||||
import org.eclipse.lsp4j.SignatureHelpParams
|
||||
import org.eclipse.lsp4j.SignatureInformation
|
||||
import org.eclipse.xtext.EcoreUtil2
|
||||
import org.eclipse.xtext.ide.server.Document
|
||||
import org.eclipse.xtext.ide.server.signatureHelp.ISignatureHelpService
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.Operation
|
||||
import org.eclipse.xtext.ide.tests.testlanguage.testLanguage.OperationCall
|
||||
|
@ -29,8 +31,6 @@ import org.eclipse.xtext.nodemodel.util.NodeModelUtils
|
|||
import org.eclipse.xtext.resource.EObjectAtOffsetHelper
|
||||
import org.eclipse.xtext.resource.XtextResource
|
||||
import org.eclipse.xtext.scoping.IScopeProvider
|
||||
import org.eclipse.xtext.ide.server.Document
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams
|
||||
import org.eclipse.xtext.util.CancelIndicator
|
||||
|
||||
/**
|
||||
|
@ -71,12 +71,8 @@ class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
|
||||
extension TestLanguagePackage = TestLanguagePackage.eINSTANCE;
|
||||
|
||||
override getSignatureHelp(Document document, XtextResource resource, TextDocumentPositionParams params, CancelIndicator cancelIndicator) {
|
||||
override getSignatureHelp(Document document, XtextResource resource, SignatureHelpParams params, CancelIndicator cancelIndicator) {
|
||||
val offset = document.getOffSet(params.position)
|
||||
return getSignatureHelp(resource, offset)
|
||||
}
|
||||
|
||||
override getSignatureHelp(XtextResource resource, int offset) {
|
||||
|
||||
Preconditions.checkNotNull(resource, "resource");
|
||||
Preconditions.checkArgument(offset >= 0, "offset >= 0. Was: " + offset);
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.eclipse.emf.ecore.EClass;
|
|||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.lsp4j.ParameterInformation;
|
||||
import org.eclipse.lsp4j.SignatureHelp;
|
||||
import org.eclipse.lsp4j.SignatureHelpParams;
|
||||
import org.eclipse.lsp4j.SignatureInformation;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.xtend2.lib.StringConcatenation;
|
||||
import org.eclipse.xtext.EcoreUtil2;
|
||||
import org.eclipse.xtext.ide.server.Document;
|
||||
|
@ -100,13 +100,8 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
private TestLanguagePackage _testLanguagePackage = TestLanguagePackage.eINSTANCE;
|
||||
|
||||
@Override
|
||||
public SignatureHelp getSignatureHelp(final Document document, final XtextResource resource, final TextDocumentPositionParams params, final CancelIndicator cancelIndicator) {
|
||||
public SignatureHelp getSignatureHelp(final Document document, final XtextResource resource, final SignatureHelpParams params, final CancelIndicator cancelIndicator) {
|
||||
final int offset = document.getOffSet(params.getPosition());
|
||||
return this.getSignatureHelp(resource, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignatureHelp getSignatureHelp(final XtextResource resource, final int offset) {
|
||||
Preconditions.<XtextResource>checkNotNull(resource, "resource");
|
||||
Preconditions.checkArgument((offset >= 0), ("offset >= 0. Was: " + Integer.valueOf(offset)));
|
||||
final EObject object = this.offsetHelper.resolveContainedElementAt(resource, offset);
|
||||
|
|
|
@ -11,8 +11,8 @@ Require-Bundle: org.eclipse.xtext;visibility:=reexport,
|
|||
org.eclipse.xtend.lib,
|
||||
org.eclipse.core.runtime;bundle-version="3.13.0";resolution:=optional;x-installation:=greedy,
|
||||
org.eclipse.equinox.common;bundle-version="3.9.0",
|
||||
org.eclipse.lsp4j;bundle-version="[0.8.1,0.9.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.8.1,0.9.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j;bundle-version="[0.9.0,0.10.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.9.0,0.10.0)";resolution:=optional,
|
||||
org.eclipse.emf.ecore.change;bundle-version="[2.14.0,3)"
|
||||
Import-Package: org.apache.log4j;version="1.2.15"
|
||||
Export-Package: org.eclipse.xtext.ide;x-friends:="org.eclipse.xtend.ide,
|
||||
|
|
|
@ -72,6 +72,7 @@ import org.eclipse.lsp4j.SemanticHighlightingServerCapabilities;
|
|||
import org.eclipse.lsp4j.ServerCapabilities;
|
||||
import org.eclipse.lsp4j.SignatureHelp;
|
||||
import org.eclipse.lsp4j.SignatureHelpOptions;
|
||||
import org.eclipse.lsp4j.SignatureHelpParams;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
|
@ -697,7 +698,7 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<SignatureHelp> signatureHelp(TextDocumentPositionParams params) {
|
||||
public CompletableFuture<SignatureHelp> signatureHelp(SignatureHelpParams params) {
|
||||
return requestManager.runRead((cancelIndicator) -> signatureHelp(params, cancelIndicator));
|
||||
}
|
||||
|
||||
|
@ -705,14 +706,14 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
* Compute the signature help. Executed in a read request.
|
||||
* @since 2.20
|
||||
*/
|
||||
protected SignatureHelp signatureHelp(TextDocumentPositionParams params, CancelIndicator cancelIndicator) {
|
||||
protected SignatureHelp signatureHelp(SignatureHelpParams params, CancelIndicator cancelIndicator) {
|
||||
URI uri = getURI(params);
|
||||
ISignatureHelpService helper = getService(uri, ISignatureHelpService.class);
|
||||
if (helper == null) {
|
||||
return ISignatureHelpService.EMPTY;
|
||||
}
|
||||
return workspaceManager.doRead(uri,
|
||||
(doc, resource) -> helper.getSignatureHelp(doc, resource, params, cancelIndicator));
|
||||
(doc, resource) -> helper.getSignatureHelp(doc, resource, (TextDocumentPositionParams) params, cancelIndicator));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2017 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) 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
|
||||
|
@ -10,6 +10,7 @@ package org.eclipse.xtext.ide.server.signatureHelp;
|
|||
import static java.util.Collections.*;
|
||||
|
||||
import org.eclipse.lsp4j.SignatureHelp;
|
||||
import org.eclipse.lsp4j.SignatureHelpParams;
|
||||
import org.eclipse.lsp4j.TextDocumentPositionParams;
|
||||
import org.eclipse.xtext.ide.server.Document;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
|
@ -32,7 +33,18 @@ public interface ISignatureHelpService {
|
|||
*/
|
||||
SignatureHelp EMPTY = new SignatureHelp(emptyList(), null, null);
|
||||
|
||||
SignatureHelp getSignatureHelp(Document document, XtextResource resource, TextDocumentPositionParams params, CancelIndicator cancelIndicator);
|
||||
/**
|
||||
* @deprecated please override/call {@link #getSignatureHelp(Document, XtextResource, SignatureHelpParams, CancelIndicator)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
default SignatureHelp getSignatureHelp(Document document, XtextResource resource, TextDocumentPositionParams params, CancelIndicator cancelIndicator) {
|
||||
if (params instanceof SignatureHelpParams) {
|
||||
return getSignatureHelp(document, resource, (SignatureHelpParams) params, cancelIndicator);
|
||||
}
|
||||
throw new IllegalArgumentException("params is not a SignatureHelpParams");
|
||||
}
|
||||
|
||||
SignatureHelp getSignatureHelp(Document document, XtextResource resource, SignatureHelpParams params, CancelIndicator cancelIndicator);
|
||||
|
||||
/**
|
||||
* Returns with a {@link SignatureHelp signature help} instance for a
|
||||
|
@ -47,7 +59,9 @@ public interface ISignatureHelpService {
|
|||
* @return a signature help instance.
|
||||
*/
|
||||
@Deprecated
|
||||
SignatureHelp getSignatureHelp(final XtextResource resource, final int offset);
|
||||
default SignatureHelp getSignatureHelp(final XtextResource resource, final int offset) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOOP {@link ISignatureHelpService signature help service} implementation.
|
||||
|
@ -56,14 +70,9 @@ public interface ISignatureHelpService {
|
|||
*/
|
||||
@Singleton
|
||||
public static class Noop implements ISignatureHelpService {
|
||||
|
||||
@Override
|
||||
public SignatureHelp getSignatureHelp(final XtextResource resource, final int offset) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignatureHelp getSignatureHelp(Document document, XtextResource resource, TextDocumentPositionParams params, CancelIndicator cancelIndicator) {
|
||||
public SignatureHelp getSignatureHelp(Document document, XtextResource resource, SignatureHelpParams params, CancelIndicator cancelIndicator) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) 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
|
||||
|
@ -84,6 +84,7 @@ import org.junit.jupiter.api.BeforeEach
|
|||
|
||||
import static extension org.eclipse.lsp4j.util.Ranges.containsRange
|
||||
import static extension org.eclipse.xtext.util.Strings.*
|
||||
import org.eclipse.lsp4j.SignatureHelpParams
|
||||
|
||||
/**
|
||||
* @author Sven Efftinge - Initial contribution and API
|
||||
|
@ -549,7 +550,7 @@ abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
|
||||
val fileUri = initializeContext(configuration).uri
|
||||
|
||||
val signatureHelpFuture = languageServer.signatureHelp(new TextDocumentPositionParams => [
|
||||
val signatureHelpFuture = languageServer.signatureHelp(new SignatureHelpParams => [
|
||||
textDocument = new TextDocumentIdentifier(fileUri)
|
||||
position = new Position(line, column)
|
||||
]);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2016, 2019 TypeFox GmbH (http://www.typefox.io) and others.
|
||||
* Copyright (c) 2016, 2020 TypeFox GmbH (http://www.typefox.io) 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
|
||||
|
@ -64,6 +64,7 @@ import org.eclipse.lsp4j.ReferenceParams;
|
|||
import org.eclipse.lsp4j.SemanticHighlightingInformation;
|
||||
import org.eclipse.lsp4j.SemanticHighlightingParams;
|
||||
import org.eclipse.lsp4j.SignatureHelp;
|
||||
import org.eclipse.lsp4j.SignatureHelpParams;
|
||||
import org.eclipse.lsp4j.SignatureInformation;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
|
||||
|
@ -1149,8 +1150,8 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
configuration.setFilePath(("MyModel." + this.fileExtension));
|
||||
configurator.apply(configuration);
|
||||
final String fileUri = this.initializeContext(configuration).getUri();
|
||||
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
|
||||
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
|
||||
SignatureHelpParams _signatureHelpParams = new SignatureHelpParams();
|
||||
final Procedure1<SignatureHelpParams> _function = (SignatureHelpParams it) -> {
|
||||
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
|
||||
it.setTextDocument(_textDocumentIdentifier);
|
||||
int _line = configuration.getLine();
|
||||
|
@ -1158,7 +1159,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
Position _position = new Position(_line, _column);
|
||||
it.setPosition(_position);
|
||||
};
|
||||
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
|
||||
SignatureHelpParams _doubleArrow = ObjectExtensions.<SignatureHelpParams>operator_doubleArrow(_signatureHelpParams, _function);
|
||||
final CompletableFuture<SignatureHelp> signatureHelpFuture = this.languageServer.signatureHelp(_doubleArrow);
|
||||
final SignatureHelp signatureHelp = signatureHelpFuture.get();
|
||||
Procedure1<? super SignatureHelp> _assertSignatureHelp = configuration.getAssertSignatureHelp();
|
||||
|
|
Loading…
Reference in a new issue