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

Hover: capture ANTLR doc spans and show basic documentation

Aperta
#565 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Scala
Stelle
12
Fork
3
Merge medio
13h 43m
PR unite (30g)
19

Descrizione

## 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).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.