Skip to content

refactor: run commands only if there is a valid GitLab project

Tomas Vik requested to merge 459-remote-config-2 into main

No change in user-facing behaviour

This MR is preparing a common way of invoking commands that need a valid GitLab project to run. Currently, each command has logic to retrieve the git repository and then check whether the extension can get a valid GitLab project from the API. This MR creates a runWithValidProject wrapper, that will wrap around the command and then invokes it with the project as an argument.

This MR only implements this new way of running commands for insertSnippet command.

This is how the command gets now defined:

[USER_COMMANDS.INSERT_SNIPPET]: runWithValidProject(insertSnippet)

This MR also removes the remote_name_provider module and puts its methods into more logical places.

Looking at the MR commit-by-commit might help understanding it (thanks to smaller logical chunks).

Related to #459 (closed)

Edited by Tomas Vik

Merge request reports