1.15.1: fix incorrect outline line ranges for .razor files#102
Merged
Conversation
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]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Patch release 1.15.1.
Fix
OutlineCSharpFileon.razorfiles reported wrong// L..line ranges. The Razor preprocessor rebuilt the@code/@functionsC# into a fresh synthetic class, so every member's line number was offset by however far the@codeblock sat in the file — a narrowReadof 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 →Readthe line-range) became the primary path. An agent reported it on a real.razorfile.Extraction is now line-aligned: each extracted
@codeline 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/@functionsblocks.Tests (there were none on line ranges before)
Razor_Outline_LineRangesMatchOriginalFile—ExecSql=13,ClearGrid=19(first block),_selectedIndex=27(second block); proves cross-block alignment.Razor_Outline_SingleBlockLineRanges—@codepushed 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
TokenSaver.Mcp.csproj,server.jsonboth fields).[1.15.1].