I showed you my source code, pls respond
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#+TITLE: Language Server Protocol #+AUTHOR: Christopher James Hayward #+EMAIL: chris@chrishayward.xyz
#+PROPERTY: header-args:emacs-lisp :tangle lsp.el :comments org #+PROPERTY: header-args:shell :tangle no #+PROPERTY: header-args :results silent :eval no-export :comments org
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
The Language Server Protocol (LSP) defines the protocol used between an editor, or IDE, and a language server that provides language features like auto-complete, go-to-definition, find-all-references, etc[fn:1]
* Config
Support for the Language Server Protocol[fn:1] is available through the ~lsp-mode~[fn:2] package. Configure an immutable delay of =.5= to ensure it doesn't attack the current language server and overload it with requests.
#+begin_src emacs-lisp (use-package lsp-mode :commands (lsp lsp-deferred) :custom (lsp-idle-delay 0.5) (lsp-prefer-flymake t)) #+end_src
** Code snippets
Download ~yasnippet~[fn:4], used by a number of ~lsp-mode~[fn:2] extensions to provide smart completion functionality.
#+begin_src emacs-lisp (use-package yasnippet :ensure t) #+end_src
** UI integration
Download ~lsp-ui~[fn:3] to provide user interface improvements for ~lsp-mode~[fn:2] over the defaults.
#+begin_src emacs-lisp (use-package lsp-ui :after lsp :custom (lsp-ui-doc-position 'at-point) (lsp-ui-doc-delay 0.500)) #+end_src
** Code completion
Text completion provided by ~company~[fn:5], AKA Complete Anything. Make sure it's integrated with ~lsp-mode~[fn:2] to provide completion candidates through the Language Server Protocol[fn:1].
#+begin_src emacs-lisp (use-package company :after lsp) #+end_src
Specify the repository for ~company-lsp~ using straight to make sure we're getting the most recent version from GitHub, instead of the typically outdated versions in the Emacs package repositories.
#+begin_src emacs-lisp (use-package company-lsp :after (lsp company) :custom (company-lsp-async t) (company-backend 'company-lsp) :straight (company-lsp :type git :host github :repo "tigersoldier/company-lsp")) #+end_src
* Footnotes
[fn:1] https://microsoft.github.io/language-server-protocol/
[fn:2] https://emacs-lsp.github.io/lsp-mode/
[fn:3] https://emacs-lsp.github.io/lsp-ui/
[fn:4] https://github.com/joaotavora/yasnippet
[fn:5] https://company-mode.github.io/
|