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

Tab expansion working poorly in VS Code #3400

Closed
MarcSkovMadsen opened this issue Apr 15, 2022 · 13 comments
Closed

Tab expansion working poorly in VS Code #3400

MarcSkovMadsen opened this issue Apr 15, 2022 · 13 comments
Labels
TRIAGE Default label for untriaged issues

Comments

@MarcSkovMadsen
Copy link
Collaborator

I'm on Panel 0.13.0. If I write from panel.pane import and press CTRL+Space or start typing Markdown I would expect VS Code to help me identify what is possible to import. It does not.

no-intellisense.mp4

This is just an example of a general problem that makes it harder than it has to be to use Panel.

@MarcSkovMadsen MarcSkovMadsen added the TRIAGE Default label for untriaged issues label Apr 15, 2022
@MarcSkovMadsen
Copy link
Collaborator Author

Its the same with other combinations pn.pane. and from panel import pane. I simply cannot get any help that Markdown is available under panel.pane.

@philippjfr
Copy link
Member

What does VSCode use for completion here? Guess it's not dynamic.

@MarcSkovMadsen
Copy link
Collaborator Author

VS Code uses the Python Language Server and static type analysis (similar to mypy).

I can see if I

  1. Move the from .layout import ... to the top of the root __init__.py file
  2. Restart VS Code
    image

the I start to be able to see some classes.

works.gif.mp4

@MarcSkovMadsen
Copy link
Collaborator Author

I've tried to set the Log Level for pylance to trace

image

and inspect the logs. But don't see any errors. See the pylance logs below.

image

log.txt

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Apr 15, 2022

It might have something todo with static analysis for panel not working at all as you can see below.

image

(this might also just be caused by me running mypy on an installed package?)

@MarcSkovMadsen
Copy link
Collaborator Author

But we are not alone microsoft/pylance-release#844.

But for example Streamlit just works.

@MarcSkovMadsen
Copy link
Collaborator Author

Similarly if I run

image

then mypy errors. I don't know for sure this is the cause. But might be.

@MarcSkovMadsen
Copy link
Collaborator Author

Pylance is built on top of pyright - not mypy. So maybe running pyright will reveal something?`

microsoft/pylance-release#193

@MarcSkovMadsen
Copy link
Collaborator Author

I tried creating a new project and virtual environment. Everything fresh. Same problem.

@MarcSkovMadsen
Copy link
Collaborator Author

But I can confirm the problematic import seems to be from . import param # noqa. Somehow this makes intellisense not work.

But if I remove it, it works. Also for pn.widgets and pn.pane.

remove-param.mp4

@MarcSkovMadsen
Copy link
Collaborator Author

MarcSkovMadsen commented Apr 15, 2022

Why do we need from . import param @philippjfr?

I don't think we need to import the module in the __init__.py files? See below example.

image

@maximlt
Copy link
Member

maximlt commented Apr 16, 2022

I just tried in my dev env and it actually works for me. I'll try to confirm that later in a new env with a fresh panel version.

@philippjfr
Copy link
Member

Definitely more to improve on the editor experience but this specific issue is resolved by #3411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TRIAGE Default label for untriaged issues
Projects
None yet
Development

No branches or pull requests

3 participants