v-analyzer
v-analyzer copied to clipboard
Rename, hover, go to definition and completion are not working properly for this sample code
Describe the bug
Consider the sample code below
module main
struct Foo { val string }
type Type = Foo | int
fn (x Type) bar() {
match x {
Foo { println('Foo ${x.val}') }
int { println('int $x') }
}
}
fn main() {
x := Type(int(3))
x.bar()
}
Expected Behavior
- I should be able to go to the definition of
barwhen my cursor is at theaofx.bar() - I should be able to hover over the definition of
barwhen my cursor is at theaofx.bar() - If I rename
fn (x Type) bar()tofn (x Type) baz()through the LSP, the change should be propagated to the usage site (x.bar()) - When I type
x.,barshould be listed as a completion suggestion
Current Behavior
- The "Go To Definition" command does not work when my cursor is at
x.bar - The "Hover" command does not work when my cursor is at
x.bar - If I rename
fn (x Type) bar()tofn (x Type) baz()through the LSP, the change is not propagated to the usage site (it remains asx.barinside ofmain) - When I type
x., onlystr()is listed as a completion suggestion (bar()is missing)
Reproduction Steps
- Initialize a project with
v init - Copy the sample code into
src/main.v - Open
src/main.vin the editor
Possible Solution
No response
Additional Information/Context
No response
Environment details (v doctor output)
V full version: V 0.4.6 f24abd7.6197140
OS: linux, Linux version 6.8.7-arch1-2 (linux@archlinux) (gcc (GCC) 13.2.1 20240417, GNU ld (GNU Binutils) 2.42.0) #1 SMP PREEMPT_DYNAMIC Fri, 19 Apr 2024 09:51:31 +0000
Processor: 24 cpus, 64bit, little endian, AMD Ryzen 9 5900X 12-Core Processor
getwd: /home/user/programs
vexe: /home/user/programs/v/v
vexe mtime: 2024-05-21 21:43:22
vroot: OK, value: /home/user/programs/v
VMODULES: OK, value: /home/user/.vmodules
VTMP: OK, value: /dev/shm/tmp/v_1000
Git version: git version 2.44.0
Git vroot status: 0.4.6-10-g61971400 (1 commit(s) behind V master)
.git/config present: true
CC version: cc (GCC) 13.2.1 20240417
thirdparty/tcc: N/A
Editor name
Neovim
v-analyzer Version
v-analyzer version 0.0.4-beta.1.7e11a6f
VS Code Extension Version
No response
.v-analyzer/config.toml
custom_vroot = "/home/user/programs/v"
enable_semantic_tokens = "none"
[inlay_hints]
enable = true
enable_range_hints = true
enable_type_hints = true
enable_implicit_err_hints = true
enable_parameter_name_hints = true
enable_constant_type_hints = true
enable_enum_field_value_hints = true
[code_lens]
enable = false
enable_run_lens = true
enable_inheritors_lens = true
enable_super_interfaces_lens = true
enable_run_tests_lens = true
+1
yep, same issue, at line 384 when I press SHIFT + K which is document hover command in neovim, as you can see at the bottom of screenshot, it says No information available. However, function definition is actually just right below the cursor. so obviously not working and also this happens across the whole document as well. Some symbols work, some does not. For example, all grid, row and col identifiers are also did not recognized by the v-analyzer as well. Hover and GoToDefinition commands do nothing.
v doctor:
V full version: V 0.4.6 0d52a7d
OS: windows, Microsoft Windows 11 Pro v22621 64-bit
Processor: 12 cpus, 64bit, little endian,
getwd: C:\Users\user\Documents\Github\v_test
vexe: C:\Users\user\Documents\Github\v\v.exe
vexe mtime: 2024-06-07 09:54:37
vroot: OK, value: C:\Users\user\Documents\Github\v
VMODULES: OK, value: C:\Users\user\.vmodules
VTMP: OK, value: C:\Users\user\AppData\Local\Temp\v_0
Git version: git version 2.45.2.windows.1
Git vroot status: 0d52a7d9 (4 commit(s) behind V master)
.git/config present: true
CC version: Error: 'cc' is not recognized as an internal or external command,
operable program or batch file.
thirdparty/tcc status: thirdparty-windows-amd64 b425ac82
v-analyzer -v:
v-analyzer version 0.0.4-beta.1.2d5d12e
When open document symbol picker, there is no set_cell_type function symbol.
Will this issue be fixed
@spytheman
I do not know.