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

Add codeActionsOnSave to docs #3938

Merged
merged 3 commits into from
Aug 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/languages/javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Contributor

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

```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.
Copy link

@Luxcium Luxcium Aug 14, 2020

Choose a reason for hiding this comment

The 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:
https://code.visualstudio.com/docs/languages/javascript#_organize-imports



## Code suggestions

Expand Down
20 changes: 20 additions & 0 deletions docs/languages/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link

@Luxcium Luxcium Aug 14, 2020

Choose a reason for hiding this comment

The 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:
https://code.visualstudio.com/docs/languages/typescript#_organize-imports



## Code suggestions

Expand Down