plantuml-mode
plantuml-mode copied to clipboard
Adding completion-at-point support (company-capf)
Is it possible to add completion-at-point
support for plantuml? Or is this already implemented and I was just not able to get it working?
Looks like this should work, not really sure if this is the right way to implement it (taken from https://emacs.stackexchange.com/a/15277/19819, https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-in-Buffers.html and elisp-mode.el):
(defun my-plantuml-completion-at-point ()
"Function used for `completion-at-point-functions' in `plantuml-mode'."
(let ((completion-ignore-case t) ; Not working for company-capf.
(bounds (bounds-of-thing-at-point 'symbol))
(keywords plantuml-kwdList))
(when (and bounds keywords)
(list (car bounds)
(cdr bounds)
keywords
:exclusve 'no
:company-docsig #'identity))))
Then add a hook on mode init, should be added to (define-derived-mode plantuml-mode prog-mode "plantuml" ...
:
(add-hook 'completion-at-point-functions
#'plantuml-completion-at-point nil 'local)
Then completion-at-point
is supported in plantuml-mode. And this also makes company-capf
work:
For some reason ignoring case with my solution works with completion-at-point
but company stays case-sensitive unless using (setq-local completion-ignore-case t)
.