Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable general identifier-based completion but not UltiSnips #872

Closed
felixjung opened this issue Mar 7, 2014 · 20 comments
Closed

Disable general identifier-based completion but not UltiSnips #872

felixjung opened this issue Mar 7, 2014 · 20 comments
Labels
PR Welcome A good quality PR for this feature would be considered.

Comments

@felixjung
Copy link

Hi,

I work a lot with LaTeX. Obviously having YCM's identifier-based completion turned on gets quite annoying, just as it would with markdown. From the YCM help I gather that setting g:ycm_min_num_of_chars_for_completion to something high like 100 in an autocmd for tex will practically disable the identifier-based completion. However, I've noticed that in this case the YCM pop-up will no longer work for UltiSnips snippets either. Is there a way to disable the popup for standard identifier-based completion but not snippets?

Thanks

@Valloric
Copy link
Member

Valloric commented Mar 8, 2014

Is there a way to disable the popup for standard identifier-based completion but not snippets?

Not currently, but there should be. Related to #708; there should be a way to choose the components that go into the identifier completion.

@felixjung
Copy link
Author

Cool. Thanks for developing YCM.

@ccll
Copy link

ccll commented Apr 22, 2014

+1
In my case the identifier based completion interferes with the semantic completion.
For example when I enter these for the first time:

printf...

The completion menu shows the signature of printf correctly.
But then I type printf again in somewhere else in the same file, the completion item poped up is a identifier based one, only a word is shown and no function signature.

@oblitum
Copy link
Contributor

oblitum commented Apr 22, 2014

@ccll How? semantic completion for me only shows up through a semantic completion trigger or forced with ctrl+space, it never shows up just by typing letters.

@ccll
Copy link

ccll commented Apr 23, 2014

How? semantic completion for me only shows up through a semantic completion trigger or forced with ctrl+space, it never shows up just by typing letters.

I don't know, when I press 'p' in printf, it just pops up semantic completion instead of identifier based one (of cause only for the first time according to my previous post).
I'm using spf13-vim configuration, it comes with YCM support (with ultisnips and vim-snippets) but is disabled by default. After I enable YCM manually, I got this behavior.
So it might be something wrong in spf13-vim? I'll check that later, thanks for the tip!

@felixjung
Copy link
Author

Any news on this?

@wwwdata
Copy link

wwwdata commented Jul 31, 2014

+1 from me too. I am using this awesome plugin with gocode completion. It works really nice but I would also like to disable the identifier based completion.

@rejozenger
Copy link

+1 from me too. Use case: I am using UltiSnips with a considerable amount of snippets when writing e-mail. I'd like to have YCM suggest me snippets, but no other things.

@sanjayankur31
Copy link

Another LaTeX user here - this would be really useful! 👍

:)

@kwrobert
Copy link

Was just trying to accomplish this exact thing, and stumbled upon this issue. Would love to have only snippet completions, and no identifier based completions or semantic completions when writing Latex and markdown notes.

@hbodas
Copy link

hbodas commented Aug 5, 2018

Any news on this? Was looking for something similar and stumbled upon this report

@Astrantia
Copy link

Astrantia commented Dec 3, 2018

@Valloric Is this still not possible? :(
Does it require a lot of effort to implement this considering the issue was opened in 2014 and now it's almost 2019?

@ghosty141
Copy link

Does #1114 (comment) solve this?

@puremourning
Copy link
Member

I doubt it. But I don’t really know what you mean by ‘solve’. You can disable auto trigger, but then you would never get ultisnips suggestions.

@puremourning
Copy link
Member

While I personally think this isn't a good idea, it seems to have some support. Leaving this open, but the core team are unlikely to spend any effort on it.

@puremourning puremourning added the PR Welcome A good quality PR for this feature would be considered. label Jan 4, 2020
@rudolf-adamkovic
Copy link

rudolf-adamkovic commented Mar 31, 2021

Fellow LaTeX sufferers! Here is what I came up with today:

let g:ycm_min_num_of_chars_for_completion = 1

let g:ycm_min_num_of_chars_for_completion_enabled = g:ycm_min_num_of_chars_for_completion
let g:ycm_min_num_of_chars_for_completion_disabled = 999

function FixLaTeXCompletion()
  if &ft == 'tex' && g:ycm_min_num_of_chars_for_completion != g:ycm_min_num_of_chars_for_completion_disabled
    let g:ycm_min_num_of_chars_for_completion = g:ycm_min_num_of_chars_for_completion_disabled
    YcmRestartServer
  endif
  if &ft != 'tex' && g:ycm_min_num_of_chars_for_completion == g:ycm_min_num_of_chars_for_completion_disabled
    let g:ycm_min_num_of_chars_for_completion = g:ycm_min_num_of_chars_for_completion_enabled
    YcmRestartServer
  endif
endfunction

augroup tex_ycm
  autocmd!

  " Connect VimTeX and YouCompleteMe.
  " Taken from |:help vimtex-complete-youcompleteme|.
  autocmd VimEnter * let g:ycm_semantic_triggers.tex=g:vimtex#re#youcompleteme

  " Make YouCompleteMe *not* suggest identifiers in TeX documents.
  " References:
  " 1. |:help g:ycm_min_num_of_chars_for_completion|
  " 2. https://github.com/ycm-core/YouCompleteMe/issues/872
  autocmd BufEnter * call FixLaTeXCompletion()
augroup end

@rionda
Copy link
Contributor

rionda commented Nov 14, 2021

If trying the above you get a E492: Not an editor command: YcmRestartServer message, add normal! before the calls to YcmRestartServer.

@rudolf-adamkovic
Copy link

@rionda I moved from Vim to Emacs 7 months ago.

@puremourning
Copy link
Member

I can't see. us implementing this unless someone from the community contributes a PR for this.

@uthpalaherath
Copy link

@salutis your suggestion is a Godsend! It's been what I've been looking for for months! Every Vim-Latex user would definitely find it useful.

Thanks again!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR Welcome A good quality PR for this feature would be considered.
Projects
None yet
Development

No branches or pull requests