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

Hover: capture ANTLR doc spans and show basic documentation

Ouverte
#565 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Scala
Étoiles
12
Forks
3
Merge moyen
13 h 43 min
PR mergées (30 j)
19

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.