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

File watcher and/or TS Server not triggering updates on symlinked folder changes #46864

Open
pix2D opened this issue Nov 18, 2021 · 4 comments
Open
Labels
Needs Investigation This issue needs a team member to investigate its status.
Milestone

Comments

@pix2D
Copy link

pix2D commented Nov 18, 2021

TS Template added by @mjbvz

TypeScript Version: 4.5.1

Search Terms

  • watch
  • link

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.62.2
  • OS Version: macOS 12.0.1

Steps to Reproduce:

  1. Create a workspace with folder A and B and setup a basic package.json in each
  2. Run npm link in folder B
  3. Run npm link B in folder A
  4. There is now a symbolic link at A/node_modules/B which is by default excluded from the watcher
  5. Add "files.watcherInclude": ["./node_modules/B"] to the workspace settings (I tried user settings also just to be sure; I also tried absolute paths etc)
  6. Make a test file in B and export a basic variable/function
  7. Make a test file in A and import the above variable/function
  8. Make a change in B that would cause A to change in some way (for example remove the export, or change its type)
  9. A is unchanged; if the TS Server is manually restarted the changes show

I'm not sure if this is a issue in the file watcher or the TS server, or maybe if this is how it is expected to work and there is just no support for symlinks. If I can do anything else to help debug let me know.

For anyone else that runs into this the workaround I've done is to make the workspace with folder A, do all the setup, and then add A/node_modules/@org (my symlinks are all inside a org scope) as a separate folder to the workspace (instead of adding B directly). This way changes are detected immediately while typing (so before even saving), as it should be.

@Redracer93

This comment has been minimized.

@mjbvz
Copy link
Contributor

mjbvz commented Nov 19, 2021

Does this reproduce in the latest VS Code insiders build with all extensions disabled?

@pix2D
Copy link
Author

pix2D commented Nov 19, 2021

Yes, I just tested it and was able to reproduce (1.63.0-insider). However I did figure out another data point. In order to work with B without rebuilding after each change I added the following to tsconfig.json within compilerOptions (and sorry I forgot to mention this above) so that it looks at src instead of dist:

"baseUrl": ".",
"paths": { "B": ["node_modules/B/src"] }

If I instead change this to the following then it works (without adding anything to files.watcherInclude as well):

"baseUrl": ".",
"paths": { "B": ["../B/src"] }

I guess that just sidesteps node_modules entirely so then everything updates on the fly without files in B being saved even (auto-import suggestions, type changes etc).

[edit] I also had to add the path to include in tsconfig.json.

@mjbvz mjbvz transferred this issue from microsoft/vscode Nov 19, 2021
@mjbvz mjbvz removed their assignment Nov 19, 2021
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Nov 22, 2021
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Nov 22, 2021
@aovchinn
Copy link

I have similar issue, watchFile from /typescript/lib/typescript.js:112921:90
is called with path that is not resolved node_modules/linked-module/selector.ts
but later notifications gets in with realpath, resolved value /root/linked-modules/selector.ts

I wonder if it is the same problem as I am struggling with
TypeStrong/fork-ts-checker-webpack-plugin#557 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

5 participants