Skip to content

Main features#

Completion at point#

If LSP server supports completion, lsp-mode use symbols returned by the server to present the user when completion is triggered via completion-at-point.

For better performance and results, use company-capf by installing company-mode.

You can check above the recommended settings for company-mode:

(setq company-minimum-prefix-length 1
      company-idle-delay 0.0) ;; default is 0.2

Code navigation#



Code lens#

In case the LSP server supports code lens:

Project errors on modeline#

To see all error statistics in the modeline you can enable lsp-modeline-diagnostics-mode or (setq lsp-modeline-diagnostics-enable t). This is especially useful for languages that compilation might be broken due to errors in other files(e.g. Java/Haskell).

(with-eval-after-load 'lsp-mode
  ;; :global/:workspace/:file
  (setq lsp-modeline-diagnostics-scope :workspace))

Tip: To find out the global errors you might use lsp-treemacs-errors-list.

Code actions on modeline#

For a UI feedback of the available code actions, you can enable lsp-modeline-code-actions-mode which shows available code actions on modeline:

With lsp-modeline-code-actions-segments you can customize what to show on the modeline as you want:

lsp-modeline-code-actions-segments result
'(count icon) (Default)
'(name icon)
'(count icon name)

For a UI feedback on headerline of the document symbols at point, current file or project name, you can enable lsp-headerline-breadcrumb-mode which shows a breadcrumb on top of window.

You can customize the breadcrumb segments via lsp-headerline-breadcrumb-segments variable, some examples:

lsp-headerline-breadcrumb-segments result
'(path-up-to-project file symbols) (Default)
'(project file symbols)

If lsp-headerline-breadcrumb-segments contains 'symbols, you can optionally label the corresponding entries in the headerline display by setting lsp-headerline-breadcrumb-enable-symbol-numbers to t.

Symbol highlights#

In case LSP server supports hover feature:


In general the formatter settings are language server specific(e. g. JDT LS uses eclipse formatter file and lsp-java-format-settings-url to configure it while clangd uses clangd-format and lsp-dart uses the built-in dartfmt from Dart SDK). The only settings that are controlled on lsp-mode level are indent size and whether the server should use tabs or spaces.

  • Use c-basic-offset for cc-mode derived moves(e. g. java, C++) to control the tab size.
  • Use tab-width for any other mode to do the same.
  • Use indent-tabs-mode for selecting tab/spaces.


lsp-mode integrates with dap-mode with implements the DAP(Debugger Adapter Protocol), for more information check the dap-mode documentation.


lsp-mode supports many integrations for improve the user experience like treemacs, Helm, Ivy and others.

For all available integrations, check the Extensions section on the left navigation.

Last update: January 16, 2021