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 - support a 'willSave' hook #15917

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

Plugins - support a 'willSave' hook #15917

egamma opened this issue May 17, 2017 · 3 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@egamma
Copy link
Member

egamma commented May 17, 2017

Background angelozerr/tslint-language-service#32.

The tslint language server extension should support an option to auto fix lint rules with a fixer before a file is saved. The plugin API should support a willSave method that a plugin can use to perform an operation like auto fixing before the document is saved. In addition there needs to be request that the TypeScript language client like VS Code can use to inform the TypeScript language server that the user is about to save a file.

@RyanCavanaugh
Copy link
Member

I'd rather this was handled as part of a Format Document request. Modifying a file on save isn't really a user-apparent pattern.

@egamma
Copy link
Member Author

egamma commented May 19, 2017

@RyanCavanaugh doing this as part of the getFormattingEditsForDocument request makes good sense and it blends well with format on save support. However, what is missing, is that the request has a some context information whether it was triggered as part of a save or not. For the tslint example the user would not want auto fix on each format request but only on save.

Modifying a file on save isn't really a user-apparent pattern.

Support for 'format on save' or 'auto fix on save' are common and supported by many editors IDEs. The key is that this is done as a pre-save operation so that a file is not saved twice.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label May 24, 2017
@aleclarson
Copy link

Can/should this be investigated soon?

@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript and removed Needs Investigation This issue needs a team member to investigate its status. labels Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants