Contextual company-dabbrev? #1372
Replies: 1 comment
-
Hi! We have two existing algorithms for such "smarter" sorting, both work through the user option
https://github.com/company-mode/company-statistics provides its own transformer, which remembers which of the completions have been most used historically. Your proposed scheme seems like a more complex (and specific) twist on the first one. It shouldn't be too hard to take the definition of |
Beta Was this translation helpful? Give feedback.
-
Thanks to the team for maintaining
company-mode
. While usingcompany-dabbrev
to write plain text, I often have to scroll through the suggestions.Here is an example from Polish, where both adjectives and nouns decline for case: after "mój komp" (my comp...), I can get the suggestions
[komputer][komputera][komputerowi]
. The first one is correct. After "mojemu komp" (to my comp...), I would get the same three suggestions. This time, the third one is correct. The same principle works e.g. for adjectives or nouns that follow prepositions since prepositions force them to be in specific cases.With a bit of context-sensitivity, fewer keystrokes would be necessary.
If I understand it right,
company-mode
could pass the current position to the backends. Then,company-dabbrev
could find, for each suggestion, say up to three words preceding its occurrences. The user could be presented first the suggestions that have the most preceding words equal to the words preceding the current position. I would propose to limit the match to three words to take into account standard phrases of the type "foo and the ..."Thank you for reading. I hope that my explanation can be understood.
Beta Was this translation helpful? Give feedback.
All reactions