Skip to content

[Feature Request] Expose shellcheck and shfmt as vscode code actions #1395

Description

@lonix1

What is the problem this feature will solve?

Currently: shellcheck is run automatically on document changes, while shfmt is exposed through formatting.

That makes it difficult to control when they are run, and one cannot control their order.

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.bashide-format",
    "source.fixAll.bashide-lint"
  ]
}

Or using object syntax, which exposes fine-grained policies:

"[shellscript]": {
  "editor.codeActionsOnSave": {
    "source.fixAll.bashide-format": "explicit",
    "source.fixAll.bashide-lint": "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 extension, Prettier extension, ShellCheck extension).

Implications:

  • Control lint/format-on-save behaviour from vscode settings
  • Control each operation independently, enforce ordering
  • Follow modern approach of letting the editor control save-time behaviour rather than hard-coding triggers in extension logic

I've noticed 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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions