emeraldwalk / vscode-runonsave

Visual Studio Code extension to run commands whenever a file is saved.
Apache License 2.0
182 stars 57 forks source link

Add configuration options for status messages #83

Closed phagenlocher closed 2 months ago

phagenlocher commented 1 year ago

Configuration for status messages

This PR introduces configuration options to provide custom status messages to be shown when Run On Save starts, finishes and individual commands are being run. I see multiple use cases for this feature.

All new configuration options are optional. This PR retains the old status messages as the default.

Examples

Simple

To show the functionality by example: This will show Starting to sleep... for one second, I am sleeping again! for another second and finally Done sleeping!. Technically, Starting to sleep... could have been the message for the first command to achieve identical behavior.

"emeraldwalk.runonsave": {
    "messages": {
        "running": "Starting to sleep...",
        "done": "Done sleeping!"
    },
    "commands": [
        {
            "cmd": "sleep 1",
        },
        {
            "cmd": "sleep 1",
            "message": "I am sleeping again!"
        }
    ]
}

Empty idle message

This example shows a status message when a Ctags generator for Haskell files is being run and shows nothing otherwise.

"emeraldwalk.runonsave": {
    "messages": {
        "running": "",
        "done": "",
    },
    "commands": [
        {
            "match": ".hs",
            "cmd": "/root/.local/bin/hasktags -c /workspace/src/",
            "message": "Running hasktags..."
        }
    ]
}
phagenlocher commented 1 year ago

Thoughts @bmingles ?

bmingles commented 2 months ago

@phagenlocher Thanks for the PR. I like this idea. I'm in the process of refactoring some more fundamental pieces of how commands are run. I'm going to incorporate a slightly modified version of your idea in this PR https://github.com/emeraldwalk/vscode-runonsave/pull/98/files#diff-6bfea2ec3c1d21c90d6e1ecd704f380a6eeb44521e1da1a87b6a48ea691b6a43

More specifically I want to support this interface at both the top level + cmd level config:

export interface IMessageConfig {
  message?: string;
  messageAfter?: string;
  showElapsed: boolean;
}
bmingles commented 2 months ago

Closing as a duplicate of work that will be done on aforementioned PR