Repository navigation
Use class links and roxygen prose as advisory member-completion hints - #901
renkun-ken wants to merge 7 commits into
Conversation
…e for identity-sensitive requests
eitsupi
left a comment
There was a problem hiding this comment.
Reviewed by ChatGPT.
The distinction between explicit annotations and advisory documentation-derived hints addresses the previous concerns regarding dispatch and Rename. The additional handling of advisory evidence across numeric union alternatives also appears appropriate.
I suggest providing a separate setting for advisory type inference, disabled by default, for example:
options(
languageserver.roxygen_type_hints = TRUE,
languageserver.roxygen_advisory_type_hints = FALSE
)Explicit type annotations are intentionally supplied type information, whereas Markdown links and natural-language descriptions are fundamentally documentation rather than type declarations. Users should be able to enable the former without accepting the heuristics of the latter.
The propagation of advisory evidence also introduces additional complexity throughout the inference engine. This maintenance cost should be considered before expanding the supported documentation patterns further.
No blocking implementation issues found. Approved with the above suggestion.
Part 7 of the review split for #894. The base is #900.
This distinguishes an explicit type contract from an ordinary documentation topic. Advisory hints are off by default. To use verified Markdown class links and class phrases for member suggestions, enable
r.lsp.roxygen_advisory_type_hintsor set these R options before starting the server:Advisory hints supply member suggestions after class verification. They cannot supply the dispatch class for S3 or a class-reference edit for Rename. Known concrete receiver information and explicit contracts remain eligible.
For identity-sensitive uses, an explicit
@param x (`Box`)or an unambiguous leading Rd marker[\code{Box}]supplies the declared instance. A phrase such asAn object of class [`Box`].remains advisory. Mixed or unresolved alternatives never silently narrow to the first class. Theroxygen_type_hintssetting disables documentation-derived inference for both forms.Tests cover overlapping class and topic names, origin lookup, mixed annotations, ordinary S3 evidence, indirect calls and warm caches. The benchmark exercises leading-marker scans and completion on source and package fixtures.