-
Notifications
You must be signed in to change notification settings - Fork 12.9k
pass program update level to getExternalFiles in tsserver plugins so plugins can make decision about their cache based on that #56047
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
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
/** Update the file name list from the disk */ | ||
Partial, | ||
/** Reload completely by re-reading contents of config file from disk and updating program */ | ||
export enum ProgramUpdateLevel { |
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.
Just renamed this and exposed as Public API for use in getExternalFiles
@@ -1892,10 +1892,10 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo | |||
} | |||
// compute and return the difference | |||
const lastReportedFileNames = this.lastReportedFileNames; | |||
const externalFiles = this.getExternalFiles().map((f): protocol.FileWithProjectReferenceRedirectInfo => ({ | |||
const externalFiles = this.externalFiles?.map((f): protocol.FileWithProjectReferenceRedirectInfo => ({ |
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.
this shouldnt have been querying things again from modules but should have been returning the current state in the first place. so just made that change
Co-authored-by: Andrew Branch <[email protected]>
Before this change, we called getExternalFiles on every project update (and some) To get correct behaviour, plugin users had to either watch things by themselves or inefficient way of refreshing this every call or just dont handle the updtes well
This passes the program update level to getExternalFiles so plugin users can make decisions based on that.
Fixes #56044