Skip to content

Commit

Permalink
Add YANG LSP settings
Browse files Browse the repository at this point in the history
Signed-off-by: Siddharth Sharma <siddharth.sharma@ericsson.com>
  • Loading branch information
esmasth committed Mar 23, 2024
1 parent 2bdd975 commit cc0e0f5
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ You can change the directory to install servers by set `g:lsp_settings_servers_d
| V | vlang-vls | Yes | Yes |
| XML | lemminx | Yes | Yes |
| YAML | yaml-language-server | 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\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 -s yang-language-server/bin/yang-language-server yang-lsp
19 changes: 19 additions & 0 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,25 @@
]
}
],
"yang": [
{
"command": "yang-lsp",
"url": "https://github.com/TypeFox/yang-lsp",
"description": "Language Server for YANG Files",
"requires": [
"java"
],
"root_uri_patterns": [
".git"
],
"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

0 comments on commit cc0e0f5

Please sign in to comment.