diff --git a/ale_linters/javascript/biome.vim b/ale_linters/javascript/biome.vim index 71a081143b..61f7c8f4c7 100644 --- a/ale_linters/javascript/biome.vim +++ b/ale_linters/javascript/biome.vim @@ -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'), diff --git a/ale_linters/typescript/biome.vim b/ale_linters/typescript/biome.vim index 763a254c99..301157441a 100644 --- a/ale_linters/typescript/biome.vim +++ b/ale_linters/typescript/biome.vim @@ -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'), diff --git a/autoload/ale/handlers/biome.vim b/autoload/ale/handlers/biome.vim index e8da6a2f7a..a12bfe831f 100644 --- a/autoload/ale/handlers/biome.vim +++ b/autoload/ale/handlers/biome.vim @@ -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') diff --git a/test/linter/test_typescript_biome.vader b/test/linter/test_biome.vader similarity index 51% rename from test/linter/test_typescript_biome.vader rename to test/linter/test_biome.vader index 79bcbebc00..c2cd9407d3 100644 --- a/test/linter/test_typescript_biome.vader +++ b/test/linter/test_biome.vader @@ -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'