-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Pyright does not pick up new files. #94
Comments
Iirc it's a ST core issue that there is no callback when files are created/deleted/modified by an external program. But at the same time the LSP team created a file watcher package. I am not sure what's the situation now. |
What platform are you on @Fingel? You could see if it reproduces with https://packagecontrol.io/packages/LSP-file-watcher-chokidar installed but the last time I checked, pyright had been running its own file watcher and whether LSP supported file watching didn't really matter. If you can still reproduce with that package then fell free to create a small repro and state your node version and OS. |
file_watcher.mp4Pyright doesn't seem to watch a newly created files but after installing https://packagecontrol.io/packages/LSP-file-watcher-chokidar and config it for watching
|
So I guess it would be nice to have that in the default config |
That raises some questions though:
Those should probably be asked in the pyright repo. |
When I created [Trace - 下午6:08:29] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
"changes": [
{
"uri": "file:///c%3A/Users/Tester/Desktop/my_project/my_package/new_file.py",
"type": 1
},
{
"uri": "file:///c%3A/Users/Tester/Desktop/my_project/my_package",
"type": 2
}
]
} So I think it's VSCode's responsibility (or something from the client side) to notify Pylance there is a new file to be watched?
The configuration is for |
The client notifies, yes, but the client is told what to notify about either through manual configuration or dynamic registration from the server. |
Thanks. Realized before deleting the question. :) So in Pylance the registration is done dynamically:
It would make sense to ask on the pyright repo to change pyright to do that itself. Though I always think that they will be hesitant to add stuff because it would take away the competitive advantage of pylance... |
Ops... pyright actually registers the capability dynamically. The issue was on our side. I've made a silly mistake and reported the capability in the wrong place. Fixing in sublimelsp/LSP#1892 With the fix it will be enough to install https://packagecontrol.io/packages/LSP-file-watcher-chokidar to have things working. |
I’d argue this is part of LSP functionality, not part of the “AI” competitive advantage :) Edit: I guess never mind. |
Fun fact, the |
I still have this feeling every time I think of reporting some enhancement suggestion... |
Do you mean we don't have to add |
Yes, with the fix in place we don't need to define the file_watcher configuration manually since the server registers the watcher through a dynamic capability. |
We now have LSP-file-watcher-chokidar as a current workaround that will fix this issue. Can we close this, |
I think this is addressed with chokidar package, yes. Also LSP-pyright readme was updated to mention it. |
I'm not sure if this is an upstream bug or not, but when I create a new Python file and then try to import something from it in a a different python file, pyright will complain about undefined imports. I have to restart lsp-pyright for them to be picked up.
The text was updated successfully, but these errors were encountered: