mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-07 10:21:05 +08:00
Add biome support for javascript (#4701)
This commit is contained in:
@@ -646,6 +646,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['ruby'],
|
||||
\ 'description': 'A formatter for Ruby source code',
|
||||
\ },
|
||||
\ 'biome': {
|
||||
\ 'function': 'ale#fixers#biome#Fix',
|
||||
\ 'suggested_filetypes': ['javascript', 'typescript'],
|
||||
\ 'description': 'Apply biome (ex. rome) check to a file.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
17
autoload/ale/fixers/biome.vim
Normal file
17
autoload/ale/fixers/biome.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
" Author: Akiomi Kamakura <akiomik@gmail.com>
|
||||
" Description: Fixing files with biome (ex.rome).
|
||||
|
||||
function! ale#fixers#biome#Fix(buffer) abort
|
||||
let l:executable = ale#handlers#biome#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'javascript_biome_options')
|
||||
let l:node = ale#Var(a:buffer, 'javascript_biome_node_executable')
|
||||
|
||||
return {
|
||||
\ 'command': (has('win32') ? (ale#Escape(l:node) . ' ') : '')
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . ' check --apply'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\}
|
||||
endfunction
|
||||
14
autoload/ale/handlers/biome.vim
Normal file
14
autoload/ale/handlers/biome.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
" Author: Akiomi Kamakura <akiomik@gmail.com>
|
||||
" Description: Functions for working with biome, for fixing files.
|
||||
|
||||
call ale#Set('javascript_biome_node_executable', 'node.exe')
|
||||
call ale#Set('javascript_biome_executable', 'biome')
|
||||
call ale#Set('javascript_biome_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('javascript_biome_options', '')
|
||||
|
||||
function! ale#handlers#biome#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_biome', [
|
||||
\ 'node_modules/.bin/biome',
|
||||
\ 'node_modules/@biomejs/biome/bin/biome',
|
||||
\])
|
||||
endfunction
|
||||
Reference in New Issue
Block a user