vlang / v-analyzer

The @vlang language server, for all your editing needs like go-to-definition, code completion, type hints, and more.
MIT License
92 stars 10 forks source link

Cannot resolve reference for documentation when using selective imports #16

Closed Ayehavgunne closed 5 months ago

Ayehavgunne commented 6 months ago

Describe the bug

Copying this issue over from older repo.

module test

import cli {Command}

fn main() {
    mut cmd := Command{...}
}

Variable cmd will be marked as :unknown and logs says:

2023-07-14 17:30:36 [WARN] Cannot resolve reference for documentation name=Command

If I change the code like below it will works correctly:

module test

import cli

fn main() {
    mut cmd := cli.Command{...}
}

Expected Behavior

Should able to resolve the reference when using selective imports.

Current Behavior

it will return unknown

Reproduction Steps

module test

import cli {Command}

fn main() {
    mut cmd := Command{}
}

Possible Solution

No response

Additional Information/Context

No response

Environment details (v doctor output)

V full version: V 0.4.4 fe857f9 OS: windows, Microsoft Windows 11 Home v22631 64-bit Processor: 12 cpus, 64bit, little endian,

getwd: C:\Users\posta vexe: C:\Users\posta\Downloads\v_windows\v\v.exe vexe mtime: 2024-01-22 17:43:30

vroot: OK, value: C:\Users\posta\Downloads\v_windows\v VMODULES: OK, value: C:\Users\posta.vmodules VTMP: OK, value: C:\Users\posta\AppData\Local\Temp\v_0

Git version: git version 2.43.0.windows.1 Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git .git/config present: false

CC version: cc (GCC) 13.2.0 thirdparty/tcc: N/A

Editor name

VS Code

v-analyzer Version

v-analyzer version 0.0.4-beta.1.56d7905

VS Code Extension Version

v0.0.2