Skip to content
Gonzalo Larumbe edited this page Aug 21, 2023 · 6 revisions

Configuration

First make sure that xref has been included in verilog-ext-feature-list before running verilog-ext-mode-setup.

Next select which backend you want to use for tags collection: builtin or tree-sitter if available.

(setq verilog-ext-tags-backend 'tree-sitter)

Then, it is needed to set workspace variables for file parsing and gather project tags through one of these methods:

  • M-x verilog-ext-workspace-get-tags RET
  • M-x verilog-ext-workspace-get-tags-async RET

A tag database will be created and cached for future sessions.

Finally, run xref-find-definitions or xref-find-references on the tag at point.

Pros/cons

Pros:

  • Easy to setup
  • No need for external applications
  • Supports references (at the time of writing no LSP server supported them)

Cons:

  • Slow for large projects with many files
  • Less accurate than other backends

The builtin xref backend uses internal Emacs lisp parser engine to search for definitions and references and might not be completely accurate. For example, definitions of multiple variables in one line are not supported and therefore will not be found.

These cons can be solved by using tree-sitter backend instead of builtin. Even though it is still under development, it is already much faster and accurate.

If you need something readily available and more reliable consider alternatives from next section.

Alternatives

  • Configuring LSP (see link)
  • Configuring global and ggtags-mode
    • Requires installation of global, ctags (for definitions) and python/pygments (for references).
      # For Ubuntu/Debian systems
      sudo apt-get install global universal-ctags python3-pygments
    • Find complete installation and configuration information here
Clone this wiki locally