Commit 542eac77 authored by Lennard Sprong's avatar Lennard Sprong Committed by Tomas Vik (OOO back on 2026-08-31)
Browse files

feat: Allow disabling Status bar items through VS Code UI

parent f0f03e54
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -127,18 +127,6 @@ If you use self-signed certificates to connect to your GitLab instance, read the
community-contributed
[settings for self-signed certificates](https://gitlab.com/gitlab-org/gitlab-vscode-extension/-/blob/main/docs/user/troubleshooting.md#settings-for-self-signed-certificates).

**`gitlab.showStatusBarLinks`** _(default: true)_

If you don't want to see GitLab-related links on the status bar, you can set this option to `false`. If you are using version 1.0.0 or later, you can also find the same links in sidebar. You should restart VS Code after updating this option.

**`gitlab.showIssueLinkOnStatusBar`** _(default: true)_

If you are not using the GitLab issue tracker, you can set this option to `false` to remove related issue links on the status bar. You should restart VS Code after updating this option.

**`gitlab.showMrStatusOnStatusBar`** _(default: true)_

You can toggle visibility of the merge request link in your sidebar. You can always find a merge request link in GitLab Workflow sidebar. You should restart VS Code after updating this option.

**`gitlab.pipelineGitRemoteName`** _(default: null)_

The name of the Git remote name corresponding to the GitLab repository with your pipelines. If set to `null` or missing, then the extension uses the same remote as for the non-pipeline features.
+7 −7
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
        "@types/sinon": "^10.0.13",
        "@types/source-map-support": "^0.5.4",
        "@types/temp": "^0.9.0",
        "@types/vscode": "^1.56.0",
        "@types/vscode": "^1.66.0",
        "@typescript-eslint/eslint-plugin": "^5.37.0",
        "@typescript-eslint/parser": "^5.37.0",
        "conventional-changelog-cli": "^2.1.1",
@@ -1696,9 +1696,9 @@
      "dev": true
    },
    "node_modules/@types/vscode": {
      "version": "1.56.0",
      "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.56.0.tgz",
      "integrity": "sha512-Q5VmQxOx+L1Y6lIJiGcJzwcyV3pQo/eiW8P+7sNLhFI16tJCwtua2DLjHRcpjbCLNVYpQM73kzfFo1Z0HyP9eQ==",
      "version": "1.66.0",
      "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.66.0.tgz",
      "integrity": "sha512-ZfJck4M7nrGasfs4A4YbUoxis3Vu24cETw3DERsNYtDZmYSYtk6ljKexKFKhImO/ZmY6ZMsmegu2FPkXoUFImA==",
      "dev": true
    },
    "node_modules/@types/yargs": {
@@ -12850,9 +12850,9 @@
      "dev": true
    },
    "@types/vscode": {
      "version": "1.56.0",
      "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.56.0.tgz",
      "integrity": "sha512-Q5VmQxOx+L1Y6lIJiGcJzwcyV3pQo/eiW8P+7sNLhFI16tJCwtua2DLjHRcpjbCLNVYpQM73kzfFo1Z0HyP9eQ==",
      "version": "1.66.0",
      "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.66.0.tgz",
      "integrity": "sha512-ZfJck4M7nrGasfs4A4YbUoxis3Vu24cETw3DERsNYtDZmYSYtk6ljKexKFKhImO/ZmY6ZMsmegu2FPkXoUFImA==",
      "dev": true
    },
    "@types/yargs": {
+7 −4
Original line number Diff line number Diff line
@@ -645,17 +645,20 @@
        "gitlab.showStatusBarLinks": {
          "type": "boolean",
          "default": true,
          "description": "Whether to display all GitLab related link in the status bar (Requires restart of VSCode)"
          "description": "Display all GitLab-related links in the status bar (requires restarting Visual Studio Code)",
          "deprecationMessage": "To hide an item from the status bar, you should right-click the item in Visual Studio Code."
        },
        "gitlab.showIssueLinkOnStatusBar": {
          "type": "boolean",
          "default": true,
          "description": "Whether to display the GitLab issue link in the status bar"
          "description": "Display the GitLab issue link in the status bar",
          "deprecationMessage": "To hide an item from the status bar, you should right-click the item in Visual Studio Code."
        },
        "gitlab.showMrStatusOnStatusBar": {
          "type": "boolean",
          "default": true,
          "description": "Whether to display the GitLab Merge Request status in the status bar"
          "description": "Display the GitLab merge request status in the status bar",
          "deprecationMessage": "To hide an item from the status bar, you should right-click the item in Visual Studio Code."
        },
        "gitlab.ca": {
          "type": "string",
@@ -1024,7 +1027,7 @@
    "@types/sinon": "^10.0.13",
    "@types/source-map-support": "^0.5.4",
    "@types/temp": "^0.9.0",
    "@types/vscode": "^1.56.0",
    "@types/vscode": "^1.66.0",
    "@typescript-eslint/eslint-plugin": "^5.37.0",
    "@typescript-eslint/parser": "^5.37.0",
    "conventional-changelog-cli": "^2.1.1",
+26 −4
Original line number Diff line number Diff line
@@ -42,9 +42,20 @@ const createStatusTextFromJobs = (jobs: RestJob[], status: string) => {
  return statusText;
};

const createStatusBarItem = (text: string, command?: string | vscode.Command) => {
  const statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
  statusBarItem.text = text;
const createStatusBarItem = (
  priority: number,
  id: string,
  name: string,
  initialText: string,
  command?: string | vscode.Command,
) => {
  const statusBarItem = vscode.window.createStatusBarItem(
    id,
    vscode.StatusBarAlignment.Left,
    priority,
  );
  statusBarItem.name = name;
  statusBarItem.text = initialText;
  statusBarItem.show();

  if (command) {
@@ -189,13 +200,24 @@ export class StatusBar {
    assert(!this.pipelineStatusBarItem, 'The status bar is already initialized');
    if (showStatusBarLinks) {
      this.pipelineStatusBarItem = createStatusBarItem(
        2,
        'gl.status.pipeline',
        'GitLab Workflow: Pipeline',
        '$(info) GitLab: Fetching pipeline...',
        USER_COMMANDS.PIPELINE_ACTIONS,
      );
      if (showMrStatusOnStatusBar) {
        this.mrStatusBarItem = createStatusBarItem('$(info) GitLab: Finding MR...');
        this.mrStatusBarItem = createStatusBarItem(
          1,
          'gl.status.mr',
          'GitLab Workflow: Merge Request',
          '$(info) GitLab: Finding MR...',
        );
        if (showIssueLinkOnStatusBar) {
          this.mrIssueStatusBarItem = createStatusBarItem(
            0,
            'gl.status.issue',
            'GitLab Workflow: Issue',
            '$(info) GitLab: Fetching closing issue...',
          );
        }
+1 −4
Original line number Diff line number Diff line
@@ -50,10 +50,7 @@ describe('GitLab status bar', () => {
    refresher.init(statusBar, currentBranchDataProvider);
    await refresher.refresh();

    assert.strictEqual(
      vscode.window.createStatusBarItem.firstCall.firstArg,
      vscode.StatusBarAlignment.Left,
    );
    assert.strictEqual(vscode.window.createStatusBarItem.firstCall.firstArg, 'gl.status.pipeline');
    const pipelineItem = statusBar.pipelineStatusBarItem;
    assert.strictEqual(pipelineItem.text, '$(check) GitLab: Pipeline passed');
    assert.strictEqual(pipelineItem.show.called, true);