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

New python modules require editor restart #8960

Closed
1 task done
Yu266426 opened this issue Mar 6, 2024 · 7 comments
Closed
1 task done

New python modules require editor restart #8960

Yu266426 opened this issue Mar 6, 2024 · 7 comments
Assignees
Labels
bug [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors python Python programming language support

Comments

@Yu266426
Copy link

Yu266426 commented Mar 6, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When a new python file is created, I am unable to get the editor to recognize the module without restarting Zed.

This might have to do with Pyright, I am unsure.

Environment

Zed: v0.124.8 (Zed)
OS: macOS 14.3.1
Memory: 64 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

issue.mp4

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

@Yu266426 Yu266426 added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Mar 6, 2024
@failable
Copy link

failable commented Mar 7, 2024

Or restart LSP only.

@Moshyfawn Moshyfawn added python Python programming language support language An umbrella label for all programming languages syntax behaviors language server An umbrella label for all language servers editor Feedback for code editing, formatting, editor iterations, etc and removed triage Maintainer needs to classify the issue editor Feedback for code editing, formatting, editor iterations, etc labels Mar 7, 2024
@Moshyfawn
Copy link
Member

Potentially related #7296

@JosephTLyons
Copy link
Collaborator

In the past, I've made the assumption that this was just a pyright deficiency, but I'm going to throw this on the project board for next week's quality week and have someone more qualified than I see if there's anything we can do on our end - even if we need to put in a hack.

@JosephTLyons JosephTLyons removed the admin read Pending admin review label Mar 7, 2024
@osiewicz osiewicz self-assigned this Mar 12, 2024
@osiewicz
Copy link
Contributor

This looks to be a Pyright issue indeed; we properly notify a language server about path changes, yet it doesn't react.
Oddly enough, when I've set PYRIGHT_PYTHON_DEBUG environment variable to get LSP logs, the whole thing started working. weird.

@JosephTLyons
Copy link
Collaborator

JosephTLyons commented Mar 12, 2024

Are you saying that new modules are being recognized, without restarting, while in debug mode? If there are no performance issues with it, I wonder if we can just stay in debug mode. Others may not agree, but I think I'm for putting in a hack here to get this to work, since I hope to be rid of Pyright somewhere down the line anyway. That being said, the issue with relying on some weird side effect is that it might go away at any moment.

@osiewicz
Copy link
Contributor

Yeah, it seems like it does in fact work. We do notify the language server properly of changes in the local worktree, and with pyright.json config file, dependency installation is handled just fine as well.
My PyRight version is 1.1.332, which is quite old.

Please do reopen this issue if you run into it again.

@JosephTLyons
Copy link
Collaborator

JosephTLyons commented Mar 12, 2024

@osiewicz and I double checked and it seems like pyright is currently

  • resolving imports to newly-added local files
  • resolving imports to newly-added dependencies, if you have a pyrightconfig.json file properly configured and added

The version of pyright listed in my ~/Library/Application Support/Zed/languages/pyright/package.json is ^1.1.320

Is anyone else able to reproduce the original issue here?


Edit: sorry for repeating what Piotr said!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] language server An umbrella label for all language servers language An umbrella label for all programming languages syntax behaviors python Python programming language support
Projects
None yet
Development

No branches or pull requests

5 participants