Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Choose Current Module" button doesn't work with REPL #3492

Open
nathanrboyer opened this issue Dec 14, 2023 · 0 comments
Open

"Choose Current Module" button doesn't work with REPL #3492

nathanrboyer opened this issue Dec 14, 2023 · 0 comments

Comments

@nathanrboyer
Copy link

nathanrboyer commented Dec 14, 2023

When a module is selected in the VSCode GUI (either implicitly or explicitly), it doesn't actually change the REPL module.

Implicitly Selected (parentheses):
image
Explicitly Selected (no parentheses):
image

julia> x = 3
3

julia> MyPackage.x
ERROR: UndefVarError: `x` not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base .\Base.jl:31
 [2] top-level scope
   @ REPL[3]:1

julia> Main.x
3

Currently, the module namespace can only be activated in the REPL manually with Alt+m.

julia> MyPackage  # Alt + m

(MyPackage) julia> y = 1
1

(MyPackage) julia> MyPackage.y
1

(MyPackage) julia> Main.y
ERROR: UndefVarError: `y` not defined
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base .\Base.jl:31
 [2] top-level scope
   @ REPL[12]:1

It would be very convenient for the VSCode REPL module selection to synchronize with the VSCode GUI module selection. The current behavior often yields very confusing errors when trying to use Julia: Execute Code in REPL and normal REPL typing together.

julia> z = 5 # Ctrl + Enter a line in a file within the MyPackage module
5

julia> z + 2 # Typed into REPL
ERROR: UndefVarError: `z` not defined

I have personally been confused by this error several times, and I have seen several other beginners encounter it on Discourse and StackOverflow as well.

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

No branches or pull requests

1 participant