apex-dev-tools / apex-dev-tools/apex-ls

Hover: capture ANTLR doc spans and show basic documentation

オープン
#565 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Scala
スター
12
フォーク
3
平均マージ
13時間 43分
マージ済み PR(30日)
19

説明

## Problem

The ANTLR parse path already retains hidden `DOC_COMMENT` tokens, but declaration objects do not capture the adjacent documentation span. As a result hover cannot show docs for edited/ANTLR-reparsed files even though their source bytes are already resident.

## Scope

- Use `CodeParser.lastTokenStream` and hidden tokens on the comment channel to find a directly adjacent doc comment.
- Capture the exact byte span during ANTLR CST construction for types, methods, constructors, fields and properties (and triggers where the model permits).
- Retain a nullable/absent-by-default `SourceData` slice on `FullDeclaration` / `ClassBodyDeclaration`, with no copied comment text and no allocation for undocumented declarations beyond the optional reference.
- Append safely stripped raw documentation text to hover output while preserving signature-only fallback.
- Cover adjacency, ordinary comments between doc/declaration, banners, and missing docs.

## Non-scope

- Structured ApexDoc tag parsing/markdown formatting (tracked separately in F).
- Outline-parser capture and adapter consumption (C/D).
- Parsed-summary/warm-cache persistence (E).
- New hover target kinds or declaration-site lookup (G).

## Acceptance criteria

- ANTLR-loaded or reparsed declarations with an immediately preceding `/** ... */` expose documentation in hover.
- A separating code token or non-doc comment prevents attachment, matching ApexDoc adjacency rules.
- Undocumented declarations do not allocate slices or copy source text.
- Invalid/unusable documentation never emits diagnostics and degrades to the existing signature-only hover.
- Tests cover cross-file references backed by full declarations and edited/refresh parsing paths where practical.

## Dependencies

Depends on **A**: #564.

## Repository/API compatibility

No apex-parser change or release is required: `DOC_COMMENT` already exists on the hidden comment channel. Keep the retained representation internal and zero-copy; coordinate its shape with D and E.

## Context

Split **B** from #325. See the detailed [Proposed scope split and investigation](https://github.com/apex-dev-tools/apex-ls/issues/325#issuecomment-5347298995).

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。