# sonarsource/sonarlint-vscode architecture

> Architecture diagram of the GitHub repository sonarsource/sonarlint-vscode, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sonarsource/sonarlint-vscode
- Repository: https://github.com/sonarsource/sonarlint-vscode

## Overview

This repository is a Visual Studio Code extension for SonarQube for IDE (formerly SonarLint). Its core job is to analyze files in the editor, surface issues in VS Code, and optionally synchronize rules/settings with SonarQube Server or SonarQube Cloud in Connected Mode.

1. **Runtime boundary**
   - The main product runs inside the VS Code extension host, with the extension entry point in `src/extension.ts`.
   - It is not a standalone app: VS Code provides the UI shell, editor events, and command system, while this repo supplies analysis, diagnostics, views, and webviews.

2. **Analysis engine integration**
   - The repository contains an LSP boundary in `src/lsp/client.ts`, `src/lsp/server.ts`, and `src/lsp/protocol.ts`.
   - This is the main technical seam between the extension UI/state layer and the language-analysis backend.
   - Analysis results ultimately flow back into VS Code diagnostics and issue nodes shown in the Problems panel and custom trees.

3. **File, workspace, and language-specific processing**
   - `src/fileSystem/*` abstracts file access and subscriptions to file-system changes.
   - Language-specific integration is split into areas like `src/java/*`, `src/cfamily/*`, `src/secrets/*`, and rules/helpers under `src/rules/*`.
   - This indicates the extension is multi-language, but not all language support is handled identically; some analyzers likely require extra runtime support or platform-specific setup.

4. **Connected Mode and server synchronization**
   - `src/connected/*` handles binding to SonarQube/SonarCloud, automatic connection flows, and shared settings.
   - This is the main boundary to external services and changes the analysis behavior by importing remote quality profiles, project configuration, and broader language support.
   - The repository’s README confirms Connected Mode unlocks deeper rulesets and additional languages.

5. **Issue and findings model**
   - Findings are modeled in `src/findings/*` with typed nodes for hotspots, taint vulnerabilities, dependency risk, notebooks, and generic findings.
   - `src/issue/*` contains the issue abstraction and resolution logic, so the extension distinguishes between detecting an issue, representing it in the UI, and resolving/remediating it.
   - This model is what drives the Findings tree and related code-navigation interactions.

6. **UI surfaces inside VS Code**
   - `src/statusbar/*`, `src/plugin/pluginStatusPanel.ts`, `src/remediationPanel/*`, `src/hotspot/*`, `src/help/*`, and `src/labs/*` define the extension’s user-facing panels and tree views.
   - `webview-ui/*` and `styles/*` provide the static HTML/JS/CSS for those webviews.
   - The repo is therefore split between VS Code-native UI elements (status bar, tree views, commands) and embedded webview apps for richer interactions.

7. **AI-assisted features**
   - `src/aiAgentsConfiguration/*` and `src/languageModelTools/*` add AI-related configuration and tools.
   - These tools appear to support actions such as analyzing a file, excluding files/folders, listing security issues, and setting up Connected Mode.
   - This is a distinct feature boundary layered on top of the standard analysis workflow, not the core analyzer itself.

8. **Monitoring, telemetry, and dogfooding**
   - `src/monitoring/*` covers archiving, diagnostics execution, flight recording, process management, and recording storage.
   - `telemetry-sample.md` and `src/util/utm.ts` show that anonymous usage telemetry is part of the product architecture.
   - The `dogfood/` folder is a separate self-hosted extension package used for internal validation and likely exercises the same extension behavior against real workflows.

9. **Command and context orchestration**
   - `src/commandsManager.ts`, `src/contextManager.ts`, and helpers under `src/util/*` coordinate activation, command registration, state, and shared utilities.
   - This is the glue layer that connects editor events, settings, tree providers, diagnostics, and webviews into one coherent extension lifecycle.

10. **Settings, labs, and feature gating**
   - `src/settings/*` manages user and connected-mode settings, including analysis behavior and connection settings.
   - `src/labs/*` suggests experimental or feature-flagged capabilities, likely surfaced through a dedicated webview and gated by management services.
   - This separation matters architecturally because some capabilities are optional, controlled remotely, or enabled only for certain users.

11. **Source-control and code-change context**
   - `src/scm/*`, `src/newcode/*`, and `src/rules/code-diff.ts` indicate support for diff-aware and SCM-aware workflows.
   - This likely feeds new-code definitions, code-diff presentation, and issue prioritization based on modified files or recent changes.

12. **Build, packaging, and release pipeline**
   - `build-sonarlint/*` contains the packaging/deployment toolchain, including hashing, signing, JRE download, SBOM generation, and release publishing.
   - `.github/workflows/*` and `.github/actions/*` define CI, release, scanning, publishing to extension marketplaces, and release gating.
   - This repo has a serious release engineering layer because it produces signed VSIX artifacts and coordinates marketplace publication.

13. **Integration and sample test harnesses**
   - `its/` contains integration-test workspaces and sample projects across languages and file types; it exercises the extension against realistic project layouts.
   - `test/` contains unit tests for most subsystems, while `its/src/test/*` drives end-to-end extension scenarios.
   - The presence of many sample workspaces suggests the architecture is validated by language/workspace shape, not just by isolated unit tests.

14. **Key external dependencies**
   - The primary external systems are VS Code itself, SonarQube Server/Cloud, and marketplace/publishing infrastructure.
   - Java support also implies a downloaded JRE/runtime component, managed by build/runtime code rather than bundled uniformly with the extension.

Overall, the architecture is centered on a VS Code extension host that orchestrates local analysis, connected-mode synchronization, and multiple UI surfaces, with a clear split between backend analysis services, VS Code-facing presentation layers, and release/operations tooling.

Main entry points: [`src/extension.ts`](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/extension.ts) (Extension), [`src/lsp/server.ts`](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/lsp/server.ts) (LSP Server), [`src/connected/connections.ts`](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/connected/connections.ts) (Connected Mode), [`webview-ui/pluginStatus.html`](https://github.com/sonarsource/sonarlint-vscode/blob/master/webview-ui/pluginStatus.html) (Webviews)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Extension Runtime"]
  node_src_extension["Extension<br/>entrypoint<br/>[extension.ts]"]
  node_commands_manager["Commands<br/>orchestration<br/>[commandsManager.ts]"]
  node_context_manager["Context<br/>state orchestration<br/>[contextManager.ts]"]
  node_settings["Settings<br/>configuration<br/>[settings.ts]"]
  node_scm_newcode["SCM and New Code<br/>diff context<br/>[scm.ts]"]
end

subgraph group_ui["VS Code UI"]
  node_status_panel["Status Panel<br/>native ui<br/>[statusBar.ts]"]
  node_plugin_panel["Plugin Panel<br/>native ui"]
  node_findings_view["Findings View<br/>tree view"]
  node_remediation_ui["Remediation<br/>panel/webview"]
  node_labs_ui["Labs<br/>experimental ui"]
  node_help_ui["Help<br/>support view"]
  node_webviews["Webviews<br/>frontend assets<br/>[pluginStatus.html]"]
end

subgraph group_backend["Analysis Backend"]
  node_lsp_client["LSP Client<br/>protocol client<br/>[client.ts]"]
  node_lsp_server["LSP Server<br/>analysis server<br/>[server.ts]"]
  node_file_system["File System<br/>workspace io"]
  node_language_nodes["Languages<br/>language adapters<br/>[java.ts]"]
  node_findings_model["Findings<br/>issue model"]
  node_issue_resolution["Issues<br/>resolution logic<br/>[issue.ts]"]
end

subgraph group_connected["Connected Mode"]
  node_connected_mode["Connected Mode<br/>server sync<br/>[connections.ts]"]
  node_connection_setup["Connection Setup<br/>binding flow<br/>[connectionsetup.ts]"]
  node_shared_settings["Shared Settings<br/>sync settings"]
end

subgraph group_ops["Build and Operations"]
  node_monitoring["Monitoring<br/>telemetry and diagnostics<br/>[monitoring.ts]"]
  node_build_release["Build and Release<br/>packaging pipeline<br/>[package.mjs]"]
  node_dogfood_pkg["Dogfood<br/>internal package<br/>[extension.ts]"]
end

node_src_extension -->|"registers"| node_commands_manager
node_src_extension -->|"initializes"| node_context_manager
node_src_extension -->|"starts"| node_lsp_client
node_lsp_client -->|"protocol"| node_lsp_server
node_lsp_server -->|"reads"| node_file_system
node_lsp_server -->|"adapts"| node_language_nodes
node_lsp_server -->|"produces"| node_findings_model
node_findings_model -->|"delegates"| node_issue_resolution
node_issue_resolution -->|"feeds"| node_remediation_ui
node_src_extension -->|"enables"| node_connected_mode
node_connected_mode -->|"uses"| node_connection_setup
node_connected_mode -->|"syncs"| node_shared_settings
node_src_extension -->|"loads"| node_settings
node_src_extension -->|"consumes"| node_scm_newcode
node_src_extension -->|"shows"| node_status_panel
node_src_extension -->|"renders"| node_plugin_panel
node_src_extension -->|"publishes"| node_findings_view
node_src_extension -->|"offers"| node_help_ui
node_src_extension -->|"gates"| node_labs_ui
node_labs_ui -->|"loads"| node_webviews
node_plugin_panel -->|"loads"| node_webviews
node_remediation_ui -->|"loads"| node_webviews
node_monitoring -.->|"validates"| node_dogfood_pkg
node_build_release -->|"packages"| node_dogfood_pkg
node_build_release -.->|"instruments"| node_monitoring

click node_src_extension "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/extension.ts"
click node_commands_manager "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/commandsManager.ts"
click node_context_manager "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/contextManager.ts"
click node_lsp_client "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/lsp/client.ts"
click node_lsp_server "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/lsp/server.ts"
click node_file_system "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/fileSystem/fileSystemServiceImpl.ts"
click node_language_nodes "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/java/java.ts"
click node_findings_model "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/findings/findingsTreeDataProvider.ts"
click node_issue_resolution "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/issue/issue.ts"
click node_connected_mode "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/connected/connections.ts"
click node_connection_setup "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/connected/connectionsetup.ts"
click node_shared_settings "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/connected/sharedConnectedModeSettingsService.ts"
click node_status_panel "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/statusbar/statusBar.ts"
click node_plugin_panel "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/plugin/pluginStatusPanel.ts"
click node_findings_view "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/findings/findingsTreeDataProvider.ts"
click node_remediation_ui "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/remediationPanel/remediationWebviewProvider.ts"
click node_labs_ui "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/labs/labsWebviewProvider.ts"
click node_help_ui "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/help/helpAndFeedbackTreeDataProvider.ts"
click node_webviews "https://github.com/sonarsource/sonarlint-vscode/blob/master/webview-ui/pluginStatus.html"
click node_settings "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/settings/settings.ts"
click node_scm_newcode "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/scm/scm.ts"
click node_monitoring "https://github.com/sonarsource/sonarlint-vscode/blob/master/src/monitoring/monitoring.ts"
click node_build_release "https://github.com/sonarsource/sonarlint-vscode/blob/master/build-sonarlint/package.mjs"
click node_dogfood_pkg "https://github.com/sonarsource/sonarlint-vscode/blob/master/dogfood/src/extension.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_src_extension,node_commands_manager,node_context_manager,node_settings,node_scm_newcode toneBlue
class node_status_panel,node_plugin_panel,node_findings_view,node_remediation_ui,node_labs_ui,node_help_ui,node_webviews toneAmber
class node_lsp_client,node_lsp_server,node_file_system,node_language_nodes,node_findings_model,node_issue_resolution toneMint
class node_connected_mode,node_connection_setup,node_shared_settings toneRose
class node_monitoring,node_build_release,node_dogfood_pkg toneIndigo
```

## Components

### Extension Runtime

VS Code extension host, orchestration, analysis, and state

- [Extension](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/extension.ts): entrypoint · Activates the VS Code extension and wires the main lifecycle · `src/extension.ts`
- [Commands](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/commandsManager.ts): orchestration · Registers commands and coordinates user-triggered actions · `src/commandsManager.ts`
- [Context](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/contextManager.ts): state orchestration · Tracks shared extension state and activation context · `src/contextManager.ts`
- [Settings](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/settings/settings.ts): configuration · Automatic analysis, connection, and user settings · `src/settings/settings.ts`
- [SCM and New Code](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/scm/scm.ts): diff context · Git-aware and new-code-aware prioritization for analysis and issues · `src/scm/scm.ts`

### VS Code UI

Native views, panels, and embedded webviews

- [Status Panel](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/statusbar/statusBar.ts): native ui · Status bar and plugin status surface in VS Code · `src/statusbar/statusBar.ts`
- [Plugin Panel](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/plugin/pluginStatusPanel.ts): native ui · Tree or panel view for plugin status and health · `src/plugin/pluginStatusPanel.ts`
- [Findings View](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/findings/findingsTreeDataProvider.ts): tree view · VS Code tree views for findings and issue navigation · `src/findings/findingsTreeDataProvider.ts`
- [Remediation](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/remediationPanel/remediationWebviewProvider.ts): panel/webview · Remediation and fix-suggestion surface for selected issues · `src/remediationPanel/remediationWebviewProvider.ts`
- [Labs](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/labs/labsWebviewProvider.ts): experimental ui · Feature-gated labs view and management surface · `src/labs/labsWebviewProvider.ts`
- [Help](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/help/helpAndFeedbackTreeDataProvider.ts): support view · Help and feedback tree provider with support links · `src/help/helpAndFeedbackTreeDataProvider.ts`
- [Webviews](https://github.com/sonarsource/sonarlint-vscode/blob/master/webview-ui/pluginStatus.html): frontend assets · Static HTML, JS, and CSS for embedded extension webviews · `webview-ui/pluginStatus.html`

### Analysis Backend

Language analysis, file access, and issue modeling

- [LSP Client](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/lsp/client.ts): protocol client · Extension-side boundary to the analysis server · `src/lsp/client.ts`
- [LSP Server](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/lsp/server.ts): analysis server · Backend analysis process that produces diagnostics and findings · `src/lsp/server.ts`
- [File System](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/fileSystem/fileSystemServiceImpl.ts): workspace io · Abstracts file access and file-system subscriptions · `src/fileSystem/fileSystemServiceImpl.ts`
- [Languages](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/java/java.ts): language adapters · Language-specific integration for Java, C/C++, and secrets · `src/java/java.ts`
- [Findings](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/findings/findingsTreeDataProvider.ts): issue model · Typed findings and tree nodes for hotspots, taint, dependency risk, and notebooks · `src/findings/findingsTreeDataProvider.ts`
- [Issues](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/issue/issue.ts): resolution logic · Issue abstraction and resolution/remediation handling · `src/issue/issue.ts`

### Connected Mode

Synchronization and remote configuration

- [Connected Mode](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/connected/connections.ts): server sync · Binds the extension to SonarQube Server or SonarQube Cloud · `src/connected/connections.ts`
- [Connection Setup](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/connected/connectionsetup.ts): binding flow · Automatic binding and assisted connection creation · `src/connected/connectionsetup.ts`
- [Shared Settings](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/connected/sharedConnectedModeSettingsService.ts): sync settings · Stores and applies connected-mode settings across the extension · `src/connected/sharedConnectedModeSettingsService.ts`

### Build and Operations

Packaging, telemetry, monitoring, and dogfooding

- [Monitoring](https://github.com/sonarsource/sonarlint-vscode/blob/master/src/monitoring/monitoring.ts): telemetry and diagnostics · Archiving, flight recording, diagnostics, and process management · `src/monitoring/monitoring.ts`
- [Build and Release](https://github.com/sonarsource/sonarlint-vscode/blob/master/build-sonarlint/package.mjs): packaging pipeline · Packaging, signing, SBOM generation, deployment, and release automation · `build-sonarlint/package.mjs`
- [Dogfood](https://github.com/sonarsource/sonarlint-vscode/blob/master/dogfood/src/extension.ts): internal package · Self-hosted validation extension used for internal workflows · `dogfood/src/extension.ts`

## Connections

- Extension → Commands: registers · Extension activation wires command handlers
- Extension → Context: initializes · Sets up shared state and activation context
- Extension → LSP Client: starts · Boots the language-analysis client
- LSP Client → LSP Server: protocol · Sends requests and receives diagnostics/results
- LSP Server → File System: reads · Analyzes workspace files through the file-system layer
- LSP Server → Languages: adapts · Runs language-specific analysis and setup
- LSP Server → Findings: produces · Maps analysis output into typed findings
- Findings → Issues: delegates · Issue nodes connect to resolution and remediation logic
- Issues → Remediation: feeds · Selected issues drive remediation experiences
- Extension → Connected Mode: enables · Activates connected-mode workflows when bound
- Connected Mode → Connection Setup: uses · Supports assisted and automatic binding flows
- Connected Mode → Shared Settings: syncs · Applies shared configuration from the server
- Extension → Settings: loads · Reads analysis and connection settings
- Extension → SCM and New Code: consumes · Uses SCM and new-code context for prioritization
- Extension → Status Panel: shows · Surfaces extension status in the VS Code chrome
- Extension → Plugin Panel: renders · Exposes plugin state and health views
- Extension → Findings View: publishes · Provides issue and finding trees to the UI
- Extension → Help: offers · Exposes help and feedback navigation
- Extension → Labs: gates · Hosts experimental features behind labs management
- Labs → Webviews: loads · Uses embedded webview assets for richer UI
- Plugin Panel → Webviews: loads · Renders via static webview assets
- Remediation → Webviews: loads · Renders remediation content through webview assets
- Monitoring → Dogfood: validates · Dogfood exercises the extension in realistic workflows
- Build and Release → Dogfood: packages · Build tooling supports internal and release packaging
- Build and Release → Monitoring: instruments · Release engineering includes diagnostics and telemetry support
