p4lang / p4analyzer

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

p4analyzer crashes on VSCode #36

Open vgurevich opened 1 year ago

vgurevich commented 1 year ago

Describe the bug This is the continuation of the prematurely closed issue #29

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 

To Reproduce You can use any P4 program. I tried several from the most trivial to more realistic. All standard actions like "Jump to the definition", etc. result in the same issue, described above.

Expected behavior Software should not crash

Version p4analyzer: commit 17c2c6d42c9fe7441fae03433238e12a687a45cd

VSCode:

Version: 1.77.3
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:52.732Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Linux x64 5.15.0-1035-aws
Sandboxed: Yes
viluon commented 1 year ago

This is a slight oversight in how we communicate capabilities to the LSP client. AFAIK the server claims it supports everything, which is not the case, and subsequently errors out when receiving an unhandled request or notification.

vgurevich commented 1 year ago

What does the server support and why does it crash on the stuff it does not support?

vgurevich commented 1 year ago

Upgraded VSCode to

Version: 1.78.2
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T14:47:05.613Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 5.15.0-1035-aws
Sandboxed: Yes

but the results are the same

timjroberts commented 1 year ago

Work is currently progressing on lower level capabilities of the parser for example. Consequently, the integrations with LSP are currently basic or even missing. Please don't expect the Analyzer to be useable just yet.