LSP Mode

about | blog | config | notes | github

1. Emacs Client for the Language Server Protocol

lsp-mode enables GNU/Emacs to have support for the language server protocol for various programming languages.

2. Configuration

2.1. Setup Dependencies

While these are optional, it is nice to have integration for a couple things like Flycheck Syntax Checking, Company Autocompletion System, and which-key integration.

(require 'init-flycheck)
(require 'init-company)
(require 'init-which-key)

2.2. Package Install

Install the package and setup lsp-mode.

(use-package lsp-mode)

2.3. Inrease Read Process Size

By default, we can only read 4k at a time, but lsp servers responses are typically much much larger.

(setq read-process-output-max (* 1024 1024))

2.4. Setup Hooks

First let's make sure which-key is configured properly for lsp-mode.

(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)

Setup generic support for lsp-mode in all prog-mode.

(add-hook 'lsp-mode-hook #'lsp)

2.5. Feature Provide

(provide 'init-lsp-mode)

Created: 2021-11-13

Emacs 26.1 (Org mode 9.5)