https://github.com/daviwil/emacs-from-scratch
- Documentation: https://emacs-lsp.github.io/lsp-mode/
- Supported language servers: https://emacs-lsp.github.io/lsp-mode/page/languages/
(use-package lsp-mode
:commands (lsp lsp-deferred)
:init
(setq lsp-keymap-prefix "C-c l") ;; Or 'C-l', 's-l'
:config
(lsp-enable-which-key-integration t))
completion-at-point
for completions- Signatures when writing methods (
C-n
,C-p
to cycle signatures)
lsp-find-definition
:C-c l g r
lsp-find-references
:C-c l g g
lsp-rename
:C-c l r r
flymake-show-diagnostics-buffer
to show diagnostics
lsp-format-buffer
:C-c l =
==
Configure formatting options for some languages with lsp-<language>-format-
variables
(defun efs/lsp-mode-setup ()
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode))
:hook (lsp-mode . efs/lsp-mode-setup)
(use-package company
:after lsp-mode
:hook (prog-mode . company-mode)
:bind (:map company-active-map
("<tab>" . company-complete-selection))
(:map lsp-mode-map
("<tab>" . company-indent-or-complete-common))
:custom
(company-minimum-prefix-length 1)
(company-idle-delay 0.0))
(use-package company-box
:hook (company-mode . company-box-mode))
Documentation: https://emacs-lsp.github.io/lsp-ui/
(use-package lsp-ui
:hook (lsp-mode . lsp-ui-mode))
lsp-ui-doc-focus-frame
to enter the documentation frame to navigate and search aroundlsp-ui-doc-unfocus-frame
to leave documentation frame
(setq lsp-ui-doc-position 'bottom)
Configuration options: https://emacs-lsp.github.io/lsp-ui/#lsp-ui-sideline
(setq lsp-ui-sideline-enable nil)
(setq lsp-ui-sideline-show-hover nil)
lsp-ui-peek-find-references
to show references inline (M-n
,M-p
to cycle)
Provides an even nicer UI on top of lsp-mode using Treemacs
lsp-treemacs-symbols
- Show a tree view of the symbols in the current filelsp-treemacs-references
- Show a tree view for the references of the symbol under the cursorlsp-treemacs-error-list
- Show a tree view for the diagnostic messages in the project
(use-package lsp-treemacs
:after lsp)
(use-package lsp-ivy)
(use-package typescript-mode
:mode "\\.ts\\'"
:hook (typescript-mode . lsp-deferred)
:config
(setq typescript-indent-level 2))
Install the typescript-language-server
:
npm install -g typescript-language-server
Install the ccls
language server.
M-;
does comment, but the behavior sometimes isn’t exactly what you’d expect.
https://github.com/redguardtoo/evil-nerd-commenter
(use-package evil-nerd-commenter
:bind ("M-/" . evilnc-comment-or-uncomment-lines))
- dap-mode for debugging
- yasnippet
- running compilers and unit test tools
- language-specific videos