From b63e37dee9dcddb9a914c2a2a550a9d8a9a720f0 Mon Sep 17 00:00:00 2001 From: izumin5210 Date: Sun, 7 Apr 2024 19:44:57 +0900 Subject: [PATCH 1/4] chore(neovim): use only local prettier and biome --- .../nvim/lua/pluginconfig/lspconfig.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/config/.config/nvim/lua/pluginconfig/lspconfig.lua b/config/.config/nvim/lua/pluginconfig/lspconfig.lua index 1238240c..5150c09e 100644 --- a/config/.config/nvim/lua/pluginconfig/lspconfig.lua +++ b/config/.config/nvim/lua/pluginconfig/lspconfig.lua @@ -108,7 +108,7 @@ function M.setup_mason_null_ls() ensure_installed = { -- JavaScript 'biome', - 'prettierd', + 'prettier', -- Protocol Buffers 'buf', -- Dockerfile @@ -120,6 +120,22 @@ function M.setup_mason_null_ls() }, automatic_installation = false, handlers = { + prettier = function(source_name, methods) + local null_ls = require('null-ls') + null_ls.register( + null_ls.builtins.formatting.prettier.with({ + only_local = 'node_modules/.bin' + }) + ) + end, + biome = function(source_name, methods) + local null_ls = require('null-ls') + null_ls.register( + null_ls.builtins.formatting.biome.with({ + only_local = 'node_modules/.bin' + }) + ) + end, shfmt = function(source_name, methods) local null_ls = require('null-ls') null_ls.register( From da503637091367b7190bbc1e23544691d7b45320 Mon Sep 17 00:00:00 2001 From: izumin5210 Date: Sun, 7 Apr 2024 21:19:16 +0900 Subject: [PATCH 2/4] chore(neovim): use biome only when root has `biome.json` --- config/.config/nvim/lua/pluginconfig/lspconfig.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config/.config/nvim/lua/pluginconfig/lspconfig.lua b/config/.config/nvim/lua/pluginconfig/lspconfig.lua index 5150c09e..ad31f13c 100644 --- a/config/.config/nvim/lua/pluginconfig/lspconfig.lua +++ b/config/.config/nvim/lua/pluginconfig/lspconfig.lua @@ -124,7 +124,10 @@ function M.setup_mason_null_ls() local null_ls = require('null-ls') null_ls.register( null_ls.builtins.formatting.prettier.with({ - only_local = 'node_modules/.bin' + only_local = 'node_modules/.bin', + condition = function(utils) + return not utils.root_has_file({ 'biome.json' }) + end, }) ) end, @@ -132,7 +135,10 @@ function M.setup_mason_null_ls() local null_ls = require('null-ls') null_ls.register( null_ls.builtins.formatting.biome.with({ - only_local = 'node_modules/.bin' + only_local = 'node_modules/.bin', + condition = function(utils) + return utils.root_has_file({ 'biome.json' }) + end, }) ) end, From 6035865f115d58a16f1db7e9d84797c566553c04 Mon Sep 17 00:00:00 2001 From: izumin5210 Date: Sun, 7 Apr 2024 21:19:47 +0900 Subject: [PATCH 3/4] chore(neovim): use prettierd --- config/.config/nvim/lua/pluginconfig/lspconfig.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/.config/nvim/lua/pluginconfig/lspconfig.lua b/config/.config/nvim/lua/pluginconfig/lspconfig.lua index ad31f13c..b956652e 100644 --- a/config/.config/nvim/lua/pluginconfig/lspconfig.lua +++ b/config/.config/nvim/lua/pluginconfig/lspconfig.lua @@ -108,7 +108,7 @@ function M.setup_mason_null_ls() ensure_installed = { -- JavaScript 'biome', - 'prettier', + 'prettierd', -- Protocol Buffers 'buf', -- Dockerfile @@ -120,11 +120,10 @@ function M.setup_mason_null_ls() }, automatic_installation = false, handlers = { - prettier = function(source_name, methods) + prettierd = function(source_name, methods) local null_ls = require('null-ls') null_ls.register( - null_ls.builtins.formatting.prettier.with({ - only_local = 'node_modules/.bin', + null_ls.builtins.formatting.prettierd.with({ condition = function(utils) return not utils.root_has_file({ 'biome.json' }) end, From 80ce3c1ae21614d59fd782bb9352100d84287be7 Mon Sep 17 00:00:00 2001 From: izumin5210 Date: Sun, 7 Apr 2024 21:28:01 +0900 Subject: [PATCH 4/4] chore(neovim): use biome as lsp --- config/.config/nvim/lua/pluginconfig/lspconfig.lua | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/config/.config/nvim/lua/pluginconfig/lspconfig.lua b/config/.config/nvim/lua/pluginconfig/lspconfig.lua index b956652e..23059629 100644 --- a/config/.config/nvim/lua/pluginconfig/lspconfig.lua +++ b/config/.config/nvim/lua/pluginconfig/lspconfig.lua @@ -107,7 +107,6 @@ function M.setup_mason_null_ls() require('mason-null-ls').setup({ ensure_installed = { -- JavaScript - 'biome', 'prettierd', -- Protocol Buffers 'buf', @@ -130,17 +129,6 @@ function M.setup_mason_null_ls() }) ) end, - biome = function(source_name, methods) - local null_ls = require('null-ls') - null_ls.register( - null_ls.builtins.formatting.biome.with({ - only_local = 'node_modules/.bin', - condition = function(utils) - return utils.root_has_file({ 'biome.json' }) - end, - }) - ) - end, shfmt = function(source_name, methods) local null_ls = require('null-ls') null_ls.register( @@ -306,6 +294,7 @@ function M.setup() -- Ruby 'solargraph', -- JS + 'biome', 'eslint', 'tsserver', 'volar',