Setting Biome root directory on nvim with lspconfig

45 views Asked by At

This isn't a problem but a solution in case anyones meets it as a problem.

While setting up biomejs with the lspconfig on neovim, the root directory returns "not found".

This will fix that.

local util = require("lspconfig.util")

return {
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        biome = {
          root_dir = function(fname)
            return util.root_pattern("biome.json", "biome.jsonc")(fname)
              or util.find_package_json_ancestor(fname)
              or util.find_node_modules_ancestor(fname)
              or util.find_git_ancestor(fname)
          end,
        },
      },
    },
  },
}

0

There are 0 answers