Repository navigation
feat: Razor-generated code references resolve to .razor/.cshtml source lines - #353
Merged
Merged
Conversation
…e lines The helper recorded symbol positions with the raw GetLineSpan(): references inside Razor source-generated trees pointed at generated virtual paths — and since the Razor SDK moved to in-memory source generators (no more obj/razor/*.g.cs on disk), those references vanished from rebuilt indexes entirely (find_impact on a ViewModel lost its view-code references). The helper now uses GetMappedLineSpan() for both the document path and the ranges: #line directives resolve every generated-tree position back to the .razor/.cshtml source file and line — the same mechanism VS's ctrl-click uses. Hidden regions keep the last #line mapping (Roslyn semantics, pinned by test); trees with no directives at all map to an empty path and are dropped. Identity mapping for ordinary files is unchanged. The SCIP symbol indexes get their own builder stamp (SCIP_INDEX_BUILDER_VERSION = 2026-10.2) so a deployed binary rebuilds them without a text re-embed wave: file_meta keeps comparing the unchanged INDEX_BUILDER_VERSION. Stamp fixtures updated accordingly. C# test: MappedSpanTests pins the #line resolution, the mapped range, the hidden-region semantics and the ordinary-file identity mapping.
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.
The C# helper recorded symbol positions with the raw
GetLineSpan(): references inside Razor source-generated trees pointed at generated virtual paths — and since the Razor SDK moved to in-memory Roslyn source generators (no moreobj/razor/*.g.cson disk), those references vanished from rebuilt indexes entirely (find_impact on a ViewModel lost its view-code references; CreateAgencyModel lost its Create.cshtml references).The helper now uses
GetMappedLineSpan()for both the document path and the ranges — the same mechanism VS's ctrl-click uses:#linedirectives resolve every generated-tree position back to the .razor/.cshtml source file and line.HasMappedPath=true, path = the last mapped file).The SCIP symbol indexes get their own builder stamp (
SCIP_INDEX_BUILDER_VERSION = 2026-10.2) so a deployed binary rebuilds them without a text re-embed wave — file_meta keeps comparing the unchangedINDEX_BUILDER_VERSION. Stamp fixtures updated.Tests: new
MappedSpanTests(4 cases: #line resolution, mapped range, hidden-region semantics, ordinary-file identity); helper suite 112/112; Rust fmt/clippy/cargo test --lib --bins+ fullcargo test --test '*'green. Deploy note: after deploying, the SCIP indexes rebuild automatically on first use (stamp mismatch); the text indexes are untouched.