Skip to main content



      Home
Home » Modeling » TMF (Xtext) » LSP: resolving types(LSP shows "XXX cannot be resolved to a type" for types on the classpath)
LSP: resolving types [message #1780255] Fri, 19 January 2018 06:01 Go to next message
Eclipse UserFriend
I just tried to use the Intellij-LSP plugin

It basically works: e.g. shows my keywords in completion, etc.

But it shows "XXX cannot be resolved to a type" for all types that are defined in my project

Some more info:

  • I use xbase for the DSL (so that I can refer to any java types that are on the classpath of my project)
  • the LSP marks those types as error
  • but the xtext-generator works fine and it produces valid java code in my project.

Is this supposed to work at all?
e.g. how can the Language server know about the types on the classpath of my project?
Re: LSP: resolving types [message #1780261 is a reply to message #1780255] Fri, 19 January 2018 06:41 Go to previous messageGo to next message
Eclipse UserFriend
- did you care about https://github.com/eclipse/xtext-extras/issues/144
- how did you setup the classpath for the project? see https://github.com/eclipse/xtext-core/issues/159 and https://github.com/eclipse/xtext-core/issues/589
- xbase produces code even when files have errors (i assume there is currently no guard?)
- what do you mean by "type defined in project" (java types, inferred dsl types, classes on jars)
- can you share a reproducing domain model example and sample project that lets one reprodcue this in no time?

[Updated on: Fri, 19 January 2018 07:29] by Moderator

Re: LSP: resolving types [message #1780275 is a reply to message #1780261] Fri, 19 January 2018 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Here is a simple test-project ex.xtext.lsp

The file MyCustomType is not recognized in the language server editor.

I guess this is just not supported yet: see xtext-core issue #159 "[LanguageServer] Provide basic (java) project concept"
Re: LSP: resolving types [message #1780283 is a reply to message #1780275] Fri, 19 January 2018 10:34 Go to previous messageGo to next message
Eclipse UserFriend
so you refer to java files, not class files. you must make sure java source language is registered

https://github.com/cdietrich/xbase-languageserver-example/blob/master/org.xtext.example.mydsl/src/META-INF/services/org.eclipse.xtext.ISetup

(possibly in the client too https://github.com/cdietrich/xbase-languageserver-example/blob/master/vscode-extension/src/extension.ts
Re: LSP: resolving types [message #1780337 is a reply to message #1780283] Sat, 20 January 2018 09:38 Go to previous messageGo to next message
Eclipse UserFriend
I've added the META-INF to my project. But now the intellij-lsp plugin shows an error-indicator (red dot in the IntelliJ status bar). In the idea log I see this errormessage:
WARN - pper.LanguageServerWrapperImpl - Capabilities are null for


Quote:
(possibly in the client too

It doesn't seem that the intellij-lsp plugin has any options except for the language server.
Re: LSP: resolving types [message #1780338 is a reply to message #1780337] Sat, 20 January 2018 10:46 Go to previous messageGo to next message
Eclipse UserFriend
Where did you add it? The file is Generateds in ide so i put it to mydsl so there are finally two

don't know. I tested with vscode only sorry
Did you. Test your stuff with other clients?
You have to debug the client and or server to see what happens.

Maybe you need to create a better language server handling for for the Java language as there is currently there

( create an ide setup )

[Updated on: Sat, 20 January 2018 10:52] by Moderator

Re: LSP: resolving types [message #1780340 is a reply to message #1780338] Sat, 20 January 2018 11:58 Go to previous messageGo to next message
Eclipse UserFriend
i just saw you did not do the other stuff i did with customservermodule, XbaseProjectManage (at leasr create an empty urlclassloader there - you ususally would have to read and extract the deps from the gradle file - that is what the missing project support bug is about), XbaseJavaIoFileSystemScanner
Re: LSP: resolving types [message #1780357 is a reply to message #1780340] Sun, 21 January 2018 05:12 Go to previous messageGo to next message
Eclipse UserFriend
I've tried to use your example and the
mydsl-standalone.bat
also causes problems:
2018-01-21 11:07:55,542 [  21794]   INFO - rocessStreamConnectionProvider - Server process started java.lang.ProcessImpl@29557783 
2018-01-21 11:07:57,923 [  24175]   WARN - pper.LanguageServerWrapperImpl - org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. 
java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915)
	at com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapperImpl.getServerCapabilities(LanguageServerWrapperImpl.scala:105)
	at com.github.gtache.lsp.client.languageserver.wrapper.LanguageServerWrapperImpl.connect(LanguageServerWrapperImpl.scala:165)
	at com.github.gtache.lsp.PluginMain$.$anonfun$editorOpened$4(PluginMain.scala:127)
	at com.github.gtache.lsp.PluginMain$.$anonfun$editorOpened$4$adapted(PluginMain.scala:109)
	at scala.Option.foreach(Option.scala:257)
	at com.github.gtache.lsp.PluginMain$.$anonfun$editorOpened$3(PluginMain.scala:109)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:315)
	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: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.lambda$request$1(RemoteEndpoint.java:121)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:162)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:149)
	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:84)
	... 5 more
2018-01-21 11:07:57,926 [  24178]   WARN - pper.LanguageServerWrapperImpl - Capabilities are null for exe : path 


maybe it is a problem of the intellij plugin..

anyway. thanks for your efforts.
Re: LSP: resolving types [message #1780358 is a reply to message #1780357] Sun, 21 January 2018 06:28 Go to previous messageGo to next message
Eclipse UserFriend
the question is what happens on server side. i need to see if there are exceptions
Re: LSP: resolving types [message #1780359 is a reply to message #1780358] Sun, 21 January 2018 06:30 Go to previous messageGo to next message
Eclipse UserFriend
maybe you can do a socket based connection and start the server manually with runserver.java. this makes it easy to see what happens on server side
Re: LSP: resolving types [message #1780360 is a reply to message #1780359] Sun, 21 January 2018 06:32 Go to previous messageGo to next message
Eclipse UserFriend
pps: my example uses the custom server module in runserver only so it wont work in standalone mode unless you change it ....
Re: LSP: resolving types [message #1780361 is a reply to message #1780360] Sun, 21 January 2018 06:56 Go to previous messageGo to next message
Eclipse UserFriend
i have updated my example
Re: LSP: resolving types [message #1783233 is a reply to message #1780255] Fri, 09 March 2018 08:02 Go to previous messageGo to next message
Eclipse UserFriend
Our DSL works in VSCode, but with IntelliJ I got also the "Internal Server Error" exception. I modified our dsl, to see the stack trace.
Maybe this helps:
SCHWERWIEGEND: Internal error: java.lang.IndexOutOfBoundsException: Position [
  line = 19
  character = 2
] text was : package java.lang {
    datatype String
}

package test {
  import java.lang.String
  dto abcv212 {
    user: String
    test: String
  }

  dto aaa {
    aaaa: String
    user: String
    test: String
  }

}
java.util.concurrent.CompletionException: java.lang.IndexOutOfBoundsException: Position [
  line = 19
  character = 2
] text was : package java.lang {
    datatype String
}

package test {
  import java.lang.String
  dto abcv212 {
    user: String
    test: String
  }

  dto aaa {
    aaaa: String
    user: String
    test: String
  }

}
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
	at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:647)
	at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:632)
	at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
	at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
	at org.eclipse.xtext.ide.server.concurrent.RequestManager.lambda$null$0(RequestManager.java:84)
	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: java.lang.IndexOutOfBoundsException: Position [
  line = 19
  character = 2
] text was : package java.lang {
    datatype String
}

package test {
  import java.lang.String
  dto abcv212 {
    user: String
    test: String
  }

  dto aaa {
    aaaa: String
    user: String
    test: String
  }

}
	at org.eclipse.xtext.ide.server.Document.getOffSet(Document.java:53)
	at org.eclipse.xtext.ide.server.contentassist.ContentAssistService.createCompletionList(ContentAssistService.java:69)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$completion$29(LanguageServerImpl.java:540)
	at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:284)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.completion(LanguageServerImpl.java:542)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$completion$28(LanguageServerImpl.java:521)
	at org.eclipse.xtext.ide.server.concurrent.RequestManager.lambda$null$0(RequestManager.java:78)
	... 4 more


Interesting is, that the code generation is working. Only the syntax support is not working.
Re: LSP: resolving types [message #1783237 is a reply to message #1783233] Fri, 09 March 2018 08:24 Go to previous message
Eclipse UserFriend
did you have a look at the offsets intellij sends? maybe there is somewhere a miscalculation (and or possibly a windows thingy)
thus it would be interesting what linenumber and offset is requested by idea and what the actual document has.

in your example i dont see anything that could be line 19 (zero based) character 2 (zero based)
=> you should have a look how the idea integration calculates these two
Previous Topic:Create dynamically primitive types that are defined in a types ecore model
Next Topic:StackOverflowError when calling super in override dispatch method
Goto Forum:
  


Current Time: Wed Jul 23 21:20:51 EDT 2025

Powered by FUDForum. Page generated in 0.05829 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top