Slow LSP on large TS monorepo project. Caching?

The default root_dir for tsserver spawns one instance per package.json. You can override that with something like:

require('lspconfig').tsserver.setup({
  root_dir = require('lspconfig.util').root_pattern('.git')
})

That will find your repository root (assuming you’re using git) and start the server there. Alternatively you can make it start at your current working dir or whatever you want really, just set root_dir to a custom function.

1 Like