Blazor: .razor files are parsed as raw C#, so members of `@code { }` are lost and most components report parse_unusable (0.12.1)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp
調査の方向性
Start by reading the .razor parsing path and the existing .razor.cs handling, then compare their graph output using the provided Pages/Items.razor example. Check get_file_outline and parse status after extracting component members; done means markup no longer breaks parsing and the @code members appear in the graph. The requested support for directives and markup call edges extends the scope.
索引モデルが issue の本文から書いたものです。
説明
Version: 0.12.1 (also 0.11.0), macOS arm64, index_repository mode full or fast.
Since #1824, .razor files are discovered and @page emits a Route node. However, the whole file appears to be handed to the C# grammar as it is. Razor markup (<h1>, @if (...) { <p>…</p> }, @onclick="...") and directives are not C#. Inside @code { }, members that are not valid as statements (properties, attributed members) produce errors too. The result:
- In a real Blazor app, 108 of ~150
.razorfiles come backparse_unusableand 43 moreparse_partial. - The component's methods, fields and properties are mostly missing from the graph, so
search_graph/trace_pathcan't see the C# that most Blazor apps keep in@code.
Repro
Pages/Items.razor:
@page "/items"
@implements IDisposable
@inject NavigationManager Nav
<h1>Items</h1>
@if (error is not null)
{
<p class="error">@error</p>
}
@foreach (var item in items)
{
<button @onclick="() => Select(item)">@item</button>
}
@code {
[Parameter, SupplyParameterFromQuery(Name = "q")] public string? Query { get; set; }
[Parameter] public int? Page { get; set; }
List<string> items = [];
string? error;
protected override async Task OnInitializedAsync()
{
items = await Load();
}
Task<List<string>> Load() => Task.FromResult(new List<string> { "a", "b" });
void Select(string item) => Nav.NavigateTo($"/items/{item}");
public void Dispose() { }
}
get_file_outline for Pages/Items.razor:
/items Route -
@inject Function 2-32
parse_partial error ranges: 1-1,3-3,5-6,6-6,8-8,9-9,10-10,11-11,12-12,12-27.
Control: the same @code body as public partial class Items { … } in Pages/Items.cs gives class Items, the fields Query, Page, items and error, and the methods OnInitializedAsync, Load, Select and Dispose. (The two properties are labelled Field there, but they are found.)
A component with only simple members (fields and methods, no markup, no properties) parses almost cleanly. Adding two properties in a row, or any markup before @code, is enough to lose members.
Expected
For a .razor file:
- Take the bodies of
@code { … }(and@functions { … }) and parse them as members of a class named after the file (Items, namespace from folder or@namespace), the same as a.razor.cscode-behind partial class. - Use
@inherits,@implements,@inject Type Nameand@attributeas the class's base type, interfaces, injected members and attributes. - Skip the markup, or at least don't let it break the
@codeparse. Calls from markup such as@onclick="() => Select(item)"or@Method()would be a bonus as CALLS edges from the component.
Related: #1667 / #1824 (discovery and @page routes), #2229.
- 主要言語
- C
- スター
- 45.8k
- フォーク
- 3.8k
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 108
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DeusData/codebase-memory-mcp のほかの issue
-
bug ux/behavior
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
DeusData/codebase-memory-mcp#3191 ·
メンテナーはふだん 1 日以内に返信
-
documentation enhancement parsing/quality ux/behavior
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
DeusData/codebase-memory-mcp#3131 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
hook-augment: the five-row cap keeps the first five search_graph rows, so variables and modules displace function definitions (v0.12.1)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug editor/integration parsing/quality ux/behavior
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
DeusData/codebase-memory-mcp#3062 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug documentation editor/integration parsing/quality
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
DeusData/codebase-memory-mcp#3050 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
editor/integration parsing/quality
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DeusData/codebase-memory-mcp#2286 ·
メンテナーはふだん 1 日以内に返信
DeusData/codebase-memory-mcp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
メンテナーはふだん 1 日以内に返信
-
iOS: the "Edit controls" button never hides, even with a controller connected, and covers the gameオープンgame: 010065A014024000 ios
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
seedds/nxnative#3714 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信