Skip to content

Detect Assign effects - #1342

Merged
lionel- merged 6 commits into
mainfrom
oak-nse/4-assign
Aug 3, 2026
Merged

Detect Assign effects#1342
lionel- merged 6 commits into
mainfrom
oak-nse/4-assign

Conversation

@lionel-

@lionel- lionel- commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Progress towards #1338
Branched from #1341

Adds Assign as the fourth effect kind, after NSE, attach, and source. A call or operator that binds a name with Assign now creates a real definition that feeds the use-def map, exports(), goto, and rename exactly like a syntactic <-. These Assign effects are shadow-, source-, and attach-aware.

Two forms:

  • Calls like assign("x", value) and delayedAssign("x", value). The name is the string first argument, the value the next positional. Bails when envir = or pos = is set, since then the binding lands outside the current scope and we can't state it as a fact.
  • Operators like x %<>% f() (magrittr), x %<~% expr (rlang), x := expr (S7).

Impl notes:

  • A new DefinitionKind::Assign models this effect in the semantic index.

  • A new RangedAstPtr wrapper of AstPtr allows carrying the trimmed range of the name node. AstPtr only carries the full range, and requires the root node to resolve a trimmed range, which is unergonomic.

Goto and rename now work with custom Assign calls. When a name is bound in string form (e.g. assign("x", ...)) the rename occurs in place as a string to keep the quotes. To make this easier I've dropped the normalisation of strings during renames (which matches your preference Davis, cf previous discussion).

To support that cleanly, the decision of how a renamed name is spelled moved out of the LSP layer into oak_ide. This way the LSP layer only converts ranges and wires files.

Positron Release Notes

New Features

  • Code navigation and renaming now understands custom assignment calls and operators like assign(), delayedAssign(), %<>% from magrittr, := from S7, etc.

Bug Fixes

  • N/A

@lionel-
lionel- force-pushed the oak-nse/4-assign branch from ccd470f to d8f6b46 Compare July 17, 2026 08:56
@lionel-
lionel- force-pushed the oak-nse/4-assign branch from d8f6b46 to 54c0df9 Compare July 17, 2026 11:26
@lionel-
lionel- force-pushed the oak-nse/4-assign branch 3 times, most recently from 93a4a54 to 1337f51 Compare July 22, 2026 15:25
@lionel-
lionel- force-pushed the oak-nse/4-assign branch 2 times, most recently from 19627d6 to fc1b5bf Compare July 30, 2026 14:38
@lionel-
lionel- force-pushed the oak-nse/4-assign branch from d7bc97a to 03960a9 Compare July 31, 2026 07:08
@lionel-
lionel- force-pushed the oak-nse/4-assign branch from 03960a9 to 4ba00b3 Compare July 31, 2026 12:28
@lionel-
lionel- force-pushed the oak-nse/4-assign branch 2 times, most recently from 62adc46 to a509f80 Compare August 3, 2026 13:17
Base automatically changed from oak-nse/3-source to main August 3, 2026 16:20
@lionel-
lionel- merged commit ce2d3aa into main Aug 3, 2026
17 checks passed
@lionel-
lionel- deleted the oak-nse/4-assign branch August 3, 2026 16:21
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant