mirror of https://github.com/dense-analysis/ale
racket: support racket-langserver lsp (#3808)
* racket: support racket-langserver lsp * racket-langserver: find highest dir with init.rkt * autoload/ale/racket: re-indent to 4 spaces * racket: lint: sort supported tools * racket: lint: function! This is _not_ needed anymore, but the lint wants it. See :help E127 * racket-langserver: do not use new dict format * racket: lint: use snake_case * add tests for racket-langserver * racket-langserver tests: correct result values
This commit is contained in:
parent
a6719c2d4f
commit
651038b601
|
@ -0,0 +1,7 @@
|
|||
call ale#linter#Define('racket', {
|
||||
\ 'name': 'racket_langserver',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'racket',
|
||||
\ 'command': '%e -l racket-langserver',
|
||||
\ 'project_root': function('ale#racket#FindProjectRoot'),
|
||||
\})
|
|
@ -0,0 +1,12 @@
|
|||
function! ale#racket#FindProjectRoot(buffer) abort
|
||||
let l:cwd = expand('#' . a:buffer . ':p:h')
|
||||
let l:highest_init = l:cwd
|
||||
|
||||
for l:path in ale#path#Upwards(l:cwd)
|
||||
if filereadable(l:path.'/init.rkt')
|
||||
let l:highest_init = l:path
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:highest_init
|
||||
endfunction
|
|
@ -428,6 +428,7 @@ Notes:
|
|||
* `lintr`
|
||||
* `styler`
|
||||
* Racket
|
||||
* `racket-langserver`
|
||||
* `raco`
|
||||
* Re:VIEW
|
||||
* `redpen`
|
||||
|
|
|
@ -437,6 +437,7 @@ formatting.
|
|||
* [lintr](https://github.com/jimhester/lintr)
|
||||
* [styler](https://github.com/r-lib/styler)
|
||||
* Racket
|
||||
* [racket-langserver](https://github.com/jeapostrophe/racket-langserver/tree/master)
|
||||
* [raco](https://docs.racket-lang.org/raco/)
|
||||
* Re:VIEW
|
||||
* [redpen](http://redpen.cc/)
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
" Author: D. Ben Knoble <https://github.com/benknoble>
|
||||
" Description: Tests for racket-langserver lsp linter.
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('racket', 'langserver')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(command callback should return default string):
|
||||
AssertLinter 'racket', ale#Escape('racket').' -l racket-langserver'
|
||||
|
||||
Execute(should set racket-langserver for deep module 3):
|
||||
call ale#test#SetFilename('../test-files/racket/many-inits/a/b/c/foo.rkt')
|
||||
AssertLSPLanguage 'racket'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
|
||||
|
||||
Execute(should set racket-langserver for deep module 2):
|
||||
call ale#test#SetFilename('../test-files/racket/many-inits/a/b/foo.rkt')
|
||||
AssertLSPLanguage 'racket'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
|
||||
|
||||
Execute(should set racket-langserver for deep module 1):
|
||||
call ale#test#SetFilename('../test-files/racket/many-inits/a/foo.rkt')
|
||||
AssertLSPLanguage 'racket'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
|
||||
|
||||
Execute(should set racket-langserver for top-level module):
|
||||
call ale#test#SetFilename('../test-files/racket/many-inits/foo.rkt')
|
||||
AssertLSPLanguage 'racket'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/racket/many-inits')
|
||||
|
||||
Execute(should set racket-langserver for non-package module or script):
|
||||
call ale#test#SetFilename('../test-files/racket/simple-script/foo.rkt')
|
||||
AssertLSPLanguage 'racket'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/racket/simple-script')
|
|
@ -0,0 +1,3 @@
|
|||
#lang racket/base
|
||||
|
||||
(displayln "foo")
|
|
@ -0,0 +1 @@
|
|||
#lang info
|
|
@ -0,0 +1,3 @@
|
|||
#lang racket/base
|
||||
|
||||
(displayln "foo")
|
|
@ -0,0 +1 @@
|
|||
#lang info
|
|
@ -0,0 +1,3 @@
|
|||
#lang racket/base
|
||||
|
||||
(displayln "foo")
|
|
@ -0,0 +1 @@
|
|||
#lang info
|
|
@ -0,0 +1,3 @@
|
|||
#lang racket/base
|
||||
|
||||
(displayln "foo")
|
|
@ -0,0 +1 @@
|
|||
#lang info
|
|
@ -0,0 +1,3 @@
|
|||
#lang racket/base
|
||||
|
||||
(displayln "foo")
|
Loading…
Reference in New Issue