0

I am trying to use YouCompleteMe in Vim for getting python documentation (using YcmCompleter GetDoc and the vim pop up menu). This works well for normal python commands, but there seems to be various problems with getting documentation for package commands.

For example:

  1. numpy.linspace gives a huge doc file with alot of changes detailed, lots of repeated lines of text, and the initial function declaration is repeated dozens of times with slight variations (things like the first Input value can be “_ArrayLikeFloat_co”, or “_ArrayLikeComplex_co” and different variations for each input). This makes the popup window fill the screen with text, and the GetDoc command very hard to read.
  2. numpy.a (or any letter) gives a RecursionError: “maximum recursion depth exceeded” in the vim messages. It will successfully suggest relavent commands to input when the menu is opened though. This is repeated for some other functions like pandas.read_csv
  3. numpy.zeros and numpy.array (and probably others) give “RuntimeError: maximum recursion depth exceeded” when the doc is requested.
  4. Many others contain very simple, and/or not formatted correctly (for the pop up display) docs.

Reading the YcmDebugInfo lists nothing suspicious, the oython interpreter refernces the correct ~/.pyenv/... location (same as i have these installed), aswell as the correct site-packages where pip installes my packages, its running Python 3.13.1, Jedi 0.19.1and is a new install of YCM.

I assume that the issue is related to some incorrect python configuration I have set, though given the recursion does not occur for pandas, but the bad doc string does, makes me think it is not necessarily caused direactly by the recursion issue.

Does anyone know what is going on here, or some way to fix this, or maybe give YCM a different set of doc files?

Semi solution

While not actually solving the issue with Jedi, I did eventually get pylsp working as an alternate server. The primary problems I had where setting up the pylsp config as it needs to be passed in at an editor level, not a global config folder (~/.config/pylsp/config.yaml and similar didn't get read by YCM). Eventually I set up the YCM extra config file let g:ycm_global_ycm_extra_conf = '~/.dotfiles/vim/ycm_global_extra_cong.py':

def Settings(**kwargs):
    client_data = kwargs['client_data']
    return {
        'interpreter_path': client_data['g:ycm_python_interpreter_path'],
        'sys_path': client_data['g:ycm_python_sys_path'],
        'ls': {
            'pylsp': {
                'plugins': {
                    'pyflakes': {'enabled': False},
                    'flake8': {
                        'enabled': True,
                        'ignore': [
                            'E226',  # missing whitespace around arithmetic operator
                            # 'E203',  # whitespace before ‘,’, ‘;’, or ‘:’
                            'E303',  # too many blank lines (3)
                            'F401',  # module imported but not used
                        ],  
                    }
                }
            }
        }
    }

with options described by the pylsp configuration.md page on the github page.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.