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

Python2 branch does not work when signature help disabled. #3595

Closed
mvanderkamp opened this issue Feb 10, 2020 · 16 comments
Closed

Python2 branch does not work when signature help disabled. #3595

mvanderkamp opened this issue Feb 10, 2020 · 16 comments

Comments

@mvanderkamp
Copy link

mvanderkamp commented Feb 10, 2020

I have to use python 2 still. The legacy support branch is not working.

@mvanderkamp
Copy link
Author

mvanderkamp commented Feb 10, 2020

Sorry about the curt issue. Normally when an issue like this arises I just checkout the commit before the issue occurred and keep working, waiting until a fix comes in and then go back to the proper branch. But git can't find anything except the tip of the branch for some reason, and vim-plug can't even find the legacy branch.

@puremourning
Copy link
Member

puremourning commented Feb 10, 2020

The steps to use the legacy py2 branch are:

  • git fetch origin
  • git checkout legacy-py2
  • git submodule update --init --recursive
  • ./install.py <options>

If you have a shallow clone then that's not going to work. NOTE: vim-plug creates shallow clones by default, so it likely won't work. Please consult vim-plug documentation to resolve this. YCM maintainers do not provide support for plugin managers.


I'm sorry that you frustrated. We did announce this change would happen quite some time ago. And we mantain the legacy branch precisely for the reason that we realise some users can't (or won't) adopt python3.

Anyway, could you please list the exact steps you took to checkout the legacy py2 branch ?

Also, would you please describe the exact problem you are actually seeing ?

As a polite reminder, before responding further, please read CONTRIBUTING.md and CODE_OF_CONDUCT.md.

@puremourning
Copy link
Member

For the record, i just followed the above steps, and things worked OK even with a python2-enabled vim, so i'm confident that it is not 'borked', and that the issue is with your installation.

@puremourning puremourning changed the title Legacy support for python 2 is borked How do I use the legacy Python 2 branch? Feb 10, 2020
@puremourning puremourning pinned this issue Feb 10, 2020
@mvanderkamp
Copy link
Author

Yes I'm sorry for my approach to filing this issue, it was probably a bit rude.

Is there a way to revert to the state of the repo from before the weekend? Everything worked fine then. But git can't find the commit tree.

I normally install using vim-plug:
Plug 'ycm-core/YouCompleteMe', { 'branch': 'legacy-py2', 'do': './install.py' }

But vim-plug can't find the branch and ends up checking out master instead. If I manually follow the steps you suggested, still nothing works.

The error log is full of this traceback:

2020-02-10 11:19:46,839 - ERROR - Semantic completion not available for [u'python']
Traceback (most recent call last):
  File "/home/mvanderk/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/server_state.py", line 114, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "/home/mvanderk/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/server_state.py", line 93, in GetFiletypeCompleter
    for filetype in current_filetypes ]
  File "/home/mvanderk/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/server_state.py", line 74, in _GetFiletypeCompleterForFiletype
    completer = module.GetCompleter( self._user_options )
  File "/home/mvanderk/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/completers/python/hook.py", line 29, in GetCompleter
    return PythonCompleter( user_options )
  File "/home/mvanderk/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/completers/python/python_completer.py", line 51, in __init__
    self.signature_triggers.SetServerSemanticTriggers( [ '(', ',' ] )
AttributeError: 'NoneType' object has no attribute 'SetServerSemanticTriggers'

@puremourning
Copy link
Member

puremourning commented Feb 10, 2020

Is there a way to revert to the state of the repo from before the weekend?

Yes, follow the instructions i posted above.

If I manually follow the steps you suggested, still nothing works.

Once again, if you don't show us the exact commands and the exact output, including the exact set of steps and expected/actual results, we can't really help.

Let's start with the basics: follow my commands above, and paste the output in a gist. Please also paste the output of the following commands in the YouCompleteMe and YouCompleteMe/third_party/ycmd directories:

  • git status
  • git rev-parse --is-shallow-repository

IIRC one of the plugin managers does some nonesense with shallow clones or caches and it frequently causes problems.

@puremourning
Copy link
Member

For example, do you have this set?

g:plug_shallow

https://github.com/junegunn/vim-plug#global-options

@mvanderkamp
Copy link
Author

No, unless it's set by default.

@puremourning
Copy link
Member

erm click the link, read the table - it is set by default.

@bstaletic
Copy link
Collaborator

After a shallow clone, git will only pull in the branch that was used when the shallow clone was created.

@puremourning
Copy link
Member

Is there a reason you didn't follow all of my instructions, and provide alll of the output i requested ?

@puremourning
Copy link
Member

Anyway, can you try cloning the repo manually, following my instructions above, then configuring vim-plug to use that clone, per these instructions. Honestly it's quite difficult to diagnose your issue from a distance, but i am 100% sure it is a problem with the state of your installation and not a YCM issue. The legacy-py2 branch is literally the exact commit from before the merge of the py3-only migration:

commit 417b74b1e971d5a7b5d58b251865941b426ac096 (HEAD -> legacy-py2, origin/legacy-py2)
Merge: 6e2afb63 5cf9f1f6
Author: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Date:   Sun Feb 9 15:01:57 2020 +0000

    Merge pull request #3589 from puremourning/inverse-videa

    [READY] Use inverse video for current argument

If you're convinced this is the issue, try checking out 3e6114a which is from Thu Jan 23

@mvanderkamp
Copy link
Author

I'm sorry I don't have time to work this through right now, I have other things I need to get done. I will come back to this later. Thank you for your patience

@puremourning puremourning changed the title How do I use the legacy Python 2 branch? Python2 branch does not work when signature help disabled. Feb 10, 2020
@puremourning
Copy link
Member

puremourning commented Feb 10, 2020

AttributeError: 'NoneType' object has no attribute 'SetServerSemanticTriggers'

Oh hang on. I know what this is. And I can repro with:

vim -Nu vimrc_pwd  --cmd 'let g:ycm_disable_signature_help=1' third_party/ycmd/ycmd/handlers.py

It was fixed in ycmd, but i think we need to update ycmd in YCM in the py2 branch.

When you have 2 minutes, the solution is:

  • cd third_party/ycmd
  • git checkout legacy-py2

I'll push a PR to fix it, but for the record, this has been broken for a while!

@mvanderkamp
Copy link
Author

That seems to have done the trick. Thank you and again I'm sorry for not following the rules. I was a little bit stressed, and it got the better of me. I'll take a few breaths next time and do my due diligence.
I wonder how it has been working for me before now?

@puremourning
Copy link
Member

I wonder how it has been working for me before now?

I suspect you weren't on the latest commit up until today ? If not, then I'm a little surprised too.

@puremourning puremourning reopened this Feb 10, 2020
@puremourning puremourning unpinned this issue Feb 10, 2020
@puremourning
Copy link
Member

Fixed by #3596

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants