How to speed up lsp-mode
Here is my setup,
lsp for the major mode
XXX-mode needs only one line,
(add-hook 'XXX-mode-hook #'my-connect-lsp)
You also need install three packages,
- counsel-etags for code navigation
- company-ctags for code completion
- find-file-in-project (ffip) for searching file in project
Ctags is used to generate tags file for
counsel-etags. GNU Find is required for
These three packages are faster and can replace the corresponding functionalities in
I don't need any lint tools from
lsp-mode because the lint tool is already included in our build script. I can see the syntax error from terminal.
I advice the
lsp-on-change in order to notify the language server less frequently.
Here is code quoted from lsp-mode,
;;;###autoload (defun lsp (&optional arg) ;; ... (when (and lsp-auto-configure) (seq-do (lambda (package) (require package nil t)) lsp-client-packages)) ;; ... )
I have done some profiling by insert
(profiler-report-cpu) at the end of
lsp (the bottlenecks is highlighted).
The language server I used can read jsconfig.json in project root. I can specify the directories to exclude in it.