-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Add codeActionsOnSave to docs #3938
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -213,6 +213,26 @@ Organize imports can also be automatically when you save a JavaScript file by se | |
"source.organizeImports": true | ||
} | ||
``` | ||
## Code Actions on Save | ||
|
||
The `editor.codeActionsOnSave` setting lets you configure a set of Code Actions that are run when a file is saved. For example, you can enable organize imports on save by setting: | ||
```json | ||
// On save, run both fixAll and organizeImports source actions | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true, | ||
"source.organizeImports": true, | ||
} | ||
``` | ||
|
||
Here are some source actions: | ||
|
||
* `"organizeImports"` - Enables organize imports on save. | ||
* `"fixAll"` - Auto Fix on Save computes all possible fixes in one round (for all providers including ESLint). | ||
* `"fixAll.eslint"` - Auto Fix only for ESLint. | ||
* `"addMissingImports"` - Adds all missing imports on save. | ||
|
||
See [Node.js/JavaScript](/docs/nodejs/working-with-javascript) for more information. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if you prefer to link to a subsection instead but I found the subsection links just in case: https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings For organizeImports specifically in Node.js/JavaScript: |
||
|
||
|
||
## Code suggestions | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,6 +245,26 @@ Organize imports can also be automatically when you save a TypeScript file by se | |
"source.organizeImports": true | ||
} | ||
``` | ||
## Code Actions on Save | ||
|
||
The `editor.codeActionsOnSave` setting lets you configure a set of Code Actions that are run when a file is saved. For example, you can enable organize imports on save by setting: | ||
```json | ||
// On save, run both fixAll and organizeImports source actions | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true, | ||
"source.organizeImports": true, | ||
} | ||
``` | ||
|
||
Here are some source actions: | ||
|
||
* `"organizeImports"` - Enables organize imports on save. | ||
* `"fixAll"` - Auto Fix on Save computes all possible fixes in one round (for all providers including ESLint). | ||
* `"fixAll.eslint"` - Auto Fix only for ESLint. | ||
* `"addMissingImports"` - Adds all missing imports on save. | ||
|
||
See [TypeScript](/docs/typescript/typescript-tutorial) for more information. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if you prefer to link to a subsection instead but I found the subsection links just in case: https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings For organizeImports specifically in TypeScript: |
||
|
||
|
||
## Code suggestions | ||
|
||
|
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.
The content looks good but let's try to tighten it up. These documents quick overviews of features available for js/ts so we try to keep each section fairly small.
I’d say keep the first example and the list of available code actions. You can link to documentation on language specific settings and other more advanced features