VS Code - Single User per Window POC

Description

This MR contains a POC the "Single Account per Window" feature. In this description, I explain the key changes that we'll make.

Current logic

This section describes the current logic of project/account matching for context.

The sidebar, status bar and language server are powered by the project repository. This repository listens to the following changes:

  • Changes to git repositories in the Window (removing, adding, changing git remotes)
  • Changes to GitLab accounts (adding, removing)

Every time one of these changes happens, we go through a complex logic to:

  • gather all accounts and all git remotes
  • make API call for each project with each account to find out where we can match git remotes with accounts and gitlab project (simplifying here)
  • Showing the following UI in the sidebar
    • image - if there isn't GitLab project backing up the repository, or the current account doesn't have access to that project
    • image - if there was single - project-account match
    • image - if there are multiple matches
      • Example where two accounts and two remotes produce ambiguity:
        • account: viktomas, remote git@gitlab.com:gitlab-org/gitlab-vscode-extension.git - viktomas has access to the main project
        • account: vitkomas, remote git@gitlab.com:gitlab-org/security/gitlab-vscode-extension.git - viktomas has access to the security project
        • account: test-account, remote: git@gitlab.com:gitlab-org/gitlab-vscode-extension.git - another GitLab account has access to the public main project
      • In this case you click the tree item and get the following selection screen
        • image

Proposed changes

We create new UX for managing accounts, the original UX described above will only be concerned with git remotes (i.e. it will still prompt user to pick a project if the repository is backed by two or more valid remotes (e.g. git@gitlab.com:gitlab-org/gitlab-vscode-extension.git and git@gitlab.com:gitlab-org/security/gitlab-vscode-extension.git) because in that case we can't decide for the user.

New UX - Status bar item

We already have an issue VS Code: Implement Single account UI and intera... (#1378 - closed), on closer consideration I don't believe that we can ship this feature without the indicator.

state status bar when clicked
no account image run the authentication flow to add an account
multiple accounts available image chow change account UI
account selected (or only one available) image if multiple accounts available, then show change account UI, otherwise nothing

New UX - Change account

When user clicks on the status bar icon or invokes a command, we let them change the window account:

Click status bar item

Notice how the status bar label changes based on the account and how the sidebar panel reacts to the account changes.

change-account-ui

Run command

Running the GitLab: Select Account for Current Window command:

change-account-ui-command

New UX - Welcome view

In the case the window account hasn't been selected by the user, we show a welcome view in the sidebar:

welcome-view

Edited by Tomas Vik (OOO back on 2026-01-05)

Merge request reports

Loading