aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/biome.lua
diff options
context:
space:
mode:
authorChris Grieser <73286100+chrisgrieser@users.noreply.github.com>2025-04-15 15:26:49 +0200
committerGitHub <noreply@github.com>2025-04-15 06:26:49 -0700
commit4cb35c04d36efb1a393bce38d40689a76b0c3d62 (patch)
tree8bdf57ec81641f2ed9581b49b5c7a1e240729b1f /lsp/biome.lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-4cb35c04d36efb1a393bce38d40689a76b0c3d62.tar
nvim-lspconfig-4cb35c04d36efb1a393bce38d40689a76b0c3d62.tar.gz
nvim-lspconfig-4cb35c04d36efb1a393bce38d40689a76b0c3d62.tar.bz2
nvim-lspconfig-4cb35c04d36efb1a393bce38d40689a76b0c3d62.tar.lz
nvim-lspconfig-4cb35c04d36efb1a393bce38d40689a76b0c3d62.tar.xz
nvim-lspconfig-4cb35c04d36efb1a393bce38d40689a76b0c3d62.tar.zst
nvim-lspconfig-4cb35c04d36efb1a393bce38d40689a76b0c3d62.zip
feat(biome): vim.lsp.config with workspace_required, root_dir #3727
Diffstat (limited to 'lsp/biome.lua')
-rw-r--r--lsp/biome.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/lsp/biome.lua b/lsp/biome.lua
new file mode 100644
index 00000000..1ecc9d5f
--- /dev/null
+++ b/lsp/biome.lua
@@ -0,0 +1,36 @@
+---@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 = { 'biome', 'lsp-proxy' },
+ filetypes = {
+ 'astro',
+ 'css',
+ 'graphql',
+ 'javascript',
+ 'javascriptreact',
+ 'json',
+ 'jsonc',
+ 'svelte',
+ 'typescript',
+ 'typescript.tsx',
+ 'typescriptreact',
+ 'vue',
+ },
+ workspace_required = true,
+ root_dir = function(bufnr, on_dir)
+ local fname = vim.api.nvim_buf_get_name(bufnr)
+ local root_files = { 'biome.json', 'biome.jsonc' }
+ root_files = util.insert_package_json(root_files, 'biome', fname)
+ local root_dir = vim.fs.dirname(vim.fs.find(root_files, { path = fname, upward = true })[1])
+ on_dir(root_dir)
+ end,
+}