Nikita Bloshchanevich
Nikita Bloshchanevich
As a side note, `clangd` supports `UTF-8` directly, if a special option is specified.
[Here](https://clangd.llvm.org/extensions.html#utf-8-offsets) is the relevant source. @matklad I agree that this would be great, since many servers/editors/libraries assume UTF-8 (well, everything aside from VSCode and JavaScript). There is an upstream bug...
@aldanor how about source code that is generated as part of the build process and can as such change any time? However, this might be more of an edge-case, and...
```emacs-lisp (defun my/complete-cl-file () (interactive) (when (and (save-excursion (looking-back "#p" (- (point) 2))) (not (looking-at-p "\""))) (insert "\"./") (save-excursion (insert "\"")) (company-files 'interactive) t)) (advice-add '+company/complete :before-until #'my/complete-cl-file) ``` will...
```emacs-lisp (defun my/complete-cl-file (action) (interactive (list 'interactive)) (when (and (save-excursion (looking-back "#p" (- (point) 2))) (not (looking-at-p "\""))) (insert "\"./") (save-excursion (insert "\"")) (company-files action))) ``` should work as a...
The final version, which now actually works as a company backend and works in `#p"|"`. ```emacs-lisp (defcustom my/complete-cl-file-prefix "./" "Prefix for `my/complete-cl-file'." :type 'string) (defun my/complete-cl-file (action &rest _) (interactive...
You'll also need to add `company-files` to your company backends.
```emacs-lisp (defun my/complete-cl-file (action &rest _) (interactive (list 'interactive)) (cl-case action (interactive (company-begin-backend #'my/complete-cl-file)) (candidates (cond ((and (save-match-data (looking-back "#p" (- (point) 2)))) (if (looking-at-p "\"") (forward-char) (insert "\"") (save-excursion...
@Ambrevar this won't be that easy, unless there is a `completion-at-point` `company-files` equivalent.