Closed eychun closed 2 months ago
Hi @eychun ,
Thanks for opening an issue.
The function xref-find-definitions
uses only one of the available backends, which in your case seem to be the verilog-ext
backend (since you have xref included in verilog-ext-feature-list
) and eglot
backend (through LSP server svls
).
It seems to me that for some reason the verilog-ext
xref backend is not active. Can you check the value of the variable xref-backend-functions
? Its first element should be verilog-ext-xref-backend
. Besides, can you also check if tags have been collected properly on the files in directory ~/.emacs.d/verilog-ext
?
On the other hand, the svls
language server only supports diagnostics but not finding definitions, so that is the reason why you are getting the error:
eglot--error: [eglot] Unsupported or ignored LSP capability `:definitionProvider'
Hi @gmlarumbe,
Thank you for your reply to my post. Here is the value of the variable xref-backend-functions
:
xref-backend-functions is a variable defined in ‘xref.el’.
Its value is (eglot-xref-backend verilog-ext-xref-backend etags--xref-backend) Local in buffer blah.sv; global value is (etags--xref-backend)
I checked if tags have been collected properly. Here is what I see in ~/.emacs.d/verilog-ext/defs-file-tables
:
Here is what my Emacs window looks like:
By the way, I have a question about something you said:
the svls language server only supports diagnostics but not finding definitions
How did you find this information? I couldn't find it in the https://github.com/dalance/svls/blob/master/README.md. Does verilog-ext work with svls? Should I try verilog-ext without svls?
Seems that eglot
is being enabled after verilog-ext
when visiting the blah.sv
buffer. This results in eglot-xref-backend
taking precedence over verilog-ext-xref-backend
as it is the first element of the xref-backend-functions
list.
I believe the simplest solution could be setting up eglot to not use xref
. The following might work:
(setq eglot-stay-out-of '(xref))
How did you find this information? I couldn't find it in the https://github.com/dalance/svls/blob/master/README.md. Does verilog-ext work with svls? Should I try verilog-ext without svls?
The README Feature section only mentions the linter based on svlint. verilog-ext
works with svls
but it cannot navigate definitions/references because svls
itself does not support it.
Thank you. I'm able to jump to definitions now.
After setting up eglot to not use xref, here is the value of xref-backend-functions
:
Its value is (verilog-ext-xref-backend etags--xref-backend) Local in buffer blah.sv; global value is (etags--xref-backend)
I'm a little confused by all the pieces necessary for using LSP. I think svls is a language server. Is verilog-ext also a language server? svls works with eglot. Does verilog-ext also work with Eglot or does it work by itself?
Hi @eychun ,
verilog-ext
is an Emacs package that extends the functionality of verilog-mode
and verilog-ts-mode
to edit SystemVerilog code and provides similar features as LSP does (e.g. find definition).
On the other hand for LSP you need a server (e.g. svls
) and a client (e.g. Emacs eglot
package). You could configure eglot
to connect to svls
without the need of verilog-ext
. verilog-ext
simply provides some basic code to simplify the process for all the current known LSP servers and clients for Verilog.
You can check the wiki entry for more info: https://github.com/gmlarumbe/verilog-ext/wiki/Language-Server-Protocol
I can't seem to use
M-x xref-find-definitions
to find the definition of reg "a" in the following code with Point at "a" on the 4th line:I get the following error message in Emacs:
I've done
M-x verilog-ext-tags-get RET
to get tags from the code. I'm using Emacs 29.1.Here are relevant lines from my .emacs file:
Here is what I have in my .svls.toml file:
Am I missing any steps?