How to change the display of newline character in candidates ? #1206
-
Hello, I tried the following code, but (defun company-test (command &rest args)
(interactive (list 'interactive))
(cl-case command
(interactive (company-begin-backend 'company-test))
(prefix '("T" . t))
(candidates (list (concat "AB" (propertize "E" 'display "¬") "CD") ;; display property works.
(concat "AB" (propertize "\\n" 'display "¬") "CD") ;; display property works.
(concat "AB" (propertize "\n" 'display "¬") "CD") ;; display property not working :(
(concat (propertize "A\n" 'display "A¬B¬C") ))))) ;; display property not working :( This is the story. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
First of all, there is an existing backend https://github.com/TommyX12/company-tabnine. Are you doing something different? |
Beta Was this translation helpful? Give feedback.
-
Second: company-mode does not support non-printable characters in completion strings, including newlines. There is no good way to show them in the popup. Hence the character Instead of trying to use a display property (this will not work; You can add some text property on each strings which would store the original, and then use those values in |
Beta Was this translation helpful? Give feedback.
Second: company-mode does not support non-printable characters in completion strings, including newlines. There is no good way to show them in the popup. Hence the character
?
that replaces them.Instead of trying to use a display property (this will not work;
display
is used for rendering the overlay popup, the property is overridden), return modified strings which do not contain any unsupported characters.You can add some text property on each strings which would store the original, and then use those values in
post-completion
to insert the full string.