maxandClaude Opus 5 864f4c2c5f Mark write references in the editor view too
Kinds now live on the display ranges rather than in a side map, so the
virtual document can paint reads and writes differently.

- ResultLine.symbolRanges becomes DisplayRange[] carrying start, end, the
  source column and the kind. displayLine() classifies syntactically as it
  renders, so the write markers are correct on the very first paint and the
  document never waits on a language server. refineKinds() then applies
  documentHighlight results and re-decorates; only decorations change, never
  the text, and a superseded tab is left alone.
- Writes get the theme's editor.wordHighlightStrong colours plus bold, which
  is what the editor itself uses for a write occurrence, so the two kinds are
  distinguishable in any theme. Reads keep the find-match highlight.
- DisplayRange.sourceCol replaces the arithmetic that recovered a source
  column by shifting relative to the first reference on the line. Covered by
  a new test that walks every occurrence on a line holding two references to
  the same symbol and checks each one navigates to its own column.

Also drops a stale assertion: an empty kind map used to mean "everything
reads", and now means "use the syntactic classification", so buildRows()
without a map is expected to report writes.

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

Colored References

Find All References results shown the way Visual Studio does it — in two views.

Editor view (default) writes the results into a read-only virtual document in the same language as your source file, so your theme's grammar colors every line for free. File headers show the containing project (.csproj/.fsproj/.vbproj) and reference count; line numbers are shown in the gutter. Read references are highlighted like search matches; writes are bold on the theme's stronger write-occurrence background, the same colour the editor itself uses for a write.

Panel view shows the same results as a table with resizable, sortable columns — Code, File, Line, Kind, Project and Containing member — grouped by file, with a filter box and a reads/writes filter. By default it docks in the bottom panel alongside Terminal and Problems, where a wide, short table reads best; you can drag it to either side bar, or set coloredReferences.panelLocation to put it in an editor group instead.

Works with any language server that implements references: DotRush, C# Dev Kit, OmniSharp, TypeScript, Rust, Go, ...

Usage

Action How
Find references Ctrl+Alt+F12 (Cmd+Alt+F12 on mac), right-click → Find All References (Colored), or the command palette
Pick a view explicitly References: Find All References in Colored Editor / … in Results Panel
Switch the current results to the other view Ctrl+Alt+Shift+F12, or the split icon in the tab bar
Go to a reference Enter, F12, or Ctrl+Click on a result line. Enter on a file header opens the file.
Re-run the search F5, or the refresh icon in the tab bar / panel toolbar

In the panel, a single click previews a reference without leaving the panel, Enter or a double-click jumps to it, arrow keys walk the list, Ctrl+F focuses the filter, and clicking a column header sorts by it. Drag a column edge to resize it; double-click the edge to reset it.

The All / Reads / Writes buttons filter by kind, and the summary line counts the writes. Kind also works in the text filter, so typing write narrows to writes as well. See Known limitations for where the kind comes from.

Settings

  • coloredReferences.view — which view Find All References (Colored) opens: document (default) or panel
  • coloredReferences.panelLocation — where the panel opens: bottom (default, docked next to Terminal / Problems and draggable to a side bar), beside (editor group to the side), or below (editor group underneath, so the table is wide and short)
  • coloredReferences.openBeside — open results beside the current editor (default true)
  • coloredReferences.showProject — show the containing project in file headers (default true)
  • coloredReferences.reuseTab — reuse one results tab/panel instead of opening a new one per search (default true)

Install

Either install the .vsix (Extensions view → Install from VSIX…) or open this folder in VS Code, run npm install, and press F5 to launch an Extension Development Host.

Tests

npm test launches a real VS Code against a C# solution, waits for the language server to answer, and asserts on the rendered results — that every displayed line maps back to the source line it claims, that navigation and hover work, that the panel's rows highlight the right occurrence, and that the containing member resolves.

Point it at your own solution with COLORED_REFS_TEST_FOLDER:

COLORED_REFS_TEST_FOLDER=/path/to/solution npm test

The run opens a generated .code-workspace that pins DotRush to the solution found in that folder, so your repository's own .vscode/settings.json is left alone. C# Dev Kit and OmniSharp are disabled for the run so the expected results stay deterministic.

Known limitations

  • Coloring in the editor view is TextMate-only (no semantic tokens), since language servers only serve semantic tokens for real files. Types and identifiers therefore look like they do in a freshly opened file before the server has analyzed it.
  • The panel's code column cannot use your theme's token colors: webviews are not given them as CSS variables. It approximates the stock Dark+/Light+ hues instead. Semantic tokens (roadmap 2) would replace this.
  • Read/write kind is not part of the reference request, so it is derived two ways. Every reference is first classified from the surrounding text (assignment and compound-assignment operators, ++/--, ref/out arguments), then textDocument/documentHighlight is asked per file and its Read/Write kinds override that wherever the server has an opinion. Servers that answer with plain Text highlights, or not at all, leave the syntactic answer standing — which is good for straightforward code and can be wrong for exotic expressions. Results spanning more than 60 files skip the server round-trip entirely. The editor view paints the syntactic answer immediately and re-paints if the server disagrees, so it never waits on highlights.
  • Some language servers try to attach to every document of their language, including the virtual one, and may log a harmless error about an unknown URI scheme.

Roadmap

  1. Webview panel with resizable, sortable columns — done; missing: virtualized rendering for very large result sets, and remembering column layout per workspace rather than per panel
  2. Semantic token overlay via vscode.provideDocumentSemanticTokens
  3. Filter by project / exclude tests
  4. Read/write kind — done in both views
S
Description
No description provided
Readme MIT
277 KiB
2026-09-07 17:50:02 +02:00
Languages
TypeScript 74%
JavaScript 19.9%
CSS 6.1%