jacktasia / dumb-jump

an Emacs "jump to definition" package for 50+ languages
GNU General Public License v3.0
1.58k stars 151 forks source link

Files with ext "v" are treated as coq whereas they can be of verilog language too. #394

Open n171n-sharma opened 3 years ago

n171n-sharma commented 3 years ago

As discussed in the issue, jump to define works if it is invoked from a "sv" file. But it fails when invoked from a verilog file (ext "v"), as it is treated as coq file. Systemverilog is an extension of the verilog language.

DUMB JUMP DEBUG ‘dumb-jump-run-command‘ START
----

cmd:
    rg --color never --no-heading --line-number -U --pcre2 -g \!common -g \!fpga -g \!rptr -g \!sim -g \!sim1 -g \!atpg -g \!bin -g \!cdc -g \!release -g \!synth -g \!scripts -g \!cregs -g \!dbook -g \!lib -g \!xml -g \!cosim -g \!cust \\b\`NAME_RX_SIG_WIDTH\(\$\|\[\^a-zA-Z0-9\\\?\\\*-\]\) /slow/us01/nuts/PHY/us2_ws2

rawresults:

-----
DUMB JUMP DEBUG ‘dumb-jump-run-command‘ END
-----
‘`NAME_RX_SIG_WIDTH’ coq  declaration not found.

240

pierre-rouleau commented 3 years ago

Not sure if that was already discussed, but the emerging V language is unfortunately also using the .v file extension.

n171n-sharma commented 3 years ago

A configuration option can be given to the user to map the file extension to the required language.

pierre-rouleau commented 3 years ago

@n171n-sharma are you referring to ripgrep configuration or dumb-jump?

jacktasia commented 3 years ago

If you want .v to mean verilog and not coq then in your config you should be able to do something like this

(setq dumb-jump-language-file-exts 
      (append 
       (list '(:language "systemverilog" :ext "v" :agtype "verilog" :rgtype "verilog"))
       dumb-jump-language-file-exts))

this will just put it first in the list so it will be found/used first. Other things people might want to do. Remove a language by extension

(setq dumb-jump-language-file-exts 
      (seq-filter (lambda (i) (not (equal (plist-get i :ext) "v"))) dumb-jump-language-file-exts))

combine both (in practice you don't really need this but there could be a use-case):

(setq dumb-jump-language-file-exts 
      (append
       (list '(:language "systemverilog" :ext "v" :agtype "verilog" :rgtype "verilog"))
       (seq-filter (lambda (i) (not (equal (plist-get i :ext) "v"))) dumb-jump-language-file-exts)))
pierre-rouleau commented 3 years ago

Thanks for the explanation!

n171n-sharma commented 3 years ago

Thanks, this does help.