-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
--watch is not working #91
Comments
I'm not able to repro the reported problem. It works fine for me. The code is not concatenating paths as described above. It's using the method combinePaths, which ignores the first parameter if the second parameter is absolute. |
If you're still able to repro and have well-defined repro steps, please re-open the bug. |
Hello. I can't see any way to re-open the bug report, maybe such feature is disabled for me. Reproduction steps on my MacBook with latest OSX: echo "def foo(bar: int): pass; foo('bar')" > foo.py
npx pyright --watch foo.py &
echo "def foo(bar: int): pass; foo('bar')" > foo.py Changes are not detected. As you mentioned 'combinePaths' logic, if I change file path to be absolute, it will detect the change. But normally command-line tools are executed with something like "*.py" as a file spec, which is not absolute: echo "def foo(bar: int): pass; foo('bar')" > foo.py
npx pyright --watch $(pwd)/foo.py &
echo "def foo(bar: int): pass; foo('bar')" > foo.py |
Thanks for the additional details. Yes, I was testing it with absolute paths. I've added code that converts all relative paths to full paths (relative to the current working directory), and it's working now. Thanks for the bug report. |
This is now fixed in 1.0.20, which I just published. |
* fixed root directory issues broke by my previous refactoring. added comments to show differences between pyrx and pyright on directory structures.
* fixed root directory issues broke by my previous refactoring. added comments to show differences between pyrx and pyright on directory structures.
If you execute pyright with --watch and a file name, it will not re-check the file.
This is due to the different file path handling. While adding files to the list, files are added as-is, so executing "pyright --watch foo.py" will add "foo.py" into the '_sourceFileMap':
https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/program.ts#L814
But while subscribing to the filesystem watch, file paths are added to the '_executionRootPath':
https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/service.ts#L444
So after the file change event as-is path in the '_sourceFileMap' will be compared to the absolute path concatenated with '_executionRootPath', resulting in file not found in the dict and no re-check. I don't know which file handling, as-is or relative to '_executionRootPath' is assumed to be correct, so I can't make a patch for it :(
The text was updated successfully, but these errors were encountered: