LSP-typescript: LSP Typescript is really slow on large projects

Autocompletion takes a good few seconds.

Digging into it, it seems like the Theia TypeScript Language Server might not be the best choice.

Can we consider switching to something like: https://github.com/neoclide/coc-tsserver?

This extension is a fork of typescript-language-features extension which is bundled with VSCode and is much faster.

I can start working on it if this is something which might be useful.

Would it be better to do it as a different LSP plugin?

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 15
  • Comments: 46 (23 by maintainers)

Commits related to this issue

Most upvoted comments

I narrowed down my LSP-TypeScript slowness issues to the autocomplete, namely that there were a ton of suggestions populating the results in one of my large monorepo projects. Adding this to my LSP-typescript.sublime-settings has helped tremendously:

{
	"initializationOptions": {
		"preferences": {
			"includeCompletionsForModuleExports": false
		}
	}
}

Videos:

Sublime with only LSP and LSP-typescript:

https://user-images.githubusercontent.com/5403397/151196544-7caafbe8-6c66-4624-949b-41033adba256.mp4


MacVim with coc-tsserver:

https://user-images.githubusercontent.com/5403397/151196483-781b3ef6-31cd-4f4a-8d7f-4c0810605fd9.mp4

Even local autocompletion of the Fixtures word is not happening on Sublime when typing pretty slowly and the fields on Fixtures takes much longer of course as seen in the video.

I will follow up with more logs.

One thing I can see here is that the server responds to completion requests even after a new request was made. The server should likely cancel the request in that case which would result in less processing by the editor.

The biggest contributor to this issue is ST freezing main thread due to large number of completions. At least VSCode doesn’t have problems with same number of completions. I think that that issue is not even filed in ST bug tracker though.

I narrowed down my LSP-TypeScript slowness issues to the autocomplete, namely that there were a ton of suggestions populating the results in one of my large monorepo projects. Adding this to my LSP-typescript.sublime-settings has helped tremendously:

{
	"initializationOptions": {
		"preferences": {
			"includeCompletionsForModuleExports": false
		}
	}
}

Nice! Do you know how to replicate this on neovim?

I’d like to compare the tsserver logs. You’ve provided tsserver log from VSCode and LSP log from ST. That’s like comparing apples to oranges. 😃

See https://github.com/sublimelsp/LSP-typescript/issues/129#issuecomment-1029462686 on how to enable same logs in ST.