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

Plugins - notify a plugin when a tsconfig.json file changes #15915

Closed
egamma opened this issue May 17, 2017 · 3 comments
Closed

Plugins - notify a plugin when a tsconfig.json file changes #15915

egamma opened this issue May 17, 2017 · 3 comments
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@egamma
Copy link
Member

egamma commented May 17, 2017

A plugin can define plugin specific properties in the plugin section of the tsconfig.json file. When the user edits a tsconfig.json then the plugin should be notified so that it can react to setting changes.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@mhegazy mhegazy added Suggestion An idea for TypeScript and removed Needs Investigation This issue needs a team member to investigate its status. labels Apr 20, 2018
@mhegazy mhegazy assigned ghost Apr 20, 2018
@mhegazy mhegazy added the API Relates to the public API for TypeScript label Apr 20, 2018
@mhegazy mhegazy added this to the TypeScript 2.9 milestone Apr 20, 2018
@ghost ghost added the Fixed A PR has been merged for this issue label May 2, 2018
@mhegazy
Copy link
Contributor

mhegazy commented May 7, 2018

Piping events from tsserver to the plugin regarding changes to the config file that in sections that do not touch project configuration requires some reworking of the server. Today we make multiple assumptions about what changes require a requery for errors vs others. It also seems that the plugins in general need to monitor other files, e.g. tslint.json for the tslint plugin. I would recommend adding a file watcher on the tsconfig.json as well, and triggering a refresh of errors if the lint configuration section changes. With #15914 in (PR: #23824), the plugin should be able to trigger a refresh to errors using project.refreshDiagnostics.

@mhegazy mhegazy closed this as completed May 7, 2018
@egamma
Copy link
Member Author

egamma commented May 8, 2018

@mhegazy having the plugin watch the tsonfig.json makes sense. Is there a way for a plugin to find out which tsconfig.json file should be watched?

@mhegazy
Copy link
Contributor

mhegazy commented May 8, 2018

Calling getProjectName on a ConfiguredProject should give you the path to the tsconfig.json/jsconfig.json file path. The path is also stored on CompilerOptions.configFilePath ( that is an internal property, so does not show in the .d.ts, but we can make it visible through a helper).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants