feat(reference): member-level シンボル抽出 MVP(Phase 4-A / Refs #191)#197
Merged
Conversation
SPEC #191 (Phase 4 umbrella) のサブタスク A を最小 MVP として land する。 `extract_symbols_from_text` を拡張し、`public` / `internal` / `protected` / `private` で始まる method と property を index に含め られるようにする。Phase 2 の `reference find-symbol --kind method` が「Animator.Play」のような典型シンボルを直接 lookup できる。 主な変更: - src/reference/index.rs::extract_symbols_from_text: METHOD_RE と PROPERTY_RE を追加し、既存の TYPE_RE と組み合わせて symbol を抽出。 既に capture 済みの span (type declaration) は overlaps_consumed で skip し、class 名が method として double-capture されないように する。 - 新規 RED テスト 3 件: - extract_symbols_from_text_finds_methods: void / static int の 両方のシグネチャを method として抽出 - extract_symbols_from_text_finds_property: { get; set; } と { get { ... } } の両方を property として抽出 - extract_symbols_from_text_does_not_double_capture_class_name: class 名が method として捕捉されない回帰防止 スコープ外(umbrella #191 で継続管理): - 多行シグネチャ(戻り値型と method 名が改行で分かれるケース) - constructor / destructor(戻り値型を持たないため現 regex は通らない) - field / event 抽出 - ジェネリック制約句 `where T : ...` の取り扱い - record / record struct のような新しい型構文 regex MVP は偽陽性を含む可能性があるが、`--kind method` / `--kind property` のフィルタで noise を抑えやすい。本格的な精度は Phase 4 の 後追い改善か、別 SPEC として Roslyn 経由の解析を立てる余地がある。 ローカル検証: - cargo fmt -- --check: clean - cargo clippy --all-targets -- -D warnings: clean - cargo test --bin unity-cli: 392 passed / 0 failed - cargo llvm-cov --all-targets: TOTAL line coverage 90.89% - unity-cli skills lint --severity error: 15 skills / 0 violations Refs #191 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced May 11, 2026
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.
Summary
reference find-symbol --kind method|propertyが「UnityEngine.Animator.Play」のような典型シンボルを直接 lookup できるよう、extract_symbols_from_textを拡張する。Changes
src/reference/index.rs::extract_symbols_from_textを 3 つの regex (TYPE_RE/METHOD_RE/PROPERTY_RE) で順に走査する形に書き換え。overlaps_consumedで既に capture 済みの span (type declaration) を skip し、class Foo {}のFooが method として double-capture されないようにする。METHOD_RE:public|internal|protected|private+ optional modifiers + return type + name +(の 1 行パターン。PROPERTY_RE: 同上だがname { get|setで終わる行を property として認識。extract_symbols_from_text_finds_methodsextract_symbols_from_text_finds_propertyextract_symbols_from_text_does_not_double_capture_class_nameTesting
cargo fmt -- --check— cleancargo clippy --all-targets -- -D warnings— cleancargo test --bin unity-cli— 392 passed / 0 failedcargo llvm-cov --all-targets --summary-only -- --test-threads=1— TOTAL line coverage 90.89%unity-cli skills lint --severity error— 15 skills / 0 violationsClosing Issues
Related Issues / Links
Checklist
cargo clippy,cargo fmt,unity-cli skills lint)find-symbolの公開 API は不変、--kind method|propertyを返せる対象が増えるだけ).unity-cli-index/symbols.jsonは新コードで再 build される(signature差分が検出され次第)feat)Context
Phase 2 (SPEC #187) では型のみを index に含めていたため、ユーザーが
find-symbol --name Play --kind methodを試しても空配列が返っていた。本 PR の MVP は単純な 1 行 regex で method / property を捕捉し、reference find-symbolの実用範囲を広げる。Out of Scope(umbrella #191 で継続管理)
where T : ...の取り扱いregex MVP は偽陽性を含む可能性があるが、
--kind method/--kind propertyフィルタで noise を抑えやすい。本格的な精度は Roslyn 経由解析の別 PR として後追い検討する余地がある。Notes
TYPE_RE) の挙動は変えていない。class / interface / struct / enum を見つけたファイルではconsumed_spansに span を入れ、その範囲を method / property regex の対象から除外する。これによりpublic class Bar {}のBarが method として捕捉されない。.unity-cli-index/symbols.jsonの version は維持。新コードで再 build される際、signatureが変わっているファイルは新形式で書き直される。