diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-15 04:29:30 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-15 04:29:30 +0900 |
| commit | 5ac97e5aceeea6a30fcce64b2d1257071f18f47d (patch) | |
| tree | 436aad68d701292d64c34b721774801c2c8b6234 /.config/nvim/lua/vimrc/plugins.lua | |
| parent | 21170917958f2870f84a26bc0357547da5a1b87a (diff) | |
| download | dotfiles-5ac97e5aceeea6a30fcce64b2d1257071f18f47d.tar.gz dotfiles-5ac97e5aceeea6a30fcce64b2d1257071f18f47d.tar.zst dotfiles-5ac97e5aceeea6a30fcce64b2d1257071f18f47d.zip | |
nvim: use biome for formatting js/ts
Diffstat (limited to '.config/nvim/lua/vimrc/plugins.lua')
| -rw-r--r-- | .config/nvim/lua/vimrc/plugins.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/.config/nvim/lua/vimrc/plugins.lua b/.config/nvim/lua/vimrc/plugins.lua index 0db8508..d8bd0c7 100644 --- a/.config/nvim/lua/vimrc/plugins.lua +++ b/.config/nvim/lua/vimrc/plugins.lua @@ -624,6 +624,11 @@ return { lspconfig.phpactor.setup({}) end if vim.fn.executable('efm-langserver') == 1 then + local biome_conf = { + rootMarkers = {"biome.json"}, + formatCommand = 'node_modules/.bin/biome format --stdin-file-path "${INPUT}"', + formatStdin = true, + } lspconfig.efm.setup({ init_options = { documentFormatting = true }, settings = { @@ -635,6 +640,12 @@ return { formatStdin = true, }, }, + javascript = {biome_conf}, + javascriptreact = {biome_conf}, + ["javascript.jsx"] = {biome_conf}, + typescript = {biome_conf}, + typescriptreact = {biome_conf}, + ["typescript.jsx"] = {biome_conf}, }, } }) @@ -647,7 +658,10 @@ return { local opts = { buffer = e.buf } vim.keymap.set('n', '<space>f', function() - vim.lsp.buf.format({ async = true }) + vim.lsp.buf.format({ + async = true, + filter = function(client) return client.name ~= "tsserver" end, + }) end, opts) vim.api.nvim_create_autocmd('BufWritePre', { @@ -656,6 +670,7 @@ return { vim.lsp.buf.format({ async = false, timeout_ms = 5000, + filter = function(client) return client.name ~= "tsserver" end, }) end }) |
