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
For the traditional completion popup, install company-mode.
You can check above the recommended settings for
(setq company-minimum-prefix-length 1 company-idle-delay 0.0) ;; default is 0.2
In case the LSP server supports code lens:
Project errors on modeline#
To see all error statistics in the modeline you can enable
(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
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:
lsp-modeline-code-actions-segments you can customize what to show on the modeline as you want:
Breadcrumb on headerline#
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:
'symbols, you can optionally label the corresponding entries in the headerline display by setting
In case LSP server supports
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
lsp-dart uses the built-in
Dart SDK). The only settings that are controlled on
lsp-mode level are indent size and whether the server should use tabs or spaces. Refer to
lsp--formatting-indent-alist to find out what is the variable that is used for the current major mode.
Some language servers, e.g. for C++, Java, etc, can format code as you type and
the formatting is triggered when the corresponding character is
RET). This behaviour is controlled via
lsp-enable-on-type-formatting and it is enabled by default.
For all available integrations, check the
Extensions section on the left navigation.