Closed wsdjeg closed 8 years ago
@artur-shaik i think maybe you kown what i want,i have read you vimrc,but i can not find the related configration
let g:ycm_semantic_triggers = { \ 'c' : ['->', '.'], \ 'objc' : ['->', '.'], \ 'ocaml' : ['.', '#'], \ 'cpp,objcpp' : ['->', '.', '::'], \ 'perl' : ['->'], \ 'php' : ['->', '::'], \ 'cs,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'], \ 'java,jsp' : ['.'], \ 'vim' : ['re![_a-zA-Z]+[_\w]*\.'], \ 'ruby' : ['.', '::'], \ 'lua' : ['.', ':'], \ 'erlang' : [':'], \ }
This doesn't seems relevant to the question.
You're talking about java code for which we don't provide a native semantic engine so you have to rely on some vimscript omnifunc. When we call the omnifunc for you (after a .
in this example) then we are able to handle the normal behaviour of YCM and provide fuzzy search of the candidates. When you type <C-Space>
to force completion then we simply do <C-X><C-O><C-P>
which means that in this particular case all we do is call the vim omnifunc and there is no way for us to provide the same experience. Closing since this is not a YCM bug but a vim limitation more than everything. If I misunderstood something we can always reopen this.
i have understand what you mean,thank you ,you mean after '.' YCM no only call omnifunc ,but also provide some fuzzy search,but c-space only call omni,just like type c-x c-o c-p
This is an interesting case: use YCM's OmniCompleter
instead of just invoking omnicompletion when hitting the g:ycm_key_invoke_completion
sequence in non-semantic supported files.
The use-case seems would be likely most useful when using something like eclim
in combination with YCM, or, say another plugging providing a useful omnifunc (e.g. the one that currently works for racer
, etc.).
Sounds fiddly to implement and probably rather niche. FWIW I believe we'd have to map the trigger to something like <C-R>=youcompleteme#InvokeOmniCompleter()<CR>
and then have some way to force CreateCompletionRequest
to ask the omni-completer. All very messy I think.
All very messy I think.
@puremourning I believe that is why is the way it is currently :)
Hah yes. Well I was bored (it's Sunday and it's dark and cold), so I have made a prototype of this and it isn't anywhere near as ugly as I thought. I'll post a demo in a bit, see what you all think.
@puremourning :+1:
OK It took me longer than I expected. It was working very nicely, except it didn't work for any of my supposed use cases (specifically: eclim and vim-racer). Joy. Anyway that turned out to be a sort-of-bug in YCM in the way it interacts with the omnifunc
. It's quite detailed, so I'll spare you the explanation for now, but here's a quick demo using eclim (for java) and vim-racer (for rust).
In each test I type some stuff like Sys
and f
then hit <C-Space>
. I think use YCM's word-boundary-chars fuzzy search to narrow down the list.
It's not perfect as the initial query string must be a real prefix, but interested in thoughts.
@puremourning so let's say that you don't type anything and press <C-Space>
it would then provide fuzzy search?
yes, sort of. Actually, the g:ycm_cache_omnifunc
sort of gets in the way of this - it doesn't re-query each time i don't think. I haven't looked into it much yet.
I've pushed the code here: https://github.com/puremourning/YouCompleteMe/tree/force-omni-completer
note - it's really just a prototype/hack at the moment, so please don't think less of me if it is ugly and poorly tested :grin:
it is very strange why javacomplete cannot do that,it is the func of ycm or eclim
@vheon actually, it seems to work. I tried it with the problematic php completer:
@wsdjeg The demo above is with some changes to YCM. I haven't used javacomplete
, but you're welcome to check out my branch and see if it works for you.
greate,i hope this for a long time ,and i will check it tonoght,if it works well,i think most omnifunc will be nicer,such as origin html xml omnifuc
gave it a quick test - seems to work with javacomplete2.
greate,i think @artur-shaik will be glad to hear this!
@puremourning nice work. Thank you. @wsdjeg thank you for mention.
@artur-shaik @puremourning i have check this branch,for java html xml js css and any other vim origin omnifunc ,it works very well,but still has some issue! for example
BackSpace
here is out put for Sys
then i type t
or any other char will get nothilng but then i type backspace
type t
again, will get this
maybe first time get result but second time will not
you can try with type any char and type backspace
and type this char again
here is javacomplete OUT PUT OF C-X C-O
and here is YCM
because YCM donot check @
the output just same as Ove
after @Override
both words well and both of ycm and javacomplet can not search ,just need tpye c-n or c-p to select what i want.
MAYBE THIS IS THE FEAUTURE OF JAVACOMPLETE2
Thanks for testing
I think it is because YCM doesn't consider @ to be an identifier character, though I thought thought my branch would use the omnifunc decision about that. Probably YCM internals. I'll look when inhale some time.
thank you
Well, this particular problem with javacomplete and @
symbols in completions is quite difficult to fit into YCM's ethos. I had a go, but unfortunately couldn't find a simple solution. Maybe I will look more, but no promises, as even if I get it to work, the other devs. might not love the solution :grin:
yes how about iusse with backspace
hi @Valloric i have add this to my vimrc
so afte '.',the completion words will,also i do not type every char of the string. for example if i want get
finalize()
i just need to type fz but in this caseafter
Sys
i start the completion manually by type<c-space>
get this result if i want SystemTray i need to type every char of this string,i hope just type less char to get the result i wantted