diff --git a/README.md b/README.md index a64265f9..1495b9bd 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d | Veryl | veryl-ls | Yes | Yes | | Vue | volar-server | Yes | Yes | | Vue | vls | Yes | Yes | +| V | v-analyzer | Yes | Yes | | V | vlang-vls | Yes | Yes | | XML | lemminx | Yes | Yes | | YAML | yaml-language-server | Yes | Yes | diff --git a/installer/install-v-analyzer.cmd b/installer/install-v-analyzer.cmd new file mode 100644 index 00000000..c1c8a8f9 --- /dev/null +++ b/installer/install-v-analyzer.cmd @@ -0,0 +1,14 @@ +@echo off + +curl -o install.vsh "https://raw.githubusercontent.com/v-analyzer/v-analyzer/master/install.vsh" + +for /f "delims=" %%a in (install.vsh) do ( + set line=%%a + setlocal enabledelayedexpansion + echo !line:'~/.config/v-analyzer='.!>>install2.vsh + endlocal +) + +v install2.vsh +del install.vsh install2.vsh +move bin\v-analyzer.exe . diff --git a/installer/install-v-analyzer.sh b/installer/install-v-analyzer.sh new file mode 100755 index 00000000..969ea8e5 --- /dev/null +++ b/installer/install-v-analyzer.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +url="https://raw.githubusercontent.com/v-analyzer/v-analyzer/master/install.vsh" + +# Replace hard-coded installation path "~/.config/v-analyzer" with "." +v -e "$(curl -fsSL "$url" | sed 's#~/.config/v-analyzer#.#g')" +mv bin/v-analyzer v-analyzer diff --git a/settings.json b/settings.json index d25416a4..d89b4626 100644 --- a/settings.json +++ b/settings.json @@ -1695,6 +1695,17 @@ } ], "vlang": [ + { + "command": "v-analyzer", + "url": "https://github.com/v-analyzer/v-analyzer", + "description": "Bring IDE features for V programming languages in VS Code, Vim and other editors", + "requires": [ + "v" + ], + "root_uri_patterns": [ + "v.mod" + ] + }, { "command": "vlang-vls", "url": "https://github.com/vlang/vls", diff --git a/settings/v-analyzer.vim b/settings/v-analyzer.vim new file mode 100644 index 00000000..30e0db43 --- /dev/null +++ b/settings/v-analyzer.vim @@ -0,0 +1,14 @@ +augroup vim_lsp_settings_vlang_vls + au! + LspRegisterServer { + \ 'name': 'v-analyzer', + \ 'cmd': {server_info->lsp_settings#get('v-analyzer', 'cmd', [lsp_settings#exec_path('v-analyzer')]+lsp_settings#get('v-analyzer', 'args', []))}, + \ 'root_uri':{server_info->lsp_settings#get('v-analyzer', 'root_uri', lsp_settings#root_uri('v-analyzer'))}, + \ 'initialization_options': lsp_settings#get('v-analyzer', 'initialization_options', v:null), + \ 'allowlist': lsp_settings#get('v-analyzer', 'allowlist', ['vlang']), + \ 'blocklist': lsp_settings#get('v-analyzer', 'blocklist', []), + \ 'config': lsp_settings#get('v-analyzer', 'config', lsp_settings#server_config('v-analyzer')), + \ 'workspace_config': lsp_settings#get('v-analyzer', 'workspace_config', {}), + \ 'semantic_highlight': lsp_settings#get('v-analyzer', 'semantic_highlight', {}), + \ } +augroup END