Giter Site home page Giter Site logo

eclipse-lsp4j / lsp4j Goto Github PK

View Code? Open in Web Editor NEW
581.0 28.0 141.0 3.6 MB

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.

Home Page: https://eclipse.org/lsp4j

License: Other

Xtend 37.56% Java 61.45% HTML 0.51% Shell 0.47%
language-server-protocol eclipse java

lsp4j's Introduction

Eclipse LSP4J

Java binding for the Language Server Protocol and the Debug Adapter Protocol.

How To Use

A brief overview of how to use LSP4J to implement a server or a client can be found here:

Maven Repositories

p2 Update Sites

japicmp reports

  • The p2 Update sites listed above (since 0.13.0) contain a japicmp report against the last released version to make it easier to identify API changes.

Snapshots

The snapshots are deployed during the build to:

Signed JARs

The Maven Repositories, p2 Update Sites, and the Snapshots contain signed jars. If you plan to simply add them to your own jar, you'll need to remove/exclude or update/override these signatures.

Supported LSP Versions

  • LSP4J 0.24.* (Next release) → LSP 3.17.0
  • LSP4J 0.23.* → LSP 3.17.0
  • LSP4J 0.22.* → LSP 3.17.0
  • LSP4J 0.21.* → LSP 3.17.0
  • LSP4J 0.20.* → LSP 3.17.0
  • LSP4J 0.19.* → LSP 3.17.0
  • LSP4J 0.18.* → LSP 3.17.0
  • LSP4J 0.17.* → LSP 3.17.0
  • LSP4J 0.16.* → LSP 3.17.0
  • LSP4J 0.15.* → LSP 3.17.0
  • LSP4J 0.14.* → LSP 3.17.0 (except Notebook support and WorkspaceSymbol.data)
  • LSP4J 0.13.* → LSP 3.17.0 (except Notebook support and some changes to the LSP 3.17 specification that were added after specification was published as done)
  • LSP4J 0.12.* → LSP 3.16.0
  • LSP4J 0.11.* → LSP 3.16.0
  • LSP4J 0.10.* → LSP 3.16.0 (specification is not finalized yet)
  • LSP4J 0.9.* → LSP 3.15.0 (except Progress)
  • LSP4J 0.7.*, 0.8.* → LSP 3.14.0
  • LSP4J 0.6.* → LSP 3.13.0
  • LSP4J 0.5.* → LSP 3.10.0
  • LSP4J 0.4.* → LSP 3.7.0
  • LSP4J 0.2.*, 0.3.* → LSP 3.0
  • LSP4J 0.1.* → LSP 2.1

Supported DAP Versions

  • LSP4J 0.24.* (Next release) → DAP 1.65.0
  • LSP4J 0.23.* → DAP 1.65.0
  • LSP4J 0.22.* → DAP 1.60.0
  • LSP4J 0.21.* → DAP 1.60.0
  • LSP4J 0.20.* → DAP 1.58.0
  • LSP4J 0.19.* → DAP 1.58.0
  • LSP4J 0.18.* → DAP 1.58.0
  • LSP4J 0.17.* → DAP 1.58.0
  • LSP4J 0.16.* → DAP 1.58.0
  • LSP4J 0.15.* → DAP 1.56.0
  • LSP4J 0.14.* → DAP 1.55.0
  • LSP4J 0.13.* → DAP 1.55.0
  • LSP4J 0.12.* → DAP 1.44.0
  • LSP4J 0.11.* → DAP 1.44.0
  • LSP4J 0.10.* → DAP 1.42.0
  • LSP4J 0.9.* → DAP 1.37.0 (except CancelRequest)
  • LSP4J 0.8.* → DAP 1.35.0
  • LSP4J 0.5.* – 0.7.* → DAP 1.31.0
  • LSP4J 0.4.* → DAP 1.25.0
  • LSP4J before 0.4.0 did not support DAP

Building and Contributing

To build and contribute to LSP4J please consult the Contribution Guide.

Licenses

LSP4J is published under two licenses:

SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause

lsp4j's People

Contributors

