Skip to content

Fix member completion for static namespace objects - #818

Merged
renkun-ken merged 7 commits into
masterfrom
codex/fix-static-object-completion
Oct 28, 2026
Merged

renkun-ken merged 7 commits into
masterfrom
codex/fix-static-object-completion

Conversation

@renkun-ken

@renkun-ken renkun-ken commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Static namespace values such as redux::redis returned no member completions because class-based guards rejected their observed members. Lists, data frames, pairlists, and stored S4/R6 values also lacked complete metadata. Lazy datasets live outside ordinary namespace bindings, so mtcars$ and ggplot2::diamonds$ were missing as well.

Prepare bounded structural snapshots and preserve package ownership, captured values, and receiver bindings through aliases, nested access, indexing, and explicit ::: lookup. $ and @ completion now resolve the correct members and signatures while respecting custom dispatch and avoiding getter or coercion-hook execution. Callable S4 instances retain their slots and .Data storage, and R6 function fields keep their original lexical bindings.

Add constructed regressions for namespace collisions, captured and returned callbacks, class changes, local and custom dispatch, matrix/array conversion hooks, R6 inheritance/private contexts, and S4 instances.

Include lazy datasets with correct public/export precedence, seed default-package dataset models once per host, and propose known dataframe columns without invoking custom accessors. Recover namespace hints from incomplete $/@ buffers and wait for relevant member preparation so the first LSP response is complete. Retain bounded dataset models if full namespace metadata exceeds its size limit. Test the package-dataset path with a temporary base-R package containing lazy-loaded data and a custom dataframe accessor, without adding a ggplot2 dependency.

Local validation:

  • 2,575 focused assertions passed, with three S7 capability-dependent skips; the worker-error wakeup regression also passed.
  • 44 current lazy-data regression assertions passed, including mtcars and the constructed package dataset over LSP on the first request, with retries disabled and no getter execution.
  • R CMD check --as-cran --no-tests --no-manual --no-vignettes: no errors or warnings (existing non-failing notes only).
  • Changed-line lint and git diff --check: clean.

@renkun-ken
renkun-ken requested a review from eitsupi October 28, 2026 03:20

@eitsupi eitsupi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by ChatGPT

I found two issues worth addressing before merging:

  1. Incomplete startup metadata can bypass the completion wait (R/handlers-langfeatures.R)

    member_metadata_waiting() treats any existing catalog without an error as ready. However, workspace_startup_members() may have already cached a dataset_only snapshot. A first completion request for a regular namespace object can therefore return incomplete results while full metadata is still being prepared. Please account for dataset_only / namespace_attempted when checking readiness.

  2. External S3 subset methods are not considered (R/member-inference.R)

    member_subset_method() checks document bindings and the owning package's definitions, but may miss [ / [[ methods registered by other packages. It can then incorrectly infer results from the underlying list elements despite custom dispatch. Please detect registered methods or conservatively avoid default subset inference when dispatch cannot be ruled out.

Regression tests covering both cases would be useful.

@renkun-ken
renkun-ken requested a review from eitsupi October 28, 2026 10:08
@renkun-ken
renkun-ken merged commit 17f9262 into master Oct 28, 2026
18 checks passed
@randy3k randy3k mentioned this pull request Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants