v-analyzer / v-analyzer

Bring IDE features for V programming languages in VS Code, Vim and other editors
MIT License
170 stars 20 forks source link

Treesitter - wrong item identification for function call (neovim) #96

Open mac-hel opened 8 months ago

mac-hel commented 8 months ago

Describe the bug

:Inspect command shows wrong item name for function call on imported namespace :Inspect command shows wrong item name for module being imported

Expected Behavior

function call :Inspect output:

Treesitter
  - @function.method.call.v links to @function v

import module :Inspect output:

Treesitter
  - @module.v links to @module v

(probably)

Current Behavior

function call :Inspect output:

Treesitter
  - @function.method.call.v links to @function v
  - @variable.v links to @variable v
  - @variable.member.v links to @variable v

import module :Inspect output:

Treesitter
  - @module.v links to @module v
  - @variable.v links to @variable v

Reproduction Steps

main.v
core/core.v

main.v:

import core                               // TreeSitter is wrong here on 'core'

fn main() {
    core.query_get_data(2)    // TreeSitter is wrong here on 'query_get_data()'
}

core.v

module core

struct Point {
    x_property i8
    y_property string
}

pub fn query_get_data(fun_param int) int {
    mut avariable := 10
    println('getting data ${avariable}')
    return 14
}

Possible Solution

No response

Additional Information/Context

Seems to work on VSCode, syntax highlighting looks ok

Environment details (v doctor output)

V full version: V 0.4.4 f603035 OS: linux, "EndeavourOS Linux" Processor: 8 cpus, 64bit, little endian, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz

getwd: /H/_nobackup/Projects/v_sandbox vexe: /H/daily/mh/.local/share/v/v vexe mtime: 2024-02-09 14:26:48

vroot: OK, value: /H/daily/mh/.local/share/v VMODULES: OK, value: /home/mh/.vmodules VTMP: OK, value: /tmp/v_1000

Git version: git version 2.43.0 Git vroot status: weekly.2024.06-25-gf6030357 (4 commit(s) behind V master) .git/config present: true

CC version: cc (GCC) 13.2.1 20230801 thirdparty/tcc status: thirdparty-linux-amd64 99683af0

Editor name

neovim

v-analyzer Version

0.0.4-beta.1.56d7905

VS Code Extension Version

No response

mac-hel commented 8 months ago

Not sure if this is bug tough, :Inspect also show semantic versioning which can be used for proper highlighting:

// import core
Semantic Tokens
  - @lsp.type.namespace.v priority: 125

// query_get_data()
Semantic Tokens
  - @lsp.type.function.v links to Function priority: 125