From b7ef29a8886a57aadb787807a7c6cf74c1f0ed3a Mon Sep 17 00:00:00 2001 From: anand Date: Wed, 17 Dec 2025 15:57:55 +0530 Subject: Nixos --- nvim/lsp/biome.lua | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 nvim/lsp/biome.lua (limited to 'nvim/lsp/biome.lua') 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, +} -- cgit v1.2.3