bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16334: 24.3.50; company-capf eats the first char in IELM filename co


From: Stefan Monnier
Subject: bug#16334: 24.3.50; company-capf eats the first char in IELM filename completions
Date: Mon, 06 Jan 2014 10:23:16 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>>> `completion-file-name-table' is more of an exception, I think.  But if
>>> it was only passed the segment of STRING after the last path
>>> separator, it could still look behind it in the buffer and see the
>>> full path.
>> But the completion may actually want to *change* the text before
>> the boundary.  E.g. completion of /u/s/d to /usr/share/doc.
> In that case, "/usr/share/doc" is the completion candidate, not "doc",
> right?

Not sure what you mean by "completion candidate":

try-completion and all-completions will both return nil because there's
no "/u/s" directory.  Assuming we use partial-completion style,
completion-try-completion should return "/usr/share/doc" and
completion-all-completions should return ("usr/share/doc"), i.e. without
the leading "/".  If we had started from "/usr/s/d" the results would
have been the same except completion-all-completions would return
("share/doc").

> To be clear, I'm not convinced that the notion of "sub-fields" is
> useful. Defining limits to the text that can be affected by completion only
> looks good to me from the presentation point of view: if the candidate
> strings can be shorter, we can show more of them in the *Candidates* buffer,
> whereas it's less useful for popup-style UIs where the candidates are
> displayed vertically anyway.

Then just have company-capf check completion-boundaries and concat the
missing prefix to every element returned by all-completions.

> IOW, if I were to add a `boundaries' action to company-backends API, it
> would only be used for presentation: the popup will cut off that many
> characters from the candidate strings, and it will be rendered that many
> columns to the right.

If you want to let Company provide completion styles like
partial-completion you'll need some additional info about "subfields".
But as long as you limit yourself to prefix or substring completion you
don't need that.

> Come to think of it, though, this new action may be incompatible with the
> notion of merged backends. If we have candidates that come from backends
> that return the same prefix but different boundaries, there's no way to
> reflect the boundaries in the popup.

Yup.  Just like you have a problem when the start/end of the
completion text is not identical.  E.g. you could have a "word" backend
and a "varname" backend, and you type "my_fanc" and now the "word"
backend wants to complete "fanc" whereas the varname backend wants to
complete "my_fanc".


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]