Summary
Go to Definition does not navigate from a preprocessor macro usage to the corresponding `define declaration, even when the macro definition file is included and explicitly loaded by vizsla.toml.
This affects common Verilog/SystemVerilog code reading workflows. For example, users cannot jump from `IRQ_IAR in RTL code to the register address definition in an included header file.
Environment
- OS: Windows
- VS Code version: 1.120.0
- Vizsla extension version: 0.1.4
Minimal Reproduction
Create a workspace with these three files:
macro-goto-definition/
vizsla.toml
top.v
defs.vh
vizsla.toml:
#:schema https://pascal-lab.github.io/vizsla/schemas/v1/vizsla.schema.json
top_modules = ["macro_jump_top"]
sources = [
"top.v",
"defs.vh",
]
include_dirs = [
".",
]
defs.vh:
`ifndef MACRO_JUMP_DEFS_VH
`define MACRO_JUMP_DEFS_VH
`define IRQ_IAR 8'h0c
`define IRQ_IAR_ACK_DEFAULT 8'h00
`define IRQ_IAR_ACK_R 7:0
`endif
top.v:
`include "defs.vh"
module macro_jump_top
(
input clk_i,
input rst_i,
input write_en_i,
input [7:0] addr_i,
input [7:0] data_i,
output [7:0] ack_o
);
reg [7:0] ack_q;
assign ack_o = ack_q;
always @(posedge clk_i or posedge rst_i)
begin
if (rst_i)
ack_q <= `IRQ_IAR_ACK_DEFAULT;
else if (write_en_i && addr_i == `IRQ_IAR)
ack_q <= data_i[`IRQ_IAR_ACK_R];
end
endmodule
Reproduction Steps
- Open the
macro-goto-definition/ directory in VS Code.
- Wait until Vizsla is ready.
- Open
top.v.
- Put the cursor on
`IRQ_IAR in this line:
else if (write_en_i && addr_i == `IRQ_IAR)
- Run Go to Definition.
- Repeat the same operation on
`IRQ_IAR_ACK_DEFAULT and `IRQ_IAR_ACK_R.
Expected
Vizsla should navigate to the corresponding macro definitions in defs.vh:
`define IRQ_IAR 8'h0c
`define IRQ_IAR_ACK_DEFAULT 8'h00
`define IRQ_IAR_ACK_R 7:0
Actual
No definition location is returned for these macro usages.
The project configuration appears to be valid:
top.v is listed in sources.
defs.vh is listed in sources.
include_dirs = ["."] allows `include "defs.vh" to resolve.
- Regular HDL symbol navigation works in configured projects.
Related Issues
This is related to macro support, but it appears to cover a different LSP feature from existing open issues:
This issue is specifically about textDocument/definition: navigating from a macro usage such as `IRQ_IAR to its `define IRQ_IAR declaration.
Summary
Go to Definitiondoes not navigate from a preprocessor macro usage to the corresponding`definedeclaration, even when the macro definition file is included and explicitly loaded byvizsla.toml.This affects common Verilog/SystemVerilog code reading workflows. For example, users cannot jump from
`IRQ_IARin RTL code to the register address definition in an included header file.Environment
Minimal Reproduction
Create a workspace with these three files:
vizsla.toml:defs.vh:top.v:Reproduction Steps
macro-goto-definition/directory in VS Code.top.v.`IRQ_IARin this line:`IRQ_IAR_ACK_DEFAULTand`IRQ_IAR_ACK_R.Expected
Vizsla should navigate to the corresponding macro definitions in
defs.vh:Actual
No definition location is returned for these macro usages.
The project configuration appears to be valid:
top.vis listed insources.defs.vhis listed insources.include_dirs = ["."]allows`include "defs.vh"to resolve.Related Issues
This is related to macro support, but it appears to cover a different LSP feature from existing open issues:
Go to Referencesfailure in a real project.This issue is specifically about
textDocument/definition: navigating from a macro usage such as`IRQ_IARto its`define IRQ_IARdeclaration.