Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:01 Go to next message
Martin Trummer is currently offline Martin TrummerFriend
Messages: 15
Registered: December 2017
Junior Member
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 11:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
- 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?


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com

[Updated on: Fri, 19 January 2018 12:29]

Report message to a moderator

Re: LSP: resolving types [message #1780275 is a reply to message #1780261] Fri, 19 January 2018 14:41 Go to previous messageGo to next message
Martin Trummer is currently offline Martin TrummerFriend
Messages: 15
Registered: December 2017
Junior Member
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 15:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
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


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: LSP: resolving types [message #1780337 is a reply to message #1780283] Sat, 20 January 2018 14:38 Go to previous messageGo to next message
Martin Trummer is currently offline Martin TrummerFriend
Messages: 15
Registered: December 2017
Junior Member
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 15:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
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 )


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com

[Updated on: Sat, 20 January 2018 15:52]

Report message to a moderator

Re: LSP: resolving types [message #1780340 is a reply to message #1780338] Sat, 20 January 2018 16:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
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

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: LSP: resolving types [message #1780357 is a reply to message #1780340] Sun, 21 January 2018 10:12 Go to previous messageGo to next message
Martin Trummer is currently offline Martin TrummerFriend
Messages: 15
Registered: December 2017
Junior Member
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 11:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
the question is what happens on server side. i need to see if there are exceptions

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: LSP: resolving types [message #1780359 is a reply to message #1780358] Sun, 21 January 2018 11:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
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

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: LSP: resolving types [message #1780360 is a reply to message #1780359] Sun, 21 January 2018 11:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
pps: my example uses the custom server module in runserver only so it wont work in standalone mode unless you change it ....

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: LSP: resolving types [message #1780361 is a reply to message #1780360] Sun, 21 January 2018 11:56 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11743
Registered: July 2009
Senior Member
i have updated my example

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Previous Topic:Extracts single business aspects into separate grammars
Next Topic:[Solved] Referencing to two separate types
Goto Forum:
  


Current Time: Sun Feb 25 08:09:53 GMT 2018

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

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