tokoro10g / matlab-langserver

Language Server using MATLAB Engine
13 stars 1 forks source link

Could not find the jar executable #8

Closed karthink closed 4 years ago

karthink commented 4 years ago

I exported MATLABROOT and set references to Matlab's path in build.gradle to the right values and then ran ./gradlew jar:

> Task :compileJava UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE

BUILD SUCCESSFUL in 0s
3 actionable tasks: 3 up-to-date

But I don't see a file with the name lsp-matlab.*.jar anywhere. I'm not familiar with Java. Did it compile? Am I doing something wrong?

tokoro10g commented 4 years ago

The jar file should be generated in build/libs directory. If you cannot find, try to locate it with

find . | grep jar
karthink commented 4 years ago

Found it, thank you. I actually searched for lsp-matlab using fd, but forgot that fd ignores untracked git files by default.

It seems to be running fine:

matlab-langserver> java -Djava.library.path=$MATLABROOT/bin/glnxa64 -cp $MATLABROOT/extern/engines/java/jar/engine.jar:$MATLABROOT/java/jar/jmi.jar:./build/libs/lsp-matlab-0.1.jar org.tokor.lspmatlab.Application
2019-11-27 11:47:58.961 [main] INFO  org.tokor.lspmatlab.Application {} - Starting server
2019-11-27 11:47:59.250 [main] INFO  org.tokor.lspmatlab.MATLABEngineSingleton {} - Could not find existing sessions. Starting MATLAB Engine...

and I connected to it from emacs lsp-mode by putting the above java command in a shell script and registering the script with lsp-mode. When I edit m files it starts up and connects to the language server just fine, but the server doesn't seem to be doing anything, i.e. not providing any documentation, help or autocompletion.

I understand that setting up the editing environment is out of the scope of this discussion. However, I was wondering if there's some way to check if the server is working as intended, by feeding it some test json data or something else. That way I can narrow the problem down to Emacs.

karthink commented 4 years ago

I generated a log of inputs to the server in emacs. Here is some sample output from *lsp-log*

[Trace - 12:41:59 PM] Sending request 'textDocument/signatureHelp - (14)'.
Params: {
  "textDocument": {
    "uri": "file:///home/user/Documents/freq_resp_with_damping.m"
  },
  "position": {
    "line": 33,
    "character": 16
  }
}

[Trace - 12:41:59 PM] Received response 'textDocument/signatureHelp - (14)' in 10ms.
Result: null

[Trace - 12:42:07 PM] Sending request 'textDocument/signatureHelp - (15)'.
Params: {
  "textDocument": {
    "uri": "file:///home/user/Documents/freq_resp_with_damping.m"
  },
  "position": {
    "line": 60,
    "character": 27
  }
}

[Trace - 12:42:07 PM] Received response 'textDocument/signatureHelp - (15)' in 10ms.
Result: null

Should I take this to mean the server is not functioning as intended?

tokoro10g commented 4 years ago

Thank you for reporting the issue! I suggest you to open a new issue for this specific problem so that everyone can easily find it. When you open the new one, could you paste the entire log messages from matlab-langserver and mention which version of MATLAB you are using?

I've already started figuring out what's going on. I'm not a good Emacs user though. Let's have discussions on the new thread.