akaroml avatar akosyakov avatar apupier avatar cdietrich avatar cherylking avatar dhuebner avatar drungrin avatar dufgui avatar ericdallo avatar fredg1 avatar ivy-lli avatar jankoehnlein avatar jonahgraham avatar kaloyan-raev avatar kamasamak avatar kittaakos avatar matthewmichihara avatar mbooth101 avatar mickaelistria avatar mschaefer88 avatar mzarnowski avatar pisv avatar pyvesb avatar sebthom avatar soarex16 avatar spoenemann avatar svenefftinge avatar testforstephen avatar tivervac avatar yaohaizh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lsp4j's Issues

Wrapped CancelationException not properly handled (treated as error instead of Cancelation)

We ran into some issues with vscode logging canceled operations as having completed with an error. We find these errors in vscode 'extensions' output window:

[Error - 10:05:21] Request textDocument/completion failed.
Message: java.util.concurrent.CancellationException
Code: -32603 

After debugging this for a while we think (not 100% sure, but pretty close) that this is a bug in lsp4j not properly recognizing a CancelationException when its wrapped in a CompletionException. Here:

https://github.com/eclipse/lsp4j/blob/master/org.eclipse.lsp4j.jsonrpc/src/main/java/org/eclipse/lsp4j/jsonrpc/RemoteEndpoint.java#L218

	}).exceptionally((Throwable t) -> {
			if (!(t instanceof CancellationException)) { //<=== !!!! WRONG !!!!!
				ResponseError errorObject = exceptionHandler.apply(t);
				if (errorObject != null) {
					responseMessage.setError(errorObject);
					out.consume(responseMessage);
				}
			}
       return null;

While debugging we noticed that at the marked line, a CancelationException wrapped inside a CompletionException is being received. But since it is not a instance of CancelationException it is not handled as a cancelation.

Since the JRE docs explicitly state that cancelations can be signaled by Cancelation exceptions wrapped in this way, we beleave that its a bug in lsp4j not to recognize the wrapped cancelation exception.

See: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html#cancel-boolean-

It states that:

... Dependent CompletableFutures that have not already completed will also complete exceptionally, with a CompletionException caused by this CancellationException ...

How does the LSP implements the Syntax Highlight?

How does the LSP implements the Syntax Highlight? where are the Highlight rules defined? say you want to define : BEGIN as a keyword and you want the keywords to be RED.

Is there any document explaining how to create a LSP implementation for a new language?

Why LanguageClient/LanguageServer do not have all the LSP methods?

Just curious about how LSPLauncher actually works.

Assume in a scenario I want to do something like what has described in:
https://github.com/eclipse/lsp4j/blob/master/org.eclipse.lsp4j/src/test/java/org/eclipse/lsp4j/launcher/LauncherTest.java

I want to create a client and some server so they can talk to each other. I have to invoke LSPLauncher.createClientLauncher to create a client launcher to talk to the language server, and I have to supply the first argument with an implementation of a LanguageClient interface.

But the LanguageClient and LanguageServer interface seem to be incomplete, and it seems that I am limited to those few listed messages if I am not adding new methods to those interfaces.

Am I missing something or I am completely wrong with how LSPLauncher should work?

No 'documentLinkProvider' field in ServerCapabilities

Its still not described in language protocol: microsoft/language-server-protocol#135
But its already used e.g. with HTML language server. Example initialization result:

{
    "capabilities": {
        "textDocumentSync": 1,
        "completionProvider": {
            "resolveProvider": false,
            "triggerCharacters": [
                ".",
                ":",
                "<",
                "\"",
                "=",
                "/"
            ]
        },
        "hoverProvider": true,
        "documentHighlightProvider": true,
        "documentRangeFormattingProvider": true,
        "documentLinkProvider": true
    }
}

Socket Server -> Client Deadlock

I try to connect a Socket based LS (Xtext) to VSCode.
This basically works but if i

  • insert a blank
  • call content assist

then there seems to be a lock here

Channels.writeFully(WritableByteChannel, ByteBuffer) line: 93	
Channels.access$000(WritableByteChannel, ByteBuffer) line: 61	
Channels$1.write(byte[], int, int) line: 174	
Channels$1(OutputStream).write(byte[]) line: 75	
StreamMessageConsumer.consume(Message) line: 63	
RemoteEndpoint.lambda$handleRequest$2(ResponseMessage, Object) line: 216	
2078849752.accept(Object) line: not available	
CompletableFuture<T>.uniAccept(CompletableFuture<S>, Consumer<? super S>, UniAccept<S>) line: 656	
CompletableFuture<T>.uniAcceptStage(Executor, Consumer<? super T>) line: 669	
CompletableFuture<T>.thenAccept(Consumer<? super T>) line: 1997	
RemoteEndpoint.handleRequest(RequestMessage) line: 214	
RemoteEndpoint.consume(Message) line: 138	
StreamMessageProducer.handleMessage(InputStream, StreamMessageProducer$Headers) line: 149	
StreamMessageProducer.listen(MessageConsumer) line: 77	
ConcurrentMessageProcessor.run() line: 68	
Executors$RunnableAdapter<T>.call() line: 511	
FutureTask<V>.run() line: 266	
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1142	
ThreadPoolExecutor$Worker.run() line: 617	
Thread.run() line: 745	

any idea how this could be called?

here is my laucher/main

public class RunServer {

	public static void main(String[] args) throws InterruptedException, IOException {
		Injector injector = Guice.createInjector(new ServerModule());
		LanguageServerImpl languageServer = injector.getInstance(LanguageServerImpl2.class);
		Function<MessageConsumer, MessageConsumer> wrapper = consumer -> {
			MessageConsumer result = consumer;
			return result;
		};
		Launcher<LanguageClient> launcher = createSocketLauncher(languageServer, LanguageClient.class, new InetSocketAddress("localhost", 5007), Executors.newCachedThreadPool(), wrapper);
		languageServer.connect(launcher.getRemoteProxy());
		Future<?> future = launcher.startListening();
		while (!future.isDone()) {
			Thread.sleep(10_000L);
		}
	}
	
	static <T> Launcher<T> createSocketLauncher(Object localService, Class<T> remoteInterface, SocketAddress socketAddress, ExecutorService executorService, Function<MessageConsumer, MessageConsumer> wrapper) throws IOException {
		ServerSocketChannel serverSocket = ServerSocketChannel.open();
		
		serverSocket.bind(socketAddress);
		SocketChannel socketChannel = serverSocket.accept();
	
		return Launcher.createIoLauncher(localService, remoteInterface, Channels.newInputStream(socketChannel), Channels.newOutputStream(socketChannel), executorService, wrapper);
	}
}

Reflection in ServiceEndpoints.toServiceObject doesn't work in OSGi.

Some classloading usage doesn't work in OSGi world and prevents from using LSP4J in Eclipse plugins:

java.lang.IllegalArgumentException: interface org.eclipse.lsp4j.services.TextDocumentService is not visible from class loader
	at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:581)
	at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:557)
	at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)
	at java.lang.reflect.WeakCache.get(WeakCache.java:127)
	at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:419)
	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:719)
	at org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints.toServiceObject(ServiceEndpoints.java:32)
	at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.lambda$new$1(EndpointProxy.java:44)
	at org.eclipse.lsp4j.jsonrpc.services.AnnotationUtil.findDelegateSegments(AnnotationUtil.java:29)
	at org.eclipse.lsp4j.jsonrpc.services.EndpointProxy.<init>(EndpointProxy.java:43)
	at org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints.toServiceObject(ServiceEndpoints.java:32)
	at org.eclipse.lsp4j.jsonrpc.Launcher.createIoLauncher(Launcher.java:124)
	at org.eclipse.lsp4j.jsonrpc.Launcher.createLauncher(Launcher.java:72)
	at org.eclipse.lsp4j.jsonrpc.Launcher.createLauncher(Launcher.java:45)
	at org.eclipse.lsp4j.launch.LSPLauncher.createClientLauncher(LSPLauncher.java:29)

