Files
vs-code-colored-references/package.json
T
maxandClaude Opus 5 3e8ece8ed7 Classify the panel's code column with real token types
The panel guessed that any capitalised identifier was a type, so
`Profiler.Frames.Count` came out as three type-coloured names where the
editor shows a class and two members. The semantic overlay already fetches
per-file tokens, so feed the same data to the webview.

- codeSpans() returns the server's token spans per referenced line in the
  row's own trimmed coordinates; rows carry them and the webview colours from
  them, mapping token type names to its palette. Fields, properties, events
  and methods share the member colour, as they do in the stock themes.
- The regex tokenizer stays as the fallback for servers that serve no
  semantic tokens, and coloredReferences.semanticTokens now gates both views
  rather than just the editor.

Colours are still the approximated Dark+/Light+ palette — a webview is not
given the theme's token colours — so only the editor view can be theme-exact.
The README says so instead of promising this would fix it.

Two things the new tests establish, both assumptions the code was already
making: all files in a result share the origin's legend, so decoding tokens
from every file against one legend is sound; and all 237 relocated tokens in
the Profiler search report the same type name as their source token.

Also relaxes an over-specific assertion: DotRush calls Profiler.Frames a
field, not a property. Either way it is a member, which is what matters.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-07 17:32:32 +02:00

207 lines
6.4 KiB
JSON

{
"name": "colored-references",
"displayName": "Colored References",
"description": "Find All References results in a syntax-highlighted editor pane, Visual Studio style. Works with any language server (DotRush, C# Dev Kit, OmniSharp, ...).",
"version": "0.1.0",
"publisher": "local",
"license": "MIT",
"engines": {
"vscode": "^1.85.0"
},
"categories": [
"Other"
],
"keywords": [
"references",
"find all references",
"csharp",
"dotnet",
"visual studio"
],
"activationEvents": [
"onView:coloredReferences.resultsView"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "coloredReferences.find",
"title": "Find All References (Colored)",
"category": "References"
},
{
"command": "coloredReferences.findInDocument",
"title": "Find All References in Colored Editor",
"category": "References"
},
{
"command": "coloredReferences.findInPanel",
"title": "Find All References in Results Panel",
"category": "References"
},
{
"command": "coloredReferences.toggleView",
"title": "Switch Between Editor and Panel View",
"category": "References"
},
{
"command": "coloredReferences.goTo",
"title": "Go to Reference",
"category": "References"
},
{
"command": "coloredReferences.refresh",
"title": "Refresh References",
"category": "References",
"icon": "$(refresh)"
}
],
"keybindings": [
{
"command": "coloredReferences.find",
"key": "ctrl+alt+f12",
"mac": "cmd+alt+f12",
"when": "editorHasReferenceProvider && editorTextFocus"
},
{
"command": "coloredReferences.goTo",
"key": "enter",
"when": "editorTextFocus && resourceScheme == colored-refs && !suggestWidgetVisible"
},
{
"command": "coloredReferences.refresh",
"key": "f5",
"when": "editorTextFocus && resourceScheme == colored-refs"
},
{
"command": "coloredReferences.toggleView",
"key": "ctrl+alt+shift+f12",
"mac": "cmd+alt+shift+f12",
"when": "resourceScheme == colored-refs || activeWebviewPanelId == coloredReferences.results || view == coloredReferences.resultsView"
}
],
"menus": {
"editor/context": [
{
"command": "coloredReferences.find",
"when": "editorHasReferenceProvider",
"group": "navigation@1.5"
}
],
"editor/title": [
{
"command": "coloredReferences.refresh",
"when": "resourceScheme == colored-refs",
"group": "navigation"
},
{
"command": "coloredReferences.toggleView",
"when": "resourceScheme == colored-refs",
"group": "navigation"
}
],
"commandPalette": [
{
"command": "coloredReferences.goTo",
"when": "resourceScheme == colored-refs"
},
{
"command": "coloredReferences.refresh",
"when": "resourceScheme == colored-refs"
},
{
"command": "coloredReferences.toggleView",
"when": "resourceScheme == colored-refs || activeWebviewPanelId == coloredReferences.results || view == coloredReferences.resultsView"
}
]
},
"configuration": {
"title": "Colored References",
"properties": {
"coloredReferences.openBeside": {
"type": "boolean",
"default": true,
"description": "Open the results pane beside the current editor instead of in the same group."
},
"coloredReferences.showProject": {
"type": "boolean",
"default": true,
"description": "Show the containing project (nearest .csproj / .fsproj / .vbproj) in file headers."
},
"coloredReferences.reuseTab": {
"type": "boolean",
"default": true,
"description": "Reuse a single results tab instead of opening a new one per search."
},
"coloredReferences.view": {
"type": "string",
"enum": [
"document",
"panel"
],
"enumDescriptions": [
"A read-only editor pane in the same language as the source, coloured by your theme.",
"A webview panel with resizable, sortable columns and a containing-member column."
],
"default": "document",
"description": "Which view Find All References (Colored) opens."
},
"coloredReferences.panelLocation": {
"type": "string",
"enum": [
"bottom",
"beside",
"below"
],
"enumDescriptions": [
"Dock the results table in the bottom panel, beside Terminal and Problems. Drag it to a side bar if you prefer.",
"Open the results table in an editor group beside the current one.",
"Open the results table in an editor group below the current one, so it is wide and short."
],
"default": "bottom",
"description": "Where the results panel opens."
},
"coloredReferences.semanticTokens": {
"type": "boolean",
"default": true,
"description": "Use semantic tokens from the language server so identifiers are coloured by what they are. The editor view gets the theme-exact colouring; the panel gets the classification with an approximated palette. Turn off for grammar-only colouring."
}
}
},
"viewsContainers": {
"panel": [
{
"id": "coloredReferences",
"title": "References",
"icon": "media/references-dark.svg"
}
]
},
"views": {
"coloredReferences": [
{
"id": "coloredReferences.resultsView",
"name": "References",
"type": "webview",
"contextualTitle": "References"
}
]
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/mocha": "^10.0.10",
"@types/node": "^20.11.0",
"@types/vscode": "^1.85.0",
"@vscode/test-electron": "^2.5.2",
"mocha": "^10.8.2",
"typescript": "^5.4.0"
}
}