ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
460 stars 88 forks source link

Command to toggle coverage #378

Closed yushiyangk closed 1 year ago

yushiyangk commented 1 year ago

Instead of having two separate keybindings for displaying and removing coverage gutters, it would be great if I could bind a single shortcut to toggle it on or off.

This would be similar to e.g. how GitLens controls blame annotations.

ryanluker commented 1 year ago

@yushiyangk thanks for the issue! It shouldn't be too tough to add a new keybinding and command that just works the display / remove logic in a toggle kinda way. One hurdle might be that we don't have a great way to know the "state" of the extension (other then the status toggler heh).

    /**
     * update
     * @description Updates the text and tooltip displayed by the StatusBarToggler
     */
    private update() {
        this.statusBarItem.text = this.getStatusBarText();

        if (this.isActive) {
            this.statusBarItem.command = StatusBarToggler.removeCommand;
            this.statusBarItem.tooltip = StatusBarToggler.removeWatchToolTip;
        } else {
            this.statusBarItem.command = StatusBarToggler.watchCommand;
            this.statusBarItem.tooltip = StatusBarToggler.watchToolTip;
        }
    }
anishkny commented 1 year ago

Taking a stab at this in #385 (just copy-pasting my way to success lol) - please feel free to suggest changes.

Kudos on developing and maintaining an excellent and useful extension by the way! 🎉🎉🎉