DidOpenTextDocumentParams extends TextDocumentIdentifier

I have the problem of Xtext Language Servers do not work well with VSCode.

i could nail that down to a validation error for messages vs objects

DidOpenTextDocumentParams [
  textDocument = TextDocumentItem [
    uri = "file:///Users/dietrich/git/xtext-languageserver-example/demo/a.mydsl"
    languageId = "mydsl"
    version = 1
    text = "Hello Xtext!\nHello VSCode from Xtext!\nHello ThisFile from Other!\nHello you!"
  ]
  text = null
  uri = null
]
{
  "jsonrpc": "2.0",
  "method": "textDocument/didOpen",
  "params": {
    "textDocument": {
      "uri": "file:///Users/dietrich/git/xtext-languageserver-example/demo/a.mydsl",
      "languageId": "mydsl",
      "version": 1,
      "text": "Hello Xtext!\nHello VSCode from Xtext!\nHello ThisFile from Other!\nHello you!"
    }
  }
}

as you can see the message has no uri and text, which results in

[The accessor 'getUri' must return a non-null value.]

i think that comes from

DidOpenTextDocumentParams extends TextDocumentIdentifier

CodeLensOptions is incorrect

CodeLensOptions generates the following JSON.

"codeLensProvider": {
            "ResolveProvider": true
   }

