project.nvim icon indicating copy to clipboard operation
project.nvim copied to clipboard

Duplicate LSP when open buffers from different projects

Open ajmasia opened this issue 2 years ago • 1 comments

Hi guys!

I use to work in a big monorepo. Sometimes I have to work on several buffers that belong to different projects. What happens is that it opens an instance of LSP ttserver for each project. Is there any way to fix this?

Thanks!

ajmasia avatar Apr 28 '22 15:04 ajmasia

This is not related to project.nvim. I have the same problem. Add this to your lspconfig.tsserver.setup argument

  root_dir = function(fname)
    return util.root_pattern(".git")(fname)
      or util.root_pattern("package.json", "tsconfig.json", "jsconfig.json")(
        fname
      )
  end,

This, however will now probably mess up project.nvim projects, since it figures out the project based on lsp. You might want to change the default option to this:

  detection_methods = { "pattern", "lsp" },

I am still figuring out what's the best way to work with monorepos.

sarmong avatar Jun 08 '22 12:06 sarmong