p4lang / p4analyzer

A Language Server Protocol (LSP) compliant analyzer for the P4 language
Apache License 2.0
19 stars 3 forks source link

Instructions for running, using, and debugging p4analyzer #29

Closed vgurevich closed 1 year ago

vgurevich commented 1 year ago

I was able to build p4analyzer successfully, according to the instructions, but running it seems to be a whole other matter -- so far I haven't been able to do that. Neither it is clear how to debug any issues should they arise.

I think it would be wonderful if those instructions could be provided.

So far, I tried to install p4analyzer-vscode using the generated p4-analyzer-vscode-0.0.0.vsix file. It does install (although it looks to me that I had to restart VSCode to see that), but then no matter what I tried to do, I could only see the following messages in the output log:

[Error - 1:09:43 AM] Request textDocument/declaration failed.
  Message: Internal server error.
  Code: -32603 
[Error - 1:10:41 AM] Request textDocument/definition failed.
  Message: Internal server error.
  Code: -32603 

I also tried to run p4analyzer standalone and access it using Emacs's eglot package. Eglot asks me to provide the path to the executable and starts it, but prints this message:

[eglot] Connected! Server `P4 Analyzer' now managing `nil' buffers in project `p4src'.

After that, attempts to use the commands (e.g. eglot-find-definition) return the same error code:

jsonrpc-error: jsonrpc-error: "No current JSON-RPC connection", (jsonrpc-error-code . 32603), (jsonrpc-error-message . "No current JSON-RPC connection")

Attached is also the event log from eglot eglot_events.txt -- I could not find the same from VSCode.

Last, but not least, you might want to add templates for other types of issues :)

AndrewF001 commented 1 year ago

Currently, VSCode is our platform of focus, but the LSP can be integrated into any supported program. When the time is right, we will add the project to VSCode extension marketplace to remove install requirements. Unfortunately, in the mean time you can manually install the .vsix (like you've done) or run the VScode debug script in .vscode\launch.json, name Debug VSCode Extension.

We do have plans on adding instruction for other editors in issue #28 and I believe someone is working on it!

Regarding the messages you received in VSCode and eglot, I believe you've found a undiscovered bug that has been introduced recently. I'll take a look and bring it up with the team.

The person with high enough GitHub permissions to add new templates is a very busy person, so you might have to wait a bit.

Thanks for your interest and sorry you couldn't get it to run. We apricate supplying us with the eglot_events.txt file, and I'll keep you updated!

AndrewF001 commented 1 year ago

More info on error: VSCode-error.txt

AndrewF001 commented 1 year ago

Just spoke with the team, and the error messages you've presented are due to the features not being implemented yet.

Will close the issue as they aren't bugs and this Issue is a partial duplication of #28.

timjroberts commented 1 year ago

At the moment @vgurevich we are dependent upon some VSCode machinery which is why it's not working as expected with other LSP clients outside of VSCode. We'll be working on these issues very soon.