Skip to content

Instead of clearing out all resolutions and closing all the directory watchers, mark everything as invalidated when changes affect module resolution #53882

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

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

sheetalkamat
Copy link
Member

  • This avoids unnecessary watch closing and adding depending on resolution setting.
  • Also changed how we toggle js setting for inferred project when inferred project becomes orphan. Before this change in inferred project with only js file, we would toggle it to non js when that js file is closed and then when another js file is opened reusing the inferred project we would retoggle it back to js project

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Apr 17, 2023
@sheetalkamat sheetalkamat marked this pull request as ready for review April 18, 2023 16:51
Comment on lines -120 to -126
/user/username/projects/myproject/data.json:
{"pollingInterval":500} *new*
/user/username/projects/myproject/node_modules/@types:
{"pollingInterval":500} *new*
/user/username/projects/node_modules/@types:
{"pollingInterval":500} *new*

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These use to be deleted and created again when module resolution settings changed

@@ -515,7 +515,7 @@ Loading module as file / folder, candidate module location '/user/username/proje
File '/user/username/projects/transitiveReferences/b.ts' does not exist.
File '/user/username/projects/transitiveReferences/b.tsx' does not exist.
File '/user/username/projects/transitiveReferences/b.d.ts' does not exist.
File '/user/username/projects/transitiveReferences/b/package.json' does not exist.
File '/user/username/projects/transitiveReferences/b/package.json' does not exist according to earlier cached lookups.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also dont need to re-read package json because of this.

@@ -90,10 +90,6 @@ Info seq [hh:mm:ss:mss] Config: /user/username/projects/myproject/jsconfig.json
}
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Config: /user/username/projects/myproject/jsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Config: /user/username/projects/myproject/jsconfig.json WatchType: Wild card directory
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /dev/null/inferredProject1* WatchType: Type roots
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was because inferred project was marked to be non js and it would mean change in options that affect module so earlier we were closing all the watchers, but now we keep them alive (just like if it would have been ts only inferred project to start with)

Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Project: /user/username/projects/myproject/c/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/c/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/node_modules/@types 1 undefined Project: /user/username/projects/myproject/c/tsconfig.json WatchType: Type roots
Info seq [hh:mm:ss:mss] DirectoryWatcher:: Close:: WatchInfo: /user/username/projects/myproject/refs 1 undefined Project: /user/username/projects/myproject/c/tsconfig.json WatchType: Failed Lookup Locations
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows how we only close -not needed directory watcher only instead of deleting all and adding them back

@sheetalkamat sheetalkamat merged commit b846033 into main Apr 18, 2023
@sheetalkamat sheetalkamat deleted the changeOptions branch April 18, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants