python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

How to have parameters and docs showing for code installed with codan develop or pip -e .

Open brando90 opened this issue 5 years ago • 8 comments

I have code I developed myself I can never see the definition of it as I type. How can I get help?

brando90 avatar Jun 24 '20 21:06 brando90

cross posted: https://stackoverflow.com/questions/62564321/how-does-one-have-intellisense-or-intellicode-work-for-my-own-packages-install

brando90 avatar Jun 24 '20 21:06 brando90

I have installed multiple packages in development mode. See my python path:

❯ python -c "import sys; [print(p) for p in sys.path]"

/Users/brandomiranda/miniconda3/envs/my-env/lib/python37.zip
/Users/brandomiranda/miniconda3/envs/my-env/lib/python3.7
/Users/brandomiranda/miniconda3/envs/my-env/lib/python3.7/lib-dynload
/Users/brandomiranda/miniconda3/envs/my-env/lib/python3.7/site-packages
/Users/brandomiranda/proj/my-proj
/Users/brandomiranda/ultimate-utils/ultimate-utils-project
/Users/brandomiranda/higher

However when I try to auto-complete to see docs, parameters etc for my own project it does not work (note intellicode does seem to suggest sensible things for Pytorch for the moment so I assume that is working and the docs for .tensor).

I press ^ space (control space) and it says:

No suggestions

in addition it does not shows a preview of the parameters or the docs (e.g. the docstrings I wrote for my own code).

I am mainly using conda develop . to install my editable code.

I saw other resources like:

  • https://stackoverflow.com/questions/50389852/visual-studio-code-intellisense-not-working#
  • https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#common-questions-and-issues
  • https://github.com/microsoft/python-language-server/issues/1085#issuecomment-492919382
  • https://github.com/microsoft/python-language-server/issues/1169#issuecomment-499998928

but they don't seem to work for me. Besides, if I already have my packages installed in my conda environment as the print of the python environment path shows, I don't understand why I need to tell vscode manually again about them.

How can we make the IntelliSense feature work for my own code installed in editable mode?

brando90 avatar Jun 24 '20 21:06 brando90

@jakebailey I have an issue where I can go to the declaration of the project in one place but not in the other (and also it never gives me suggestions for project I installed myself with conda develop . or even pip -e .).

What should I do?

e.g.

    import uutils.emailing #1
    from uutils.emailing import send_email, send_email_pdf_figs #2

with 1 I CANNOT go to the declaration with a right click but I CAN with 2 when I go to emailing.

brando90 avatar Jun 25 '20 18:06 brando90

You used the question template, the issue template asks for a lot more info. The trace logs would be important to look at, for the paths being used. https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#filing-an-issue

jakebailey avatar Jun 25 '20 18:06 jakebailey

https://github.com/microsoft/python-language-server/blob/master/TROUBLESHOOTING.md#filing-an-issue

there were no indications of that when I opened this issue fyi. I always check that sort of thing carefully.

brando90 avatar Jun 25 '20 19:06 brando90

There is a warning where there is no code and the surrounding warning makes no sense:

Screen Shot 2020-06-25 at 2 37 25 PM

brando90 avatar Jun 25 '20 19:06 brando90

Please, provide logs. The page I linked has the settings to enable trace logging and where to find it in VS Code.

jakebailey avatar Jun 25 '20 19:06 jakebailey

Please, provide logs. The page I linked has the settings to enable trace logging and where to find it in VS Code.

I will, sorry if I missed the instruction, I usually don't.

Meanwhile I have a question. If I open everything from my home directory were all my projects are, will that allow illi-code, the language server etc all those nice features work better?

brando90 avatar Jul 01 '20 14:07 brando90