mirror of https://github.com/dense-analysis/ale
vscode-json-languageserver support (#4164)
* vscode-json-languageserver-bin support VSCode JSON languageserver has schema support for linting and completions. I have enabled snippets support (`snippetSupport`) even if it is not fully supported. `label` that comes with completions response can be used as well. * Test fix. * vscode-json-languageserver instead of vscode-json-languageserver-bin vscode-json-languageserver is more up-to-date (about 1 year old), vscode-json-languageserver-bin is 4 years old. * Use git root. * Documentation update. * Trying to sort ordering issue. * One more attempt * One more attempt * Uppercase seems to win. * Clean-up * Clean-up 2 * Test removed.
This commit is contained in:
parent
d484347fb5
commit
34892186e4
|
@ -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'),
|
||||
\})
|
|
@ -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'],
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -283,6 +283,7 @@ Notes:
|
|||
* `tsserver`
|
||||
* `xo`
|
||||
* JSON
|
||||
* `VSCode JSON language server`
|
||||
* `cspell`
|
||||
* `dprint`
|
||||
* `eslint`
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue