-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Don't give public but unexported symbols as repl completions in an unqualified context #51345
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1896,3 +1896,17 @@ let s = "Issue49892(fal" | |
@test n in c | ||
end | ||
end | ||
|
||
@testset "public but non-exported symbols only complete qualified (#51331)" begin | ||
c, r, res = test_complete("ispub") | ||
@test res | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's something about the type of completion, perhaps weather or not it is ever sensible to display the completion inline. For example, IICU, we never display argument hints inline. julia> completions("summ", 4)
(REPL.REPLCompletions.Completion[REPL.REPLCompletions.ModuleCompletion(Base, "summary"), REPL.REPLCompletions.ModuleCompletion(Base, "summarysize")], 1:4, true)
julia> completions("summary(", 8)
(REPL.REPLCompletions.Completion[REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), Base.JuliaSyntax.SyntaxHead}, summary(head::Base.JuliaSyntax.SyntaxHead) @ Base.JuliaSyntax ~/.julia/dev/julia/base/JuliaSyntax/src/parse_stream.jl:98), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), Base.JuliaSyntax.GreenNode}, summary(node::Base.JuliaSyntax.GreenNode) @ Base.JuliaSyntax ~/.julia/dev/julia/base/JuliaSyntax/src/green_tree.jl:39), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), IO, Function}, summary(io::IO, f::Function) @ Base show.jl:3111), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), IO, AbstractDict}, summary(io::IO, t::AbstractDict) @ Base abstractdict.jl:33), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), IO, T} where T<:Union{Base.KeySet, Base.ValueIterator}, summary(io::IO, iter::T) where T<:Union{KeySet, ValueIterator} @ Base abstractdict.jl:51), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), IO, AbstractString}, summary(io::IO, s::AbstractString) @ Base strings/basic.jl:234), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), IO, AbstractSet}, summary(io::IO, t::AbstractSet) @ Base show.jl:214), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), IO, AbstractArray}, summary(io::IO, a::AbstractArray) @ Base show.jl:3099), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), IO, Any}, summary(io::IO, x) @ Base show.jl:3081), REPL.REPLCompletions.MethodCompletion(Tuple{typeof(summary), Any}, summary(x) @ Base show.jl:3082)], 1:7, false)
julia> summary(
summary(head::Base.JuliaSyntax.SyntaxHead) @ Base.JuliaSyntax ~/.julia/dev/julia/base/JuliaSyntax/src/parse_stream.jl:98
summary(node::Base.JuliaSyntax.GreenNode) @ Base.JuliaSyntax ~/.julia/dev/julia/base/JuliaSyntax/src/green_tree.jl:39
summary(io::IO, f::Function) @ Base show.jl:3111
summary(io::IO, t::AbstractDict) @ Base abstractdict.jl:33
summary(io::IO, iter::T) where T<:Union{KeySet, ValueIterator} @ Base abstractdict.jl:51
summary(io::IO, s::AbstractString) @ Base strings/basic.jl:234
summary(io::IO, t::AbstractSet) @ Base show.jl:214
summary(io::IO, a::AbstractArray) @ Base show.jl:3099
summary(io::IO, x) @ Base show.jl:3081
summary(x) @ Base show.jl:3082
julia> summary( |
||
@test "ispublic" ∉ c | ||
|
||
c, r, res = test_complete("Base.ispub") | ||
@test res | ||
@test "ispublic" ∈ c | ||
|
||
@test Base.ispublic(Base, :ispublic) | ||
# If this last test starts failing, that's okay, just pick a new example symbol: | ||
@test !Base.isexported(Base, :ispublic) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about making this an option on
names
. Seems useful?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We considered that for a bit here, but I ended up thinking that the predicates we use to filter the names are awfully complicated and hard to understand and accurately document as is:
julia/src/module.c
Lines 955 to 959 in ebe1a37
and that it would be better to give users access to a full list of names and a set of predicates to filter with themselves. This arises from the belief that complex configuration is better expressed with code than keywords.
(I'm merging this bugfix now, but that does not close this discussion, feel free to open a feature request issue)