Skip to content

1.15.1: fix incorrect outline line ranges for .razor files#102

Merged
Byggarepop merged 2 commits into
mainfrom
fix-razor-line-ranges
Jun 16, 2026
Merged

1.15.1: fix incorrect outline line ranges for .razor files#102
Byggarepop merged 2 commits into
mainfrom
fix-razor-line-ranges

Conversation

@Byggarepop

Copy link
Copy Markdown
Owner

Patch release 1.15.1.

Fix

OutlineCSharpFile on .razor files reported wrong // L.. line ranges. The Razor preprocessor rebuilt the @code/@functions C# into a fresh synthetic class, so every member's line number was offset by however far the @code block sat in the file — a narrow Read of a printed range landed on the wrong lines.

This was cosmetic under the old focus_method (it returned the body directly) but became a functional bug once the warm-start flow (outline → Read the line-range) became the primary path. An agent reported it on a real .razor file.

Extraction is now line-aligned: each extracted @code line keeps its original line number (markup lines blanked, class braces reuse the first/last block's own braces), so line spans map straight back to the real file — across multiple @code/@functions blocks.

Tests (there were none on line ranges before)

  • Razor_Outline_LineRangesMatchOriginalFileExecSql=13, ClearGrid=19 (first block), _selectedIndex=27 (second block); proves cross-block alignment.
  • Razor_Outline_SingleBlockLineRanges@code pushed past markup + a <style> block; _counter=16, DoWork=18 (previously ~11 lines off).

Both fail against the old code, pass against the fix. All existing Razor tests still pass. 172/172.

Release

  • Version 1.15.0 → 1.15.1 (TokenSaver.Mcp.csproj, server.json both fields).
  • CHANGELOG [1.15.1].

Byggarepop and others added 2 commits June 16, 2026 18:47
The Razor preprocessor rebuilt @code/@functions into a fresh synthetic class, so
Roslyn's line spans — and the // L.. ranges OutlineCSharpFile prints — were offset
by however far the @code block sat in the file. A narrow Read of a printed range
landed on the wrong lines. This was cosmetic under the old focus_method (it returned
the body directly) but became a functional bug once the warm-start flow (outline →
Read the line-range) became the primary path.

Extraction is now line-aligned: each extracted @code line keeps its original line
number (markup lines blank, class braces reuse the first/last block's own braces),
so line spans map straight back to the real .razor file, across multiple blocks.

Tests: Razor_Outline_LineRangesMatchOriginalFile (ExecSql=13, ClearGrid=19,
_selectedIndex=27 across two @code blocks) and Razor_Outline_SingleBlockLineRanges
(_counter=16, DoWork=18 with @code pushed past markup + a style block). 172/172 pass.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Patch release for the .razor outline line-range fix.
- Version 1.15.0 -> 1.15.1 in TokenSaver.Mcp.csproj and server.json (both fields).
- CHANGELOG [Unreleased] -> [1.15.1] — 2026-06-16.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@Byggarepop
Byggarepop merged commit e73f0fe into main Jun 16, 2026
1 check passed
@Byggarepop
Byggarepop deleted the fix-razor-line-ranges branch June 16, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant