#+TITLE: Projects #+AUTHOR: Christopher James Hayward #+EMAIL: chris@chrishayward.xyz #+PROPERTY: header-args:emacs-lisp :tangle projects.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 #+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[../docs/images/2021-02-13-example-ccls.gif]] An *IDE*[fn:1] like experience or better can be achieved within Emacs using two *Microsoft*[fn:2] open-source initiatives: + *Debug Adapter Protocol*[fn:3] + *Language Server Protocol*[fn:4] * Code snippets #+begin_src emacs-lisp (use-package yasnippet :ensure t) #+end_src * Debug adapters *Dap mode*[fn:5] provides support for the *Debug Adapter Protocol*[fn:3] inside of Emacs. #+begin_src emacs-lisp (use-package dap-mode :commands (dap-debug)) #+end_src * Language servers Support for the *Language Server Protocol*[fn:4] is added to Emacs through the *Lsp mode*[fn:6] package. #+begin_src emacs-lisp (use-package lsp-mode :commands (lsp lsp-deferred) :custom (lsp-idle-delay (* 5 dotfiles/idle)) (lsp-prefer-flymake t)) #+end_src ** UI integration *Lsp ui*[fn:7] provides user interface improvements for *Lsp mode*[fn:6]. #+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 via *Company*[fn:8] =AKA= *Complete Anything*. #+begin_src emacs-lisp (use-package company :after lsp) #+end_src Integrate with *Lsp mode*[fn:6] to provide completion candidates through the *Language Server Protocol*[fn:4]. + Specify the repository + Use asynchronous completion #+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 * Docker containers Manage *Docker*[fn:9] containers with *Docker.el*[fn:10]. #+begin_src emacs-lisp (use-package docker :commands (docker)) #+end_src Open the container management screen with =SPC k=. #+begin_src emacs-lisp (dotfiles/leader "k" '(docker :which-key "Docker")) #+end_src * Project management Configure *Projectile*[fn:11], a project interaction library for Emacs. It provides a nice set of features for operating on a project level without introducing external dependencies. #+begin_src emacs-lisp (use-package projectile :custom (projectile-project-search-path '("~/.local/source")) :config (projectile-mode)) #+end_src * Footnotes [fn:1] https://en.wikipedia.org/wiki/Integrated_development_environment [fn:2] https://en.wikipedia.org/wiki/Microsoft_and_open_source [fn:3] https://microsoft.github.io/debug-adapter-protocol [fn:4] https://microsoft.github.io/language-server-protocol [fn:5] https://emacs-lsp.github.io/dap-mode/ [fn:6] https://emacs-lsp.github.io/lsp-mode/ [fn:7] https://emacs-lsp.github.io/lsp-ui/ [fn:8] https://company-mode.github.io/ [fn:9] https://docker.com [fn:10] https://github.com/Silex/docker.el [fn:11] https://projectile.mx [fn:12] https://git.zx2c4.com/password-store/tree/contrib/emacs [fn:13] https://passwordstore.org