What is the problem this feature will solve?
Currently: shellcheck is run automatically on document changes, while shfmt is exposed through formatting.
Problems:
- Makes it difficult to control when these potentially expensive operations run
- There is unwanted "on-type" behaviour; many prefer on-save instead
What is the feature you are proposing to solve the problem?
Bash IDE should expose both as vscode "Code Actions".
Using array syntax, which preserves ordering:
"[shellscript]": {
"editor.codeActionsOnSave": [
"source.fixAll.bash-ide-shfmt",
"source.fixAll.bash-ide-shellcheck"
]
}
Or using object syntax, which exposes fine-grained policies:
"[shellscript]": {
"editor.codeActionsOnSave": {
"source.fixAll.bash-ide-shfmt": "explicit",
"source.fixAll.bash-ide-shellcheck": "explicit"
}
}
Code actions are the modern approach for this behaviour. Other formatting/linting extensions already work this way, and could be used for guidance (e.g. ESLint, Prettier, ShellCheck).
Implications:
- Allow vscode settings to control lint/format-on-save behaviour
- Avoids irritating and unnecessary on-type execution
- Allow users to enable/disable each operation independently
- Allow extension to provide both linting and formatting, without requiring the separate ShellCheck extension - one extension instead of two is a major win
- Follow vscode's modern approach of letting the editor control save-time behaviour rather than hard-coding triggers in extension logic
I've noticed that there are many issues related to settings and overlap between various extensions and tools. This approach would probably address many of them, as it's the recommended modern on-save behaviour in vscode.
References:
What alternatives have you considered?
Multiple extensions, multiple tools, using prettier for formatting, complex vscode settings... a mess.
Thank you!
What is the problem this feature will solve?
Currently:
shellcheckis run automatically on document changes, whileshfmtis exposed through formatting.Problems:
What is the feature you are proposing to solve the problem?
Bash IDE should expose both as vscode "Code Actions".
Using array syntax, which preserves ordering:
Or using object syntax, which exposes fine-grained policies:
Code actions are the modern approach for this behaviour. Other formatting/linting extensions already work this way, and could be used for guidance (e.g. ESLint, Prettier, ShellCheck).
Implications:
I've noticed that there are many issues related to settings and overlap between various extensions and tools. This approach would probably address many of them, as it's the recommended modern on-save behaviour in vscode.
References:
What alternatives have you considered?
Multiple extensions, multiple tools, using prettier for formatting, complex vscode settings... a mess.
Thank you!