[JuliaLowering] Add soft_scope kwarg to resolve_scopes#61476
Open
aviatesk wants to merge 1 commit intoavi/JL-fix-soft-scopefrom
Open
[JuliaLowering] Add soft_scope kwarg to resolve_scopes#61476aviatesk wants to merge 1 commit intoavi/JL-fix-soft-scopefrom
soft_scope kwarg to resolve_scopes#61476aviatesk wants to merge 1 commit intoavi/JL-fix-soft-scopefrom
Conversation
Add `soft_scope::Union{Nothing,Bool}=nothing` keyword argument
to `resolve_scopes` so callers can explicitly control soft scope
behavior without inserting `K"softscope"` marker nodes into the
AST. When `nothing` (the default), the existing marker-based
detection is used.
This is useful for tools like JETLS that lower code from
different contexts (files vs notebooks). Notebook cells use
REPL-like soft scope semantics, and with this kwarg, the
language server can pass `soft_scope=true` directly rather
than manipulating the AST to insert marker nodes.
aviatesk
added a commit
to aviatesk/JETLS.jl
that referenced
this pull request
Apr 2, 2026
JuliaLang/julia#61476 allows us to remove the `insert_softscope_marker` workaround that inserted `K"softscope"` nodes into the AST and pass the `soft_scope` keword arg directly instead.
aviatesk
added a commit
to aviatesk/JETLS.jl
that referenced
this pull request
Apr 2, 2026
JuliaLang/julia#61476 allows us to remove the `insert_softscope_marker` workaround that inserted `K"softscope"` nodes into the AST and pass the `soft_scope` keword arg directly instead.
aviatesk
added a commit
to aviatesk/JETLS.jl
that referenced
this pull request
Apr 2, 2026
JuliaLang/julia#61476 allows us to remove the `insert_softscope_marker` workaround that inserted `K"softscope"` nodes into the AST and pass the `soft_scope` keword arg directly instead.
mlechu
approved these changes
Apr 2, 2026
Member
mlechu
left a comment
There was a problem hiding this comment.
Sounds OK. I've talked about wanting to make this a parameter instead of using the AST marker. We might want to make it a parameter to lowering (like world) instead of just scope resolution to keep the interface cleaner, though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
soft_scope::Union{Nothing,Bool}=nothingkeyword argument toresolve_scopesso callers can explicitly control soft scope behavior without insertingK"softscope"marker nodes into the AST. Whennothing(the default), the existing marker-based detection is used.This is useful for tools like JETLS that lower code from different contexts (files vs notebooks). Notebook cells use REPL-like soft scope semantics, and with this kwarg, the language server can pass
soft_scope=truedirectly rather than manipulating the AST to insert marker nodes.