mirror of
https://github.com/dense-analysis/ale
synced 2024-12-17 20:05:31 +00:00
fix(biome): send correct language to lsp proxy (#4773)
Since Biome understands `typescriptreact` and `javascriptreact` as languages, we can send the `filetype` to the LSP, rather than only sending `typescript` for both `ts` and `tsx` files, or `javascript` for `js` and `jsx` files. fixes: #4752
This commit is contained in:
parent
f2aef2f510
commit
5606606b32
@ -4,6 +4,7 @@
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#biome#GetCommand'),
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
|
@ -4,6 +4,7 @@
|
||||
call ale#linter#Define('typescript', {
|
||||
\ 'name': 'biome',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'language': function('ale#handlers#biome#GetLanguage'),
|
||||
\ 'executable': function('ale#handlers#biome#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#biome#GetCommand'),
|
||||
\ 'project_root': function('ale#handlers#biome#GetProjectRoot'),
|
||||
|
@ -25,6 +25,10 @@ function! ale#handlers#biome#GetCommand(buffer) abort
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#biome#GetLanguage(buffer) abort
|
||||
return getbufvar(a:buffer, '&filetype')
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#biome#GetProjectRoot(buffer) abort
|
||||
let l:biome_file = ale#path#FindNearestFile(a:buffer, 'biome.json')
|
||||
|
||||
|
@ -16,3 +16,20 @@ Execute(The biome command should accept options):
|
||||
let g:ale_biome_options = '--foobar'
|
||||
|
||||
AssertLinter 'biome', ale#Escape('biome') . ' lsp-proxy --foobar'
|
||||
|
||||
Execute(Uses the filetype as the language):
|
||||
call ale#test#SetFilename('test.ts')
|
||||
set filetype=typescript
|
||||
AssertLSPLanguage 'typescript'
|
||||
|
||||
call ale#test#SetFilename('test.tsx')
|
||||
set filetype=typescriptreact
|
||||
AssertLSPLanguage 'typescriptreact'
|
||||
|
||||
call ale#test#SetFilename('test.js')
|
||||
set filetype=javascript
|
||||
AssertLSPLanguage 'javascript'
|
||||
|
||||
call ale#test#SetFilename('test.jsx')
|
||||
set filetype=javascriptreact
|
||||
AssertLSPLanguage 'javascriptreact'
|
Loading…
Reference in New Issue
Block a user