textDocument/definition returns empty Location due to v -line-info returning empty result
Problem Description
When using “Go to Definition” in the editor (Zed → VLS), the server logs show that
v -line-info returns empty output, causing the response Location to be invalid.
Full LSP Log Snippet
RECV: {"jsonrpc":"2.0","id":4,"method":"textDocument/definition","params":{"textDocument":{"uri":"file:///home/Jengro/Documents/Dev/v-product/vprod-workspase/backend/main.v"},"position":{"line":8,"character":29}}}
running v.exe line info!
cmd=v -w -check -json-errors -nocolor -vls-mode -line-info "/home/Jengro/Documents/Dev/v-product/vprod-workspase/backend/main.v:9:29" /home/Jengro/Documents/Dev/v-product/vprod-workspase/backend/main.v
RUN RES os.Result{
exit_code: 1
output: ''
}
WARNING: v -line-info returned empty or invalid output:
WARNING: v -line-info returned empty Location for /home/Jengro/Documents/Dev/v-product/vprod-workspase/backend/main.v:9:29
ResponseResult(Location{
uri: ''
range: {
start: { line: 0, char: 0 },
end: { line: 0, char: 0 }
}
})
SEND: {"id":4,"result":{"uri":"","range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}}},"jsonrpc":"2.0"}
Observed Behavior
VLS receives the textDocument/definition request correctly.
It runs:
v -w -check -json-errors -nocolor -vls-mode -line-info "path/to/file.v:9:29" path/to/file.v
The command exits with exit_code: 1 and no output.
As a result, VLS sends back an empty Location.
xpected Behavior
v -line-info should return valid JSON with definition location information.
VLS should parse it and return a proper LSP Location object with uri and range.
Possible Causes
v -line-info currently fails silently when:
The cursor position (line/character) does not map to a valid symbol.
The file imports or modules are unresolved due to VROOT or workspace context.
-vls-mode might suppress output or change behavior unexpectedly.
Missing working directory or module context for the file (vls may not pass correct cwd).
Suggestions
Add verbose logging when v -line-info returns empty, to inspect actual stdout/stderr.
Verify that V’s compiler command can resolve imports in the same environment.
Consider falling back to static analysis when v -line-info fails.
Repro Steps
Open any .v file in Zed.
Move cursor to a function or struct reference.
Trigger “Go to Definition”.
Observe that VLS logs v -line-info returned empty output.
Example Path
/home/Jengro/Documents/Dev/v-product/vprod-workspase/backend/main.v
Impact
All “Go to Definition” features fail. Hover/type checks still work.
textDocument/definition returns empty Location due to v -line-info returning empty result
Problem Description
When using “Go to Definition” in the editor (Zed → VLS), the server logs show that
v -line-info returns empty output, causing the response Location to be invalid.
Full LSP Log Snippet
Observed Behavior
VLS receives the textDocument/definition request correctly.
It runs:
v -w -check -json-errors -nocolor -vls-mode -line-info "path/to/file.v:9:29" path/to/file.vThe command exits with exit_code: 1 and no output.
As a result, VLS sends back an empty Location.
xpected Behavior
v -line-info should return valid JSON with definition location information.
VLS should parse it and return a proper LSP Location object with uri and range.
Possible Causes
v -line-info currently fails silently when:
The cursor position (line/character) does not map to a valid symbol.
The file imports or modules are unresolved due to VROOT or workspace context.
-vls-mode might suppress output or change behavior unexpectedly.
Missing working directory or module context for the file (vls may not pass correct cwd).
Suggestions
Add verbose logging when v -line-info returns empty, to inspect actual stdout/stderr.
Verify that V’s compiler command can resolve imports in the same environment.
Consider falling back to static analysis when v -line-info fails.
Repro Steps
Open any .v file in Zed.
Move cursor to a function or struct reference.
Trigger “Go to Definition”.
Observe that VLS logs v -line-info returned empty output.
Example Path
/home/Jengro/Documents/Dev/v-product/vprod-workspase/backend/main.vImpact
All “Go to Definition” features fail. Hover/type checks still work.