The ResolveProvider should start with lowercase.

ConcurrentModificationException during MessageJsonHandler.toString()

Error is thrown when MessageJsonHandler is trying to display completion result (CompletionList):

Dec 15, 2016 11:01:08 AM org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor run
SEVERE: null
java.util.ConcurrentModificationException
	at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
	at java.util.ArrayList$Itr.next(ArrayList.java:851)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:98)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.CollectionTypeAdapterFactory$Adapter.write(CollectionTypeAdapterFactory.java:1)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:69)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:125)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:243)
	at com.google.gson.Gson.toJson(Gson.java:669)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapterFactory$Adapter.write(MessageTypeAdapterFactory.java:217)
	at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapterFactory$Adapter.write(MessageTypeAdapterFactory.java:1)
	at com.google.gson.Gson.toJson(Gson.java:669)
	at com.google.gson.Gson.toJson(Gson.java:648)
	at com.google.gson.Gson.toJson(Gson.java:603)
	at com.google.gson.Gson.toJson(Gson.java:583)
	at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.toString(MessageJsonHandler.java:93)
	at org.eclipse.lsp4j.jsonrpc.messages.Message.toString(Message.java:29)
	at org.eclipse.lsp4e.ProjectSpecificLanguageServerWrapper.logServerError(ProjectSpecificLanguageServerWrapper.java:267)
	at org.eclipse.lsp4e.ProjectSpecificLanguageServerWrapper.lambda$2(ProjectSpecificLanguageServerWrapper.java:238)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:68)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

I'm using latest master.

Update the lsp4j to match the latest version of the Language Server Protocol

Hi,

In order to use your implementation to provide the lsp communication layer for the jdtls project, we would need the support of the latest version of the protocol. Changes have been made recently especially in the completionItem to be able to return additional text edits and a command.
See protocol.md around line 1015:

/**
 * An optional array of additional text edits that are applied when
 * selecting this completion. Edits must not overlap with the main edit
 * nor with themselves.
 */
additionalTextEdits?: TextEdit[];
/**
 * An optional command that is executed *after* inserting this completion. *Note* that
 * additional modifications to the current document should be described with the
 * additionalTextEdits-property.
 */
command?: Command;

Having the latest changes of the Language Server Protocol is important to us. So in order to be able to consume your deliverables, we need support of the latest LSP changes.

Invalid JSON message sent on shutdown

From the Java extension for VS Code, when closing the current folder, a shutdown request is emitted to the Java Language server.

From the current implementation of shutdown:

	@Override
	public CompletableFuture<Void> shutdown() {
	        ...
		return CompletableFuture.completedFuture(null);
	}

an invalid message is received by the client:

Received message which is neither a response nor a notification message:
{
    "id": "3",
    "jsonrpc": "2.0"
}

Before we moved to lsp4j, shutdown was handled by sending an empty Object.

I think the current behavior of the LSP4J wrt shutdown() is incorrect, it should always return an empty result, from my understanding of https://github.com/Microsoft/language-server-protocol/blob/master/protocol.md#shutdown-request.

Originally reported as eclipse-jdtls/eclipse.jdt.ls#106

NullPointerException in RemoteEndpoint.java:214

I have a WIP language-server (I could put it online if it would help but it might be somewhat difficult to setup), I'm testing it with vscode 1.8.1 and I sometimes end up triggering this:

[error] janv. 11, 2017 4:26:47 PM org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor run
[error] GRAVE: null
[error] java.lang.NullPointerException
[error]         at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:214)
[error]         at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:138)
[error]         at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149)
[error]         at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
[error]         at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:68)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error]         at java.lang.Thread.run(Thread.java:745)
[error] 

Even if I'm doing something wrong here (any idea what that might be?), I assume that the code should handle errors gracefully and not crash.

Retention policy on your update site

