Repository navigation
Roll out LSP semantic highlighting in Visual Studio #20965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
abonie
wants to merge
50
commits into
main
Choose a base branch
from
lsp/semantic-tokens
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
f28a6d2
VSIX packaging cleanup and semantic tokens removal
abonie 1dbfff0
Diagnostics enhancements: severity, project info, settings toggle
abonie 4368dcd
Add ProjectContexts endpoint (textDocument/_vs_getProjectContexts)
abonie ec71801
Add code actions handler for textDocument/codeAction
abonie 9e424bf
Add telemetry instrumentation for LSP server
abonie fab999f
Add LSP integration tests (Apex test infrastructure)
abonie 80fa009
Add VS local development and MCP testing skills
abonie 242b7ac
Add copilot skills for VS integration
abonie bcf3fbd
Use project context when querying workspace
abonie cf995b2
Default diagnostics rollout to old extension
abonie 0f889f6
Re-introduce semantic tokens endpoint and disable LSP diagnostics
abonie fad499f
Align rebased LSP projects with central package management
abonie 5c25ade
Align LSP dependencies and serialization; fix CLI event highlighting
abonie 9d0176c
Fix LSP highlighting after target framework switches
abonie 0f64a67
Align FSharp.Editor LSP client dependencies with Roslyn
abonie 636b4f2
Upgrade F# LSP extension to Extensibility 18.5 and .NET 10
abonie d5b6a4f
Bump VS Extensibility packages
abonie c236379
Bridge legacy and LSP highlighting telemetry
abonie 810dc71
Rename vs-mcp-testing-tools dir
abonie ec21061
Run fantomas
abonie 468b7f0
Gate VS LSP startup on provider selection and preserve unset settings
abonie 63950d7
Bound semantic token processing by line and honor cancellation
abonie 8e1c5bd
Merge semantic tokens perf and cancellation fixes
abonie 2525ac1
Merge VS provider gating, settings and Apex test fixes
abonie f67793d
Correct experimental LSP code action edits
abonie a1e96f8
Clarify synchronous code-fix registration
abonie 7a5c6ff
Merge LSP code action fixes
abonie f465972
Update workspace API baseline, run LSP tests in CI, and track STJ thr…
abonie d4416ba
Preserve legacy classification for closed and preview documents under…
abonie a95c6ac
Merge FCS surface area, LSP test CI and System.Text.Json tracking fixes
abonie db1383b
Avoid duplicate semantic classification in miscellaneous editor buffers
abonie a8e0199
Merge legacy classification fallback for documents LSP does not render
abonie ad7053d
Require net10.0 in vsixmanifest
abonie d29393e
Don't try to start the server when LSP is off
abonie a0f24cd
Remove unnecessary pragmas for now stable apis
abonie 8a2b4ff
Build LSP projects in FSharp.slnx and skip PDB check for extension tests
abonie 9511165
Send active project context URIs as absolute file URIs
abonie 406baf9
Keep legacy classification for scripts and loose files under LSP
abonie b28468e
Merge branch 'main' into lsp/semantic-tokens
abonie 4e3377b
Merge branch 'main' into lsp/semantic-tokens
abonie faf942a
Merge branch 'main' into lsp/semantic-tokens
abonie a965bfe
Fix bad merge
abonie b975725
Run LSP Apex tests in the RoslynDev hive
abonie 846ad00
Merge branch 'main' into lsp/semantic-tokens
abonie c8080fa
Keep the RoslynDev root suffix in LSP Apex host arguments
abonie 578415b
Merge remote-tracking branch 'upstream/lsp/semantic-tokens' into lsp/…
abonie bab595b
Expect F# token types in the LSP semantic highlighting Apex test
abonie eedb6c3
Fix LSP highlighting review regressions
abonie d1baf60
Answer every LSP semantic-token request without cancel-and-drain
abonie d31aa95
Send LSP semantic token refreshes from a queue outside the request queue
abonie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| --- | ||
| name: vs-local-development | ||
| description: Guide for local Visual Studio extension development, building, deploying, and testing the VS extension (VisualFSharp) in the experimental instance. | ||
| license: MIT | ||
| --- | ||
|
|
||
| # Local Visual Studio Extension Development | ||
|
|
||
| This skill provides guidance on building, deploying, and iterating on the Visual Studio extension locally using the experimental instance of Visual Studio. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Visual Studio 2026 installed with the **Visual Studio extension development** workload | ||
| - The `vs-mcp-testing-tools` skill must be loaded to understand how to use the MCP tools for testing after deployment | ||
|
|
||
| ## Rebuild & Deploy Workflow | ||
|
|
||
| After making code changes to the VS extension, follow these steps **in order** to rebuild and deploy: | ||
|
|
||
| ### 1. Close All Experimental VS Instances | ||
|
|
||
| Run the helper script to close any running experimental instances: | ||
|
|
||
| ```powershell | ||
| .github/skills/vs-local-development/scripts/close-exp-instances.ps1 | ||
| ``` | ||
|
|
||
| This kills all `devenv.exe` processes launched with `/rootsuffix`. | ||
|
|
||
| ### 2. Rebuild the Solution | ||
|
|
||
| Run the build script: | ||
|
|
||
| ```powershell | ||
| ./Build.cmd -c Debug | ||
| ``` | ||
|
|
||
| ### 3. Deploy the VSIX | ||
|
|
||
| Use the deploy script to install the VSIX, wait for the installer to finish, and clear caches in one step: | ||
|
|
||
| ```powershell | ||
| .github/skills/vs-local-development/scripts/deploy-to-vs.ps1 "artifacts\VSSetup\Debug\VisualFSharpDebug.vsix" | ||
| ``` | ||
|
|
||
| This script: | ||
| - Installs the VSIX into the experimental hive (`/rootSuffix:exp`) | ||
|
|
||
| **Shell requirement:** `VSIXInstaller.exe` and `devenv.exe` must be on `PATH`. Run from a **Visual Studio Developer PowerShell** / **Developer Command Prompt**, or use the discovery snippet below. | ||
|
|
||
| ### Finding devenv.exe | ||
|
|
||
| VS installation folders use **numeric version identifiers** (e.g., `18`), not marketing years (e.g., `2026`), and may be under `Program Files` or `Program Files (x86)`. Editions vary (`IntPreview`, `Enterprise`, `Preview`, `Community`, etc.). | ||
|
|
||
| Use this snippet to find `devenv.exe` dynamically: | ||
|
|
||
| ```powershell | ||
| $devenv = Get-ChildItem "${env:ProgramFiles}\Microsoft Visual Studio","${env:ProgramFiles(x86)}\Microsoft Visual Studio" ` | ||
| -Filter "devenv.exe" -Recurse -ErrorAction SilentlyContinue | | ||
| Where-Object { $_.FullName -match 'Common7\\IDE\\devenv\.exe$' } | | ||
| Select-Object -First 1 -ExpandProperty FullName | ||
|
|
||
| if (-not $devenv) { Write-Error "devenv.exe not found"; exit 1 } | ||
| Write-Host "Using: $devenv" | ||
| ``` | ||
|
|
||
| Then source the Developer environment and deploy: | ||
|
|
||
| ```powershell | ||
| $vsDir = Split-Path (Split-Path (Split-Path $devenv)) # …\Common7\IDE → VS root | ||
| & "$vsDir\Common7\Tools\VsDevCmd.bat" | ||
| .github/skills/vs-local-development/scripts/deploy-to-vs.ps1 "artifacts\VSSetup\Debug\VisualFSharpDebug.vsix" | ||
| ``` | ||
|
|
||
| ### 4. Reopen VS | ||
|
|
||
| The extension is now installed. Open the experimental instance normally: | ||
|
|
||
| ```powershell | ||
| devenv /rootsuffix exp | ||
| ``` | ||
|
|
||
| ## Quick Reference (Copy-Paste) | ||
|
|
||
| Full sequence for a rebuild cycle: | ||
|
|
||
| ```powershell | ||
| # 1. Stop experimental instances | ||
| .github/skills/vs-local-development/scripts/close-exp-instances.ps1 | ||
|
|
||
| # 2. Rebuild | ||
| ./Build.cmd -c Debug | ||
|
|
||
| # 3. Deploy VSIX (install, wait, clear caches) | ||
| .github/skills/vs-local-development/scripts/deploy-to-vs.ps1 "artifacts\VSSetup\Debug\VisualFSharpDebug.vsix" | ||
|
|
||
| # 4. Reopen VS with the updated extension | ||
| devenv /rootsuffix exp | ||
| ``` | ||
|
|
||
| ## Key Concepts | ||
|
|
||
| ### Experimental Instance | ||
|
|
||
| Visual Studio supports **experimental instances** (`/rootsuffix exp`) — isolated environments with separate extension registrations and settings. This allows developing and testing extensions without affecting your main VS installation. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| | Problem | Solution | | ||
| |---|---| | ||
| | VSIX install fails | Ensure all experimental VS instances are closed (`.github/skills/vs-local-development/scripts/close-exp-instances.ps1`) | | ||
| | Extension not appearing in VS | Re-run `deploy-to-vs.ps1` or manually run `devenv /rootsuffix exp /clearcache` and `/updateconfiguration` | | ||
| | Old version still loaded | Delete `artifacts/` and rebuild | | ||
| | `devenv.exe` not found | VS folders use numeric versions (e.g., `18`), not years. Use the discovery snippet in the Deploy section above | | ||
|
|
||
| ## When to Use This Skill | ||
|
|
||
| Use this skill when: | ||
|
|
||
| - Making changes to the VS extension (`VisualFSharpFull` or `VisualFSharpDebug`) | ||
| - Needing to test extension changes locally in Visual Studio | ||
| - Troubleshooting VSIX deployment to the experimental instance | ||
| - Setting up a local VS extension development loop | ||
|
|
||
| ## Related | ||
|
|
||
| - [vs-mcp-testing-tools](../vs-mcp-testing-tools/SKILL.md) — for automating VS via MCP tools after the extension is deployed |
7 changes: 7 additions & 0 deletions
7
.github/skills/vs-local-development/scripts/close-exp-instances.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # Closes all devenv.exe processes launched with /rootsuffix (experimental instances). | ||
| Get-CimInstance Win32_Process -Filter "Name = 'devenv.exe'" | | ||
| Where-Object { $_.CommandLine -match '/rootsuffix\s+\S+' } | | ||
| ForEach-Object { | ||
| Write-Host "Stopping devenv.exe (PID $($_.ProcessId)): $($_.CommandLine)" | ||
| Stop-Process -Id $_.ProcessId -Force | ||
| } | ||
57 changes: 57 additions & 0 deletions
57
.github/skills/vs-local-development/scripts/deploy-to-vs.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <# | ||
| .SYNOPSIS | ||
| Deploys a VSIX to the Visual Studio experimental instance. | ||
| .DESCRIPTION | ||
| Installs a VSIX into the experimental hive, waits for the installer to | ||
| finish, then clears caches and updates the configuration so VS picks up | ||
| the new extension on next launch. | ||
| .PARAMETER Path | ||
| Path to the .vsix file to install. | ||
| #> | ||
| [CmdletBinding()] | ||
| param( | ||
| [Parameter(Mandatory = $true, Position = 0)] | ||
| [string]$Path | ||
| ) | ||
|
|
||
| Set-StrictMode -Version Latest | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| if (-not (Test-Path $Path)) { | ||
| Write-Error "VSIX not found: $Path" | ||
| exit 1 | ||
| } | ||
|
|
||
| # --- 1. Install the VSIX --------------------------------------------------- | ||
| Write-Host "Installing VSIX: $Path" -ForegroundColor Cyan | ||
| VSIXInstaller.exe /rootSuffix:exp $Path /q | ||
| Write-Host "VSIXInstaller.exe launched (exit code $LASTEXITCODE)." | ||
|
|
||
| # --- 2. Wait for the background installer to finish ------------------------ | ||
| # VSIXInstaller.exe returns immediately while a background process | ||
| # completes the actual installation. Poll until it exits. | ||
| Write-Host "Waiting for VSIXInstaller.exe to finish..." -ForegroundColor Cyan | ||
| while (Get-Process -Name VSIXInstaller -ErrorAction SilentlyContinue) { | ||
| Start-Sleep -Seconds 5 | ||
| } | ||
| Write-Host "VSIX installation complete." | ||
|
|
||
| # --- 3. Clear caches and update configuration ------------------------------ | ||
| # Find devenv.exe dynamically — VS folders use numeric versions (e.g. 18), | ||
| # not marketing years, and editions vary (IntPreview, Enterprise, etc.). | ||
| $devenv = Get-Command devenv.exe -ErrorAction SilentlyContinue | | ||
| Select-Object -ExpandProperty Source | ||
| if (-not $devenv) { | ||
| $devenv = Get-ChildItem "$env:ProgramFiles\Microsoft Visual Studio","${env:ProgramFiles(x86)}\Microsoft Visual Studio" ` | ||
| -Filter "devenv.exe" -Recurse -ErrorAction SilentlyContinue | | ||
| Where-Object { $_.FullName -match 'Common7\\IDE\\devenv\.exe$' } | | ||
| Select-Object -First 1 -ExpandProperty FullName | ||
| } | ||
| if (-not $devenv) { | ||
| Write-Error "devenv.exe not found. Run from a Developer PowerShell or install Visual Studio." | ||
| exit 1 | ||
| } | ||
| Write-Host "Clearing VS experimental instance caches..." -ForegroundColor Cyan | ||
| & $devenv /rootsuffix exp /clearcache | ||
| & $devenv /rootsuffix exp /updateconfiguration | ||
| Write-Host "Caches cleared and configuration updated." -ForegroundColor Green |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,176 @@ | ||
| # MCP Tools Reference | ||
|
|
||
| Complete reference for all Visual Studio MCP server tools provided by `Microsoft.Copilot.Testing.MCP.VisualStudio`. | ||
|
|
||
| ## Solution Management | ||
|
|
||
| ### `vs-open-solution` | ||
|
|
||
| Opens a solution file and waits for full loading. | ||
|
|
||
| ``` | ||
| vs-open-solution path="C:\path\to\MySolution.sln" | ||
| ``` | ||
|
|
||
| - Accepts `.sln` and `.slnx` files. | ||
| - Blocks until the solution is fully loaded in Visual Studio. | ||
|
|
||
| ### `vs-open-file` | ||
|
|
||
| Opens a file in the Visual Studio editor. | ||
|
|
||
| ``` | ||
| vs-open-file filePath="C:\path\to\MyFile.cs" | ||
| ``` | ||
|
|
||
| ### `vs-close` | ||
|
|
||
| Closes Visual Studio. | ||
|
|
||
| ``` | ||
| vs-close | ||
| ``` | ||
|
|
||
| ## Chat Window | ||
|
|
||
| ### `chat-submit-prompt` | ||
|
|
||
| Submits a prompt to the VS Copilot Chat window. | ||
|
|
||
| ``` | ||
| chat-submit-prompt "@test #file:'C:\path\to\Calculator.cs'" | ||
| ``` | ||
|
|
||
| - Annotations require **full absolute paths** enclosed in single quotes for file-based references. | ||
| - This call is asynchronous — always follow with `chat-wait-complete`. | ||
|
|
||
| ### `chat-wait-complete` | ||
|
|
||
| Waits for the chat response to complete. | ||
|
|
||
| ``` | ||
| chat-wait-complete | ||
| chat-wait-complete timeoutSeconds=600 | ||
| ``` | ||
|
|
||
| - Default timeout: 60 seconds. | ||
| - Increase `timeoutSeconds` for large projects or solution-scoped generation (10+ minutes). | ||
|
|
||
| ### `get-last-message` | ||
|
|
||
| Retrieves the last response from the chat session. | ||
|
|
||
| ``` | ||
| get-last-message | ||
| ``` | ||
|
|
||
| - Look for the `**Pass/Fail Summary**` line (`✅` or `❌`) in the response. | ||
|
|
||
| ## Output Window | ||
|
|
||
| ### `output-window-get-content` | ||
|
|
||
| Gets content from a specific output pane by name. | ||
|
|
||
| ``` | ||
| output-window-get-content paneName="GitHub Copilot Testing" | ||
| output-window-get-content paneName="Build" | ||
| ``` | ||
|
|
||
| Key panes: | ||
|
|
||
| | Pane | Content | | ||
| |---|---| | ||
| | `GitHub Copilot Testing` | Agent execution logs, LLM traces, errors | | ||
| | `Build` | MSBuild compilation output | | ||
| | `Package Manager` | NuGet restore and package issues | | ||
|
|
||
| ### `output-window-get-test-content` | ||
|
|
||
| Gets content from the Test output pane for detailed test results. | ||
|
|
||
| ``` | ||
| output-window-get-test-content | ||
| ``` | ||
|
|
||
| ## Test Explorer | ||
|
|
||
| ### `test-explorer-run-all-tests` | ||
|
|
||
| Executes all tests in the solution. This call is asynchronous — always follow with `test-explorer-wait-complete`. | ||
|
|
||
| ``` | ||
| test-explorer-run-all-tests | ||
| ``` | ||
|
|
||
| ### `test-explorer-wait-complete` | ||
|
|
||
| Waits for the test run to finish. | ||
|
|
||
| ``` | ||
| test-explorer-wait-complete | ||
| ``` | ||
|
|
||
| ### `test-explorer-verify-all-tests-passed` | ||
|
|
||
| Checks if all tests in the solution passed. Returns a quick pass/fail status. | ||
|
|
||
| ``` | ||
| test-explorer-verify-all-tests-passed | ||
| ``` | ||
|
|
||
| ## Error List | ||
|
|
||
| ### `vs-get-error-list` | ||
|
|
||
| Gets diagnostics from the Visual Studio Error List window. | ||
|
|
||
| ``` | ||
| vs-get-error-list | ||
| vs-get-error-list severity=error | ||
| ``` | ||
|
|
||
| - **`severity`** (optional): Filter results by severity. Accepted values: `error`, `warning`, `message`, `all` (default). | ||
| - Returns each diagnostic in the format `[severity] file(line,column): description`. | ||
| - Returns a summary header with match count and active filter. | ||
|
|
||
| ## VS Editor | ||
|
|
||
| ### `vs-inspect-lightbulb` | ||
|
|
||
| Inspects whether a light bulb is present at a file/line and returns available code action titles. | ||
|
|
||
| ``` | ||
| vs-inspect-lightbulb filePath="C:\path\to\File.cs" lineNumber=42 | ||
| ``` | ||
|
|
||
| - Uses 1-based line numbers. | ||
| - Returns whether the light bulb is present and the list of offered actions. | ||
|
|
||
| ## MCP Server Setup | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| 1. Check if `vs-open-solution` tool is available. If it is, the server is already set up. | ||
| 2. Run `./cibuild.cmd` to build the solution. | ||
| 3. Set up the VS MCP server following `src/Microsoft.Copilot.Testing.MCP.VisualStudio/README.md`. | ||
| 4. Configure your MCP client (e.g., `mcp.json`) to point to `bin\Microsoft.Copilot.Testing.MCP.VisualStudio\Release\net472\dotnet-codetesting-mcp-vs.exe`. | ||
| 5. If testing against an experimental VS hive, pass `--hive Exp` in the MCP server args. | ||
|
|
||
| ### Configuration Options | ||
|
|
||
| - **Hive Selection:** Use `--hive` parameter for experimental or specific VS installations. | ||
| - **Debugging:** Set `ATTACH_DEBUGGER=1` environment variable to debug the MCP server. Diagnostic output is written to stderr. | ||
|
|
||
| ### System Requirements | ||
|
|
||
| - Visual Studio 2022 with GitHub Copilot extension | ||
| - .NET 8 SDK or later | ||
| - GitHub Copilot Testing extension enabled | ||
| - Valid GitHub Copilot subscription | ||
|
|
||
| ### VS Settings | ||
|
|
||
| - **Enable the agent:** Tools → Options → GitHub → Copilot → Testing → "Enable GitHub Copilot testing" | ||
| - **Enable logging:** Tools → Options → GitHub → Copilot → Testing → "Enable detailed logging" | ||
| - **Check authentication:** Ensure GitHub account is properly connected |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖🕵️ Kills every
/rootsuffixdevenv, incl.RoslynDevused by the PR's integration testsexp/ one PID?