Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YANG LSP settings #733

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d
| XML | lemminx | Yes | Yes |
| YAML | yaml-language-server | Yes | Yes |
| YAML | aws-lsp-yaml | Yes | Yes |
| YANG | yang-lsp | Yes | Yes |
| ZIG | zls | Yes | Yes |
| \* | efm-langserver | Yes | Yes |

Expand Down
2 changes: 1 addition & 1 deletion data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

JSON Schemas

https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/api/json/catalog.json
<https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/api/json/catalog.json>
15 changes: 15 additions & 0 deletions installer/install-yang-lsp.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@echo off

setlocal
set VERSION=0.7.6
curl -L -o yang-language-server.zip https://github.com/TypeFox/yang-lsp/releases/download/v%VERSION%/yang-language-server_%VERSION%.zip
call "%%~dp0\run_unzip.cmd" yang-language-server.zip
del yang-language-server.zip

echo @echo off^

setlocal^

%%~dp0\yang-language-server-%VERSION%\bin\yang-language-server.bat %%* ^

> yang-lsp.cmd
9 changes: 9 additions & 0 deletions installer/install-yang-lsp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -e

VERSION=0.7.6
curl -L -o yang-language-server.zip https://github.com/TypeFox/yang-lsp/releases/download/v$VERSION/yang-language-server_$VERSION.zip
unzip yang-language-server.zip
rm yang-language-server.zip
ln -sf yang-language-server-$VERSION/bin/yang-language-server yang-lsp
21 changes: 21 additions & 0 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2163,6 +2163,27 @@
]
}
],
"yang": [
{
"command": "yang-lsp",
"url": "https://github.com/TypeFox/yang-lsp",
"description": "Language Server for YANG Files",
"requires": [
"java"
],
"root_uri_patterns": [
".git",
".git/",
"yang.settings"
],
"vim_plugin": {
"extensions": [
"yang"
],
"name": "nathanalderson/yang.vim"
}
}
],
"zig": [
{
"command": "zls",
Expand Down
14 changes: 14 additions & 0 deletions settings/yang-lsp.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
augroup vim_lsp_settings_yang_lsp
au!
LspRegisterServer {
\ 'name': 'yang-lsp',
\ 'cmd': {server_info->lsp_settings#get('yang-lsp', 'cmd', [lsp_settings#exec_path('yang-lsp')]+lsp_settings#get('yang-lsp', 'args', []))},
\ 'root_uri':{server_info->lsp_settings#get('yang-lsp', 'root_uri', lsp_settings#root_uri('yang-lsp'))},
\ 'initialization_options': lsp_settings#get('yang-lsp', 'initialization_options', v:null),
\ 'allowlist': lsp_settings#get('yang-lsp', 'allowlist', ['yang']),
\ 'blocklist': lsp_settings#get('yang-lsp', 'blocklist', []),
\ 'config': lsp_settings#get('yang-lsp', 'config', lsp_settings#server_config('yang-lsp')),
\ 'workspace_config': lsp_settings#get('yang-lsp', 'workspace_config', {}),
\ 'semantic_highlight': lsp_settings#get('yang-lsp', 'semantic_highlight', {}),
\ }
augroup END
Loading