JDT-LS project consumes lsp4j. Till now, it was done by using an inner jar. I'd like to move to consume lsp4j from your update site. Right now the update site seems to be flushed every time you have a new build. Could it be possible to get at least a one-week retention so that our builds don't break as soon as you have a new drop available?
How can we get this setup so that we can consume directly from your update site without being broken?

lsp4j 0.2.0 breaks vscode-java/jls

Because the 0.1.0-SNAPSHOT builds are no longer available (relates to discussion on #47) I moved JLS to consume 0.2.0-SNAPSHOT. While JLS builds fine, when vscode-java connects to it, the server fails to initialize with:

java.lang.IllegalArgumentException: Only one of the Either types can be a json object or StringMap

Activating verbose logging from vscode, this is what's exchanged between vscode and the server:

[Trace - 18:08:16] Sending request 'initialize - (0)'.
Params: {
    "processId": 23006,
    "rootPath": "/home/fbricon/Dev/souk/test",
    "capabilities": {},
    "trace": "verbose"
}


[Trace - 18:08:16] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "2017-02-02 18:08:16 >> initialize"
}


[Info  - 18:08:16] 2017-02-02 18:08:16 >> initialize
[Trace - 18:08:16] Received response 'initialize - (0)' in 648ms. Request failed: java.lang.IllegalArgumentException: Only one of the Either types can be a json object or StringMap. (-32603).
[Error - 18:08:16] Server initialization failed.
  Message: java.lang.IllegalArgumentException: Only one of the Either types can be a json object or StringMap.
  Code: -32603 
[Trace - 18:08:16] Sending request 'shutdown - (1)'.
[Trace - 18:08:16] Received notification 'window/logMessage'.
Params: {
    "type": 3,
    "message": "2017-02-02 18:08:16 >> shutdown"
}


[Info  - 18:08:16] 2017-02-02 18:08:16 >> shutdown
[Trace - 18:08:16] Received response 'shutdown - (1)' in 2ms.
Result: {}


[Trace - 18:08:16] Sending notification 'exit'.
No parameters provided.

I am a bit clueless right now.

This is our server implementation: https://github.com/gorkem/java-language-server/blob/master/org.jboss.tools.vscode.java/src/org/jboss/tools/vscode/java/internal/handlers/JDTLanguageServer.java

Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $

I have exception after completion request. Result JSON looks like this:

{
	"result": [
		{
			"label": "methodXXX",
			"kind": 2,
			"detail": "\\B",
			"documentation": null,
			"sortText": null,
			"filterText": null,
			"insertText": null,
			"textEdit": null,
			"additionalTextEdits": null,
			"command": null,
			"data": null
		}
	],
	"id": "29",
	"jsonrpc": "2.0"
}

Stacktrace:

Nov 24, 2016 12:10:21 PM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Could not parse response: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $
org.eclipse.lsp4j.jsonrpc.json.InvalidMessageException: Could not parse response: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $
	at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseResponse(MessageJsonHandler.java:127)
	at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:71)
	at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:60)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:148)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:68)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
	at com.google.gson.Gson.fromJson(Gson.java:887)
	at com.google.gson.Gson.fromJson(Gson.java:952)
	at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.fromJson(MessageJsonHandler.java:102)
	at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseResponse(MessageJsonHandler.java:118)
	... 10 more
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at path $
	at com.google.gson.internal.bind.JsonTreeReader.expect(JsonTreeReader.java:162)
	at com.google.gson.internal.bind.JsonTreeReader.beginObject(JsonTreeReader.java:87)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
	... 14 more

Cancel support does not work

I think this is because the value of constant RemoteEndpoint::CANCEL_METHOD is incorrect it should be $/cancelRequest instead of $/cancel

LSP4J initial 0.1.0 release

As LSP4E targets to get in Oxygen (and to be included in the snapshot builds soon), it would be nice if LSP4E could consume a "release-quality" milestone build that could be included in SimRel

Example to retreve and execute commands (for refactorings, quickfix...)

The codeActions endpoint allow to retrieve commands for a given marker as a resolution/quickfix. I tried to find how the returned commands are supposed to be manipulated with LSP4J but wasn't successful.
Would it be possible to provide an example of how LSP4J interacts with commands?

Missing xtend sources

I see a lot of generated Java files from Xtend files in xtend-gen directories. However, the repository does not contain any *.xtend file. Are they not part of the repository? Is that done by purpose?

Clean way to customize behaviors when receiving/sending messages

In the old ls-api, in order to log customized log messages, I just needed to implement MessageTracer for onError, onRead and onWrite. But in the new Launcher class, everything is pretty tightly coupled.
Is there a clean way I can customize the behaviors when receiving/sending messages?

p2 repo for LSP4J 0.1.0

I didn't manage to find out what the URL of the 0.1.0 release of LSP4J. Is this already available? Is it document somewhere?

Server is not versatile

The server stops to responds if one of the endpoints for a request unexpectedly throws an exception. You can easily see this by throwing a NPE from one of the @JsonRequest annotated functions. When the exception is received it causes the server to exit the listen loop and server no longer responds to requests.

Ideally server should be able to respond to further requests even after one of the requests fails unexpectedly.

CodeLens resolve in TextDocumentService

The method CompletableFuture<CodeLens> resolveCodeLens(CodeLens unresolved) is never get called for the implementors of the TextDocumentService. Unless I am missing something, this is because the JSON RPC method for resolving code lenses is codeLens/resolve and this interface maps it to document/resolveCodeLens.

Documentation on how to create a LanguageClient

Documentation currently shows ... where the LanguageClient should be instantiated. It would be helpful to have details about how to actually get/create an instance as it doesn't seem obvious.
Actually, a whole example or utility method of how to start a language client from the server input/output stream would be great.

equals() implementations are unusable in all models

All LSP4J protocol models have a buggy equals() implementation, calling !super.equals(), like in TextDocumentIdentifier:

public boolean equals(final Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    if (!super.equals(obj))
      return false;
    TextDocumentIdentifier other = (TextDocumentIdentifier) obj;
    if (this.uri == null) {
      if (other.uri != null)
        return false;
    } else if (!this.uri.equals(other.uri))
      return false;
    return true;
}

The following test fails:

assertEquals(new TextDocumentIdentifier("foo"), new TextDocumentIdentifier("foo"));

Can you please fix this equals method generation to remove the call to !super.equals(obj)?

A method to know whether server is still accessible

It would be pretty useful to have a method to know whether a connection with a server is still valid. Previously, asking for the state of the Reader on an endpoint allowed to know whether things were still working (and to detect cases such as server killed externally). Is there a way to get this with the new API? What about a method such as Launcher.checkConnection() to verify the state and be able to handle such issues.

Gradle generates bad poms

Was looking at https://oss.sonatype.org/content/repositories/snapshots/org/eclipse/lsp4j/org.eclipse.lsp4j.jsonrpc/0.1.0-SNAPSHOT/org.eclipse.lsp4j.jsonrpc-0.1.0-20161129.034433-23.pom hoping to find the url for the CI server (it's not there) and noticed the generated pom contains incorrect values for:

  • organization: Gradle injects the model from https://maven.apache.org/pom.html#Organization, but Maven expects a String here (consistency FTW). So it's more of a gradle issue.
  • scm connections. Should reference github.com/eclipse/lsp4j
<developers>
<developer>
<name>Sven Efftinge</name>
<email>[email protected]</email>
<organization>org.apache.maven.model.Organization@76ac68b0</organization>
<organizationUrl>http://typefox.io</organizationUrl>
</developer>
<developer>
<name>Dennis Hübner</name>
<email>[email protected]</email>
<organization>org.apache.maven.model.Organization@63917fe1</organization>
<organizationUrl>http://typefox.io</organizationUrl>
</developer>
<developer>
<name>Anton Kosyakov</name>
<email>[email protected]</email>
<organization>org.apache.maven.model.Organization@677349fb</organization>
<organizationUrl>http://typefox.io</organizationUrl>
</developer>
<developer>
<name>Miro Spönemann</name>
<email>[email protected]</email>
<organization>org.apache.maven.model.Organization@2c60ce47</organization>
<organizationUrl>http://typefox.io</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:[email protected]:TypeFox/ls-api.git</connection>
<developerConnection>scm:git:[email protected]:TypeFox/ls-api.git</developerConnection>
<url>[email protected]:TypeFox/ls-api.git</url>
</scm>

ClassCastException in org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(NotificationMessage)

i am getting this ClassCastException in org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(NotificationMessage)

Nov 21, 2016 2:51:34 PM org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor run
SCHWERWIEGEND: java.lang.Double cannot be cast to java.lang.String
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:154)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:124)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:149)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:77)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:68)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.