diff options
-rw-r--r-- | ale_linters/json/vscodejson.vim | 16 | ||||
-rw-r--r-- | autoload/ale/linter.vim | 2 | ||||
-rw-r--r-- | doc/ale-json.txt | 12 | ||||
-rw-r--r-- | doc/ale-supported-languages-and-tools.txt | 1 | ||||
-rw-r--r-- | doc/ale.txt | 2 | ||||
-rw-r--r-- | supported-tools.md | 1 | ||||
-rw-r--r-- | test/test_filetype_linter_defaults.vader | 2 |
7 files changed, 34 insertions, 2 deletions
diff --git a/ale_linters/json/vscodejson.vim b/ale_linters/json/vscodejson.vim new file mode 100644 index 00000000..91988923 --- /dev/null +++ b/ale_linters/json/vscodejson.vim @@ -0,0 +1,16 @@ +" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com> +" Description: VSCode json languageserver + +function! ale_linters#json#vscodejson#GetProjectRoot(buffer) abort + let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') + + return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : '' +endfunction + +call ale#linter#Define('json', { +\ 'name': 'vscodejson', +\ 'lsp': 'stdio', +\ 'executable': 'vscode-json-languageserver', +\ 'command': '%e --stdio', +\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'), +\}) diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index 9079dfa0..98839488 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -45,7 +45,7 @@ let s:default_ale_linters = { \ 'hack': ['hack'], \ 'help': [], \ 'inko': ['inko'], -\ 'json': ['jsonlint', 'spectral'], +\ 'json': ['jsonlint', 'spectral', 'vscodejson'], \ 'json5': [], \ 'jsonc': [], \ 'perl': ['perlcritic'], diff --git a/doc/ale-json.txt b/doc/ale-json.txt index 67db0b74..879cedb8 100644 --- a/doc/ale-json.txt +++ b/doc/ale-json.txt @@ -153,6 +153,18 @@ g:ale_json_spectral_use_global *g:ale_json_spectral_use_global* See |ale-integrations-local-executables| +=============================================================================== +vscodejson *ale-json-vscode* + +Website: https://www.npmjs.com/package/vscode-json-languageserver + +Installation +------------------------------------------------------------------------------- + +Install VSCode json language server either globally or locally: > + + npm install -g vscode-json-languageserver +< =============================================================================== vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: diff --git a/doc/ale-supported-languages-and-tools.txt b/doc/ale-supported-languages-and-tools.txt index a311cda9..0bd1b3d1 100644 --- a/doc/ale-supported-languages-and-tools.txt +++ b/doc/ale-supported-languages-and-tools.txt @@ -283,6 +283,7 @@ Notes: * `tsserver` * `xo` * JSON + * `VSCode JSON language server` * `cspell` * `dprint` * `eslint` diff --git a/doc/ale.txt b/doc/ale.txt index 3e6ea02b..383b7ae1 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -1613,6 +1613,7 @@ g:ale_linters *g:ale_linters* \ 'help': [], \ 'inko': ['inko'], \ 'json': ['jsonlint', 'spectral'], + \ 'json': ['jsonlint', 'spectral', 'vscodejson'], \ 'json5': [], \ 'jsonc': [], \ 'perl': ['perlcritic'], @@ -2961,6 +2962,7 @@ documented in additional help files. jq....................................|ale-json-jq| prettier..............................|ale-json-prettier| spectral..............................|ale-json-spectral| + vscodejson............................|ale-json-vscode| jsonc...................................|ale-jsonc-options| eslint................................|ale-jsonc-eslint| jsonnet.................................|ale-jsonnet-options| diff --git a/supported-tools.md b/supported-tools.md index 45562851..313b3b88 100644 --- a/supported-tools.md +++ b/supported-tools.md @@ -292,6 +292,7 @@ formatting. * [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29) * [xo](https://github.com/sindresorhus/xo) * JSON + * [VSCode JSON language server](https://www.npmjs.com/package/vscode-json-languageserver) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [dprint](https://dprint.dev) * [eslint](http://eslint.org/) :warning: diff --git a/test/test_filetype_linter_defaults.vader b/test/test_filetype_linter_defaults.vader index dad8e5ee..1217e237 100644 --- a/test/test_filetype_linter_defaults.vader +++ b/test/test_filetype_linter_defaults.vader @@ -60,7 +60,7 @@ Execute(The defaults for the inko filetype should be correct): AssertEqual [], GetLinterNames('inko') Execute(The defaults for the json filetype should be correct): - AssertEqual ['jsonlint', 'spectral'], GetLinterNames('json') + AssertEqual ['jsonlint', 'spectral', 'vscodejson'], GetLinterNames('json') let g:ale_linters_explicit = 1 |