Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Insights for GitLabNew to Visual Studio Code? Get it now.
Insights for GitLab

Insights for GitLab

bahonavi

| (0) | Free
GitLab issue analytics in VS Code: local SQLite sync or an Insights for GitLab server, with a status bar freshness indicator and an issue tree.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Insights for GitLab in VS Code

GitLab issue analytics inside the editor. The extension hosts the Insights for GitLab dashboard in a webview and keeps your data in one of two ways, chosen per profile:

  • Local profile: the extension syncs issues from your GitLab with your own personal access token (PAT) into a SQLite database on your machine. No server is needed.
  • Remote profile: the extension shows a hosted Insights for GitLab server (for example a team instance). Nothing is stored locally; requests go through the extension host, so the server needs no CORS setup.

The extension is the @insights-for-gitlab/vscode workspace in this repository. It reuses @insights-for-gitlab/core (sync, rules, dashboard payload, and the bridge handlers in packages/core/src/host/, which apps/server shares for its rule and error handling) and the @insights-for-gitlab/ui SPA (packages/ui/); this directory only contains the editor glue: profiles, the lock, the webview, the views, and Git.

What you get

  • Insights for GitLab: Open Dashboard, Sync Now, Full Check, Switch Profile, Configure Connection in the Command Palette.
  • A status bar item: Insights · 4m ago, Insights · Syncing 2/3, or Insights · Remote. Clicking it opens the dashboard.
  • An Activity Bar view with the open issues grouped as Assigned to Me, Priority 1 / Urgent (the top priority of the active rules), and Stale Issues. Selecting an issue opens the dashboard with its drawer.
  • In the issue drawer: Copy #iid and Create branch, which creates and checks out <iid>-<title-slug> from HEAD in the first Git repository of the window. Without a repository, or with the Git extension disabled, the drawer shows a message instead.
  • In the rule editor, Export YAML opens VS Code's save dialog (a webview cannot download files).
  • The dashboard text follows your editor font size (editor.fontSize) and changes with it right away; the window zoom (window.zoomLevel) applies too.
  • Ctrl+F (Cmd+F on macOS) opens VS Code's find bar over the dashboard.
  • The dashboard keyboard shortcuts work as in the browser (press ?). VS Code can reserve Ctrl+H and Ctrl+L in some setups; the pane keys then do not reach the dashboard.
  • A read-only MCP server named Insights for GitLab (VS Code 1.101 or later) that lets chat agents search and summarise the synced issues. See Ask an AI assistant about your issues.

Setting up a connection

Open the dashboard (Insights for GitLab: Open Dashboard). With no profile yet, the onboarding dialog asks for either a GitLab URL and PAT (Local) or a server URL (Remote). The PAT is validated with GET /api/v4/user, projects are picked from GET /api/v4/projects?membership=true, and the first sync starts at once. A Local profile takes two tokens. The read token (read_api scope) is used for sync and reading. The optional write token (api scope) is used for creating and editing issues; without it the read token is used for changes too, and GitLab refuses them when that token only has read_api. Insights reads each token's scopes from GET /api/v4/personal_access_tokens/self when you validate it, and shows them in the dialog.

Where data lives

Profiles are listed in the extension's globalState; they never contain a token. Tokens are in VS Code SecretStorage under insightsForGitLab.token.<profile id> (read token) and insightsForGitLab.writeToken.<profile id> (write token). Each Local profile has its own directory under the extension's global storage:

<globalStorage>/profiles/<profile id>/insights.db     SQLite database (WAL)
<globalStorage>/profiles/<profile id>/rules/       the profile's rule files and .history/
<globalStorage>/profiles/<profile id>/scheduler.lock

Instances share nothing (see the plan's Instance Model): a new profile starts from the shipped default.yaml template, and rules can be copied between instances with the rule editor's export and import. Deleting a profile deletes its directory and its secret. Changing a Local profile's GitLab URL also deletes its stored issues and rules, because they belong to the previous GitLab instance (the edit dialog asks for confirmation first).

Local profile behavior

  • A single user owns the profile, so there is no admin login: the profile always counts as authenticated and can edit its rules.
  • Drawer calls (user, issue detail, uploads, labels, comments, label edits, project sync) carry the token the dashboard holds in its connect dialog, as in the browser build. When that is empty, the profile's write token is used for changes (the read token when there is no write token) and the read token for reading, so the drawer works without a separate token. The token is passed as an argument, never logged, and never written to the profile.
  • Sync runs on activation when the data is older than 2 minutes, every syncIntervalMinutes (default 5, 0 turns it off), and when the window gains focus while the data is older than 10 minutes. A full check (Insights compares every issue with GitLab, fetches issues that are missing or changed, and removes issues deleted in GitLab) runs about once a day, or on Full Check.
  • Run collector in the admin menu is a sync, Run processor re-derives the dashboard from stored issues without contacting GitLab.

Several windows

Every VS Code window has its own extension host. The database is opened in WAL mode with PRAGMA busy_timeout = 5000, so windows can read while one writes. Only one window runs the auto-sync scheduler: it holds scheduler.lock, a file with the owner id and a heartbeat written every 30 seconds. A lock without a heartbeat for 2 minutes is stale and another window takes it over. The other windows only read and reload when the database changed. Sync Now still works in any window (SQLite serializes the writes).

Takeover of a stale lock is not atomic: two windows that notice it at the same moment may both start the scheduler until their next heartbeat, when the loser sees it no longer owns the file and stops. The sync is idempotent, so the overlap is harmless.

Remote profile behavior

Before the first call the extension reads GET /api/health and requires api_version to be "1"; any other value, or a server that reports none, is refused with a message. The admin session cookie from the dashboard's admin login is held in memory only, so it is gone when the profile is closed. Reads are open; saving rules and running jobs need the admin login, as in the browser. For the drawer, the token the dashboard holds is sent as X-GitLab-Token, falling back to the profile's saved token, if any.

Remote workspaces (extensionKind)

extensionKind is ["workspace", "ui"]: with SSH, WSL, or a dev container the extension runs next to the workspace, where the built-in Git extension that Create branch needs also runs. Profiles and data then live on that remote machine (its own global storage) and its Node.js must support node:sqlite.

Requirements and node:sqlite

Local profiles use node:sqlite through @insights-for-gitlab/core's NodeSqliteDriver. It needs Node.js 22.13 or later in the editor's extension host. engines.vscode is ^1.101.0, the first VS Code release on Electron 35 (Node 22.14). Decision record:

  • sql.js was not chosen: it keeps the database in memory and rewrites the whole file on save, which needs a single-writer lock for correctness and loses WAL. node:sqlite gives real transactions, WAL, and concurrent readers, so the lock only decides who polls GitLab.
  • Editors that fork VS Code but ship an older Electron (some Cursor and Windsurf builds) can install the extension but not run Local profiles. The extension still activates: node:sqlite is imported only when a Local profile opens. In that case the dashboard shows an error that names node:sqlite, the status bar shows Insights · Unavailable, and Remote profiles keep working.

Build and package

From the repository root, with Node 22 (.nvmrc):

npm ci
npm run build -w @insights-for-gitlab/vscode      # core, ui dist-vscode, esbuild bundle, asset copy
npm run package -w @insights-for-gitlab/vscode    # apps/vscode/insights-for-gitlab-<version>.vsix
code --install-extension apps/vscode/insights-for-gitlab-2026.1.0.vsix

The build produces dist/extension.cjs (esbuild; vscode and node:sqlite are external), webview/ (the SPA built with vite build --mode vscode --base ./), template-rules/default.yaml (copied from packages/core/templates/rules/), and media/icon.png. The package script stages them in stage/ with a generated manifest named insights-for-gitlab (vsce rejects the scoped workspace name) and runs vsce package --no-dependencies; the bundle needs no node_modules.

Tests and type check: npm test -w @insights-for-gitlab/vscode and npm run typecheck -w @insights-for-gitlab/vscode. The tests use a hand-written vscode module (tests/vscodeMock.ts); the handler tests (real InsightsEngine, mocked GitLab) are in packages/core/tests/host/.

Releases: pushing a vYYYY.NN tag (for example v2026.01) runs .github/workflows/release.yml, which releases all variants together. For the extension it runs the tests, attaches the .vsix to the draft GitHub release, and publishes to the Visual Studio Marketplace and Open VSX when the VSCE_PAT and OVSX_PAT secrets exist (vsce and ovsx read them from the environment). The extension version is YYYY.N.0 (2026.1.0 for v2026.01); set it with node scripts/version.mjs set 2026.01, which also updates the other variants. Details are in docs/variants/how-to/build-from-source.md.

Known limits

  • The integration suite (test-integration/, run by .github/workflows/vscode-integration.yml) installs the packaged extension in a real VS Code under Xvfb. The unit tests still use a vscode mock; the webview, tree view, and Git integration are also covered by a manual check (see the plan's VS Code Extension End-to-End).
  • A window that does not own the scheduler lock shows the scheduler as off in the sync popover; it does not say which window is syncing.
  • The bundle is minified, so stack traces in the "Insights for GitLab" output channel are not readable.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft