-
Notifications
You must be signed in to change notification settings - Fork 12.9k
When watching failed lookups, watch packageDir if its a symlink otherwise the path we use to watch #58139
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
Conversation
@@ -272,7 +272,7 @@ FsWatches:: | |||
{} | |||
|
|||
FsWatchesRecursive:: | |||
/user/username/projects/myproject/node_modules: *new* | |||
/user/username/projects/myproject/node_modules/@issue/b: *new* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For these new watchers, my impression is that they are attempting to watch the future linking or changing of /user/username/projects/myproject/packages/B
, right? Does the case matter here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casing is handled. Its not target we are watching but symlink so this is something we lookedup as part of failed lookup and we are watching that.
Thank you very much for your work on this! Highly appreciated 🎉 |
@sheetalkamat could you update when this fix will be released in typescript? |
This is already in 5.5 beta |
@sheetalkamat So this fix is already in prod? Quick question: does it work only with Still having the issue with VSCode. One of my node_modules packages - P.S.: checked and it still does not, I need to call |
This is in 5.5 |
In mono repo scenarios the packages are linked using symlink.
So when trying to resolve
package1
frompackage2
in the test we look for locations like:/home/src/projects/project/node_modules/package1/dist/index.d.ts
As a result when
package1
fails to resolve, we want to watch if this path will exists.Before this PR, we would be watching
/home/src/projects/project/node_modules
as its anode_modules
folder and we dont want to be watching too many packages or folders. This results in issues because/home/src/projects/project/node_modules/package1
is a symlink and any changes to the target are not percolated to the watcher we create. So without this PR we would not see the changes and miss the package build and report errors aboutpackage1
not found and never be able to resolve that unless offcourse if you start fresh by restarting tsserverNow when we calculate dir to watch, we also find the
packageDir
if this happens to be symlink, we will watch it otherwise we will watch thenode_modules
like we use to watch before.Other change needed for this to work on linux was that when we are watching this symlink dir, we need to ensure we are watching the target recursively as that is the expectation for native watchers that support symlink watching.
We already had test case which didnt update the diagnostics on tsserver when
paths
was not used and with my other prototype changes to treat file create and delete as change and retain things more, it becomes more evident and those tests just start to fail. So this is cruicial fix for that change to go in as wellFixes #55450