Closed clason closed 4 years ago
@clason
I've updated #391 to use filterText
, if available.
For texlab, I think the newly added contains
filter is appropriate?
Config:
'config': { 'filter': { 'name': 'contains' } }
Test with texlab:
Looks good! For some reason, I can't get it to work with ncm2-vim-lsp
autocomplete, but omnicomplete works as advertised.
(I think the problem is that ncm2-vim-lsp
has the trigger
pattern hardcoded -- I should probably look into replacing that. Maintenance has stalled a bit, unfortunately -- not that I'm complaining, I should rather make pull requests.)
I think ncm2-vim-lsp
sends and handles completion requests itself. Maybe ncm2
can call lsp#complete
instead to get its completion items? (Things may be a little more complicated once #391 is merged, though, since lsp#omni#complete
doesn't directly return completion items anymore.)
I'll have to look into it. @roxma seems to be busy with real life currently, and so ncm2
development has stalled a bit (this issue looks like it coincides with https://github.com/ncm2/ncm2-vim-lsp/issues/6). As long as #391 does not break the current completion functionality (which it doesn't seem to), it's not critical.
(If you're familiar with ncm2
, what would a post-#391 source look like, roughly?)
I haven't used ncm2
, so I'm not familiar with how it works. But I suppose what we should do in vim-lsp
is have a function that returns the completion items, which the ncm2
source can then call. (That is, assuming a ncm2
source has enough information with that list).
Internally, we will also call that function, but display the completions ourselves with complete()
.
Essentially, it's just splitting up the filtering logic and display logic so external plugins can just use the filtering and handle display themselves.
No problem, I was just curious. Are you using any autocomplete plugin?
ncm2
sources have an on_complete
field that takes a completion function (such as complete#omnifunc
), so that should work, yes.
I'm still not sure whether I prefer manual or automatic completion popup.
At the moment, I find the automatic popup a little too distracting, so I just got in the habit of <C-x><C-o>
'ing, but that may change in the future.
As for ncm2
, I don't think it officially supports Vim, so that's why I'm a bit reluctant to include it in my setup.
Fair enough; I do find it useful since it shows me the available candidates which I can then filter interactively (with minimal typing) to get the wanted candidate to within one or three keystrokes of selecting (hence my interest in filtering). (It does support vim using vim-hug-neovim-rpc
, but you're right that it's a second-class citizen -- the same goes for deoplete
, which would be the alternative.)
@clason Could you please try https://github.com/prabirshrestha/vim-lsp/pull/391 ?
@mattn Doesn't work fully for me -- see comment at #391.
According to the LSP specification, if a server response to a completion request contains a
filterText
field, this should be used for filtering instead of thelabel
. (E.g., if completion is triggered onfoo
and the server returns a completion item withthe list of completions should contain
bar
.