All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 " Author: Filip Gospodinov <f@gospodinov.ch>
2 " Description: Functions for working with biome, for checking or fixing files.
4 call ale#Set('biome_executable', 'biome')
5 call ale#Set('biome_use_global', get(g:, 'ale_use_global_executables', 0))
6 call ale#Set('biome_options', '')
7 call ale#Set('biome_fixer_apply_unsafe', 0)
8 call ale#Set('biome_lsp_project_root', '')
10 function! ale#handlers#biome#GetExecutable(buffer) abort
11 return ale#path#FindExecutable(a:buffer, 'biome', [
12 \ 'node_modules/@biomejs/cli-linux-x64/biome',
13 \ 'node_modules/@biomejs/cli-linux-arm64/biome',
14 \ 'node_modules/@biomejs/cli-win32-x64/biome.exe',
15 \ 'node_modules/@biomejs/cli-win32-arm64/biome.exe',
16 \ 'node_modules/@biomejs/cli-darwin-x64/biome',
17 \ 'node_modules/@biomejs/cli-darwin-arm64/biome',
18 \ 'node_modules/.bin/biome',
22 function! ale#handlers#biome#GetLanguage(buffer) abort
23 return getbufvar(a:buffer, '&filetype')
26 function! ale#handlers#biome#GetProjectRoot(buffer) abort
27 let l:project_root = ale#Var(a:buffer, 'biome_lsp_project_root')
29 if !empty(l:project_root)
33 let l:possible_project_roots = [
41 for l:possible_root in l:possible_project_roots
42 let l:project_root = ale#path#FindNearestFile(a:buffer, l:possible_root)
44 if empty(l:project_root)
45 let l:project_root = ale#path#FindNearestDirectory(a:buffer, l:possible_root)
48 if !empty(l:project_root)
49 " dir:p expands to /full/path/to/dir/ whereas
50 " file:p expands to /full/path/to/file (no trailing slash)
51 " Appending '/' ensures that :h:h removes the path's last segment
52 " regardless of whether it is a directory or not.
53 return fnamemodify(l:project_root . '/', ':p:h:h')