vlang / v-analyzer

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

The LSP configuration on Neovim is wrong. #114

Open JulienLecoq opened 1 month ago

JulienLecoq commented 1 month ago

Describe the bug

According to the doc, we should just have to do:

:LspInstall v_analyzer or :MasonInstall v_analyzer

But both of them install vls from: https://github.com/v-analyzer/v-analyzer

And after doing the manipulation, vls crash on start saying that we should install the language server by doing v ls --install which isn't mentioned anywhere on the doc.

Expected Behavior

:LspInstall v_analyzer and :MasonInstall v_analyzer should install the correct vls version.

Current Behavior

Already stated before.

Reproduction Steps

Just run :LspInstall v_analyzer or :MasonInstall v_analyzer on Neovim

Possible Solution

I don't know how to fix the commands mentioned before, but you can make it work by doing this (on MacOS):

  1. Install the vls by running this command: v -e "$(curl -fsSL https://raw.githubusercontent.com/vlang/v-analyzer/main/install.vsh)" in the terminal.
  2. Open the .zshrc file and export the path of the bin folder like so: export PATH="/Users/<<userName>>/.config/v-analyzer/bin:$PATH".
  3. Add the LSP configuration in Neovim like so:
local lspconfig = require('lspconfig')

lspconfig.vls.setup {
    cmd = { '/Users/<<userName>>/.config/v-analyzer/bin/v-analyzer' },
}

Additional Information/Context

No response

Environment details (v doctor output)

V full version: V 0.4.7 2cde320.52fe7c0 OS: macos, macOS, 14.5, 23F79 Processor: 12 cpus, 64bit, little endian, Apple M2 Max

getwd: ############################## vexe: /usr/local/v/v vexe mtime: 2024-07-26 16:19:28

vroot: OK, value: /usr/local/v VMODULES: OK, value: /Users/<>/.vmodules VTMP: OK, value: /tmp/v_501

Git version: git version 2.39.3 (Apple Git-146) Git vroot status: 0.4.7-1-g52fe7c09 .git/config present: true

CC version: Apple clang version 15.0.0 (clang-1500.3.9.4) thirdparty/tcc status: thirdparty-macos-arm64 713692d4

Editor name

Neovim

v-analyzer Version

0.0.4-beta.1.2d5d12e

VS Code Extension Version

No response