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

Ycm GotoDeclaration/Definition causes vim to freeze in certain cases #3458

Closed
11 tasks done
ApolloBian opened this issue Aug 2, 2019 · 7 comments
Closed
11 tasks done

Comments

@ApolloBian
Copy link

ApolloBian commented Aug 2, 2019

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:

  • I have read and understood YCM's [CONTRIBUTING][cont] document.
  • I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
  • I have read and understood YCM's [README][readme], especially the
    [Frequently Asked Questions][faq] section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. ([Example Google
    search.][search])
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Provide a clear description of the problem, including the following key
questions:
I have used Ycm for over 2 years and everything works smoothly, however I recently encounter an issue where GotoDeclaration causes vim to freeze (not taking any kind of input including ^C etc) and after some time it says HTTPConnectionPool(host=.....): Read timed out. (read timeout=30). It is very annoying.

All the completion works fine tho, both identifier and semantic.

Include steps to reproduce here.
Include description of a minimal test case, including any actual code required
to reproduce the issue.
A minimal test case:

#!/usr/bin/env python
class TestCase:
  def __init__(self):
    self.somevalue = 0
  def reset_somevalue(self):
    self.somevalue = 0
  def inc_somevalue(self):
    self.somevalue += 1   # invoke on this line breaks vim
  def here_it_works_normal(self):
    self.reset_somevalues() # invoke on this line will jump to the definition

when invoking GoToDeclaration or GoToDefinition on the somevalue property, vim freezes.

  • What did you expect to happen?
    jump to the __init__ function, or at least not freeze.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan 28 2019 17:44:00)
macOS version
Included patches: 1-611
Compiled by bian_tianling@sjtu.edu.cn
Huge version without GUI.  Features included (+) or not (-):
+acl               +extra_search      +mouse_netterm     +tag_old_static
+arabic            +farsi             +mouse_sgr         -tag_any_white
+autocmd           +file_in_path      -mouse_sysmouse    -tcl
+autochdir         +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +textprop
+byte_offset       -hangul_input      +num64             +timers
+channel           +iconv             +packages          +title
+cindent           +insert_expand     +path_extra        -toolbar
-clientserver      +job               +perl              +user_commands
+clipboard         +jumplist          +persistent_undo   +vartabs
+cmdline_compl     +keymap            +postscript        +vertsplit
+cmdline_hist      +lambda            +printer           +virtualedit
+cmdline_info      +langmap           +profile           +visual
+comments          +libcall           -python            +visualextra
+conceal           +linebreak         +python3           +viminfo
+cryptv            +lispindent        +quickfix          +vreplace
+cscope            +listcmds          +reltime           +wildignore
+cursorbind        +localmap          +rightleft         +wildmenu
+cursorshape       -lua               +ruby              +windows
+dialog_con        +menu              +scrollbind        +writebackup
+diff              +mksession         +signs             -X11
+digraphs          +modify_fname      +smartindent       -xfontset
-dnd               +mouse             +startuptime       -xim
-ebcdic            -mouseshape        +statusline        -xpm
+emacs_tags        +mouse_dec         -sun_workshop      -xsmp
+eval              -mouse_gpm         +syntax            -xterm_clipboard
+ex_extra          -mouse_jsbterm     +tag_binary        -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/Users/tianling/Applications/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L.  -L/usr/local/lib -o vim        -lncurses  -liconv -framework AppKit   -mmacosx-version-min=10.14 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.28.1/lib/perl5/5.28.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.3.0 -lobjc

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /var/folders/5c/9r7xkl9x6zbc9hvykt4hnpsw0000gn/T/ycm_6vml8khq.log
-- Server Python interpreter: /Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/bin/python
-- Server Python version: 3.7.1
-- Server has Clang support compiled in: True
-- Clang version: clang version 8.0.0 (tags/RELEASE_800/final)
-- No extra configuration file found
-- Python completer debug information:
--   Python interpreter: /Users/tianling/.pyenv/versions/3.7.1/envs/everything/bin/python
--   Python path: ['/Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/lib/python37.zip', '/Users/tianling/.pyenv/versions/3.7.1/Python.framework/Versions/3.7/lib/python3.7', '/Users/tianling/.pyenv/versi
ons/3.7.1/lib/python3.7/lib-dynload', '/Users/tianling/.pyenv/versions/3.7.1/envs/everything/lib/python3.7/site-packages']
--   Python version: 3.7.1
--   Jedi version: 0.13.3
--   Parso version: 0.3.4
-- Server running at: http://127.0.0.1:50678
-- Server process ID: 7893
-- Server logfiles:
--   /var/folders/5c/9r7xkl9x6zbc9hvykt4hnpsw0000gn/T/ycmd_50678_stdout_y548jr90.log
--   /var/folders/5c/9r7xkl9x6zbc9hvykt4hnpsw0000gn/T/ycmd_50678_stderr_z31xy6rt.log

Contents of YCM, ycmd and completion engine logfiles

Add let g:ycm_log_level = 'debug' to vimrc, restart Vim, reproduce the
issue, and include link here to a [gist][] containing the entire logfiles for
ycm, ycmd and any completer logfiles listed by :YcmToggleLogs.

ycm_015czata.log
ycmd_51139_stderr_iqtdumfz.log

OS version, distribution, etc.

I have tested on Linux and MacOS. Same behavior

@ApolloBian
Copy link
Author

YouCompleteMe: fa92f40

@ApolloBian
Copy link
Author

Also, using gd or gD does jump to the __init__ function, so I suppose it is not the problem with my test case.

@bstaletic
Copy link
Collaborator

I've noticed this recently too. I'm looking into it.

@bstaletic
Copy link
Collaborator

Found the culprit.
The same reason why I opened ycm-core/ycmd#1341

@bstaletic
Copy link
Collaborator

Until we figure out how to fix this, use GoToType as that does now what GoTo used to do.

bstaletic added a commit to bstaletic/ycmd that referenced this issue Oct 19, 2019
PR ycm-core#1275 broke GoTo in python in more ways than one. See:

- ycm-core/YouCompleteMe#3458
- ycm-core#1341

Changes in the behaviour:

- GoTo, GoToDefinition and GoToDeclaration now do what GoToType used to
do.
- We don't expose jedi's `goto_assignments` which can be useful, but we
do have GoToReferences that calls jedi's `usages()`.
  - This means that `GoTo` on `self.x` will now jump to the definition
of the type of `x`, while `GoToReferences` will do what is expected.
  - The `goto_usages` for this case returns "weird" locations, see ycm-core#1341
for details.
bstaletic added a commit to bstaletic/ycmd that referenced this issue Oct 19, 2019
PR ycm-core#1275 broke GoTo in python in more ways than one. See:

- ycm-core/YouCompleteMe#3458
- ycm-core#1341

Changes in the behaviour:

- GoTo, GoToDefinition and GoToDeclaration now do what GoToType used to
do.
- We don't expose jedi's `goto_assignments` which can be useful, but we
do have GoToReferences that calls jedi's `usages()`.
  - This means that `GoTo` on `self.x` will now jump to the definition
of the type of `x`, while `GoToReferences` will do what is expected.
  - The `goto_usages` for this case returns "weird" locations, see ycm-core#1341
for details.
@bstaletic
Copy link
Collaborator

Fixed.

@ApolloBian
Copy link
Author

@bstaletic Cool! Appreciate the good work!

ObiWahn pushed a commit to ObiWahn/ycmd that referenced this issue Dec 2, 2019
PR ycm-core#1275 broke GoTo in python in more ways than one. See:

- ycm-core/YouCompleteMe#3458
- ycm-core#1341

Changes in the behaviour:

- GoTo, GoToDefinition and GoToDeclaration now do what GoToType used to
do.
- We don't expose jedi's `goto_assignments` which can be useful, but we
do have GoToReferences that calls jedi's `usages()`.
  - This means that `GoTo` on `self.x` will now jump to the definition
of the type of `x`, while `GoToReferences` will do what is expected.
  - The `goto_usages` for this case returns "weird" locations, see ycm-core#1341
for details.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 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

2 participants