Skip to content

fix: limit command availability

Tomas Vik requested to merge 377-limit-command-availability into main

This MR limits when is it possible to run a command. This will reduce bug reports and user confusion, because we won't even show commands if they can't be run.

Most of the commands should not be run if the extension isn't in a valid state ("when": "gitlab:validState").

On top of that, commands that work on an open text editor make only sense when there is an open text editor "when": "gitlab:validState && editorIsOpen".

before after
no open workspace before-adding-when after-adding-when
trying to insert snippet when there is no repository before-invalid-insert-snippet after-invalid-insert-snippet

The following gif shows how we allow certain commands (e.g. insert snippet) only when there is an open editor.

insert-snippet-active-editor

Related to #377 (closed)

Merge request reports