48 lines
2.7 KiB
Org Mode
48 lines
2.7 KiB
Org Mode
:PROPERTIES:
|
|
:ID: cce/company_code_completion
|
|
:END:
|
|
#+TITLE: Company Mode Code Completion
|
|
#+filetags: :Emacs:CCE:Coding:
|
|
#+PROPERTY: header-args :mkdirp yes :results none
|
|
#+PROPERTY: header-args:emacs-lisp :tangle company.el
|
|
#+ARROYO_EMACS_MODULE: company
|
|
#+ARCOLOGY_KEY: cce/company
|
|
#+ARCOLOGY_ALLOW_CRAWL: t
|
|
|
|
#+begin_src emacs-lisp
|
|
(provide 'cce/company)
|
|
#+end_src
|
|
|
|
Code Completion is an incredible tool to have at your disposal when done nicely. When done nicely, I should be able to hit =<TAB>= to get a dropdown under my cursor with a list of options. Those options are popuplated by programming language tooling or by matching against a list of entries. Completion should be ubiquitous and useful, and should provide as much context as possible. In particular, programming language auto-completion should provide as much data about the completion target, what module it is, or what its type signature is, or the inline documentation if it's short enough. Given a language with a strong enough type system like Rust, it should be possible to intuit even templated types.
|
|
|
|
My current completion system is far from this, and so I am going back to the first-party recommended configuration for much of this, designed to integrate with [[id:cce/evil_mode][Evil Mode]] and the [[https://company-mode.github.io/][Company completion framework]]. By default, company supports auto-completion for Emacs Lisp, =etags= and =gtags=, Clang, etc, and it can also be extended by languages, and the Emacs Modes themselves using [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-in-Buffers.html][Completion at Point Functions]].
|
|
|
|
But what I care about is this:
|
|
- [[id:cce/yasnippets][Yasnippets]]
|
|
- Emoji
|
|
- [[id:cce/emacs_and_the_language_server_protocol][LSP]]
|
|
- Ruby [[[id:cce/ruby_and_rails_in_emacs][Ruby and Rails in Emacs]]]
|
|
- Dabbreviations - =company-dabbrev-code company-dabbrev=
|
|
|
|
These require no work so I include them by default.
|
|
- Completion at Point Functions
|
|
- Keyword Matching
|
|
- Ispell
|
|
- Emacs Lisp
|
|
|
|
These four combined give me basic completion in all buffers, based on words in those buffers (and the dictionary in text-mode), as well as Emacs Lisp. Everything else is defined in those files linked above.
|
|
|
|
#+begin_src emacs-lisp
|
|
(use-package company
|
|
:diminish
|
|
:config
|
|
(setq company-backends '(company-capf company-files company-ispell company-elisp company-keywords))
|
|
(setq-default completion-at-point-functions nil)
|
|
(global-company-mode)
|
|
:bind (:map prog-mode-map ("<tab>" . company-complete))
|
|
:bind ("C-<tab>" . company-complete))
|
|
(use-package company-prescient :init (company-prescient-mode +1))
|
|
#+END_SRC
|
|
#+ARROYO_MODULE_WANTS: cce/selectrum_etc.org
|
|
#+ARROYO_MODULE_WANTS: cce/diminish.org
|