diff options
| author | anand <anand.panchdhari@gmail.com> | 2025-12-17 15:57:55 +0530 |
|---|---|---|
| committer | anand <anand.panchdhari@gmail.com> | 2025-12-17 15:57:55 +0530 |
| commit | b7ef29a8886a57aadb787807a7c6cf74c1f0ed3a (patch) | |
| tree | 366a68240fbc9da6b1d567bd6c46d1350ad814de /nvim/lsp/biome.lua | |
Nixos
Diffstat (limited to 'nvim/lsp/biome.lua')
| -rwxr-xr-x | nvim/lsp/biome.lua | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/nvim/lsp/biome.lua b/nvim/lsp/biome.lua new file mode 100755 index 0000000..d58ae46 --- /dev/null +++ b/nvim/lsp/biome.lua @@ -0,0 +1,46 @@ +---@brief +--- https://biomejs.dev +--- +--- Toolchain of the web. [Successor of Rome](https://biomejs.dev/blog/annoucing-biome). +--- +--- ```sh +--- npm install [-g] @biomejs/biome +--- ``` + +local util = require 'lspconfig.util' + +return { + cmd = function(dispatchers, config) + local cmd = 'biome' + local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/biome' + if local_cmd and vim.fn.executable(local_cmd) == 1 then + cmd = local_cmd + end + return vim.lsp.rpc.start({ cmd, 'lsp-proxy' }, dispatchers) + end, + filetypes = { + 'astro', + 'css', + 'graphql', + 'html', + 'javascript', + 'javascriptreact', + 'json', + 'jsonc', + 'svelte', + 'typescript', + 'typescript.tsx', + 'typescriptreact', + 'vue', + }, + workspace_required = true, + root_dir = function(_, on_dir) + -- To support monorepos, biome recommends starting the search for the root from cwd + -- https://biomejs.dev/guides/big-projects/#use-multiple-configuration-files + local cwd = vim.fn.getcwd() + local root_files = { 'biome.json', 'biome.jsonc' } + root_files = util.insert_package_json(root_files, 'biome', cwd) + local root_dir = vim.fs.dirname(vim.fs.find(root_files, { path = cwd, upward = true })[1]) + on_dir(root_dir) + end, +} |
