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

Completion by LanguageServer #338

Open
4 tasks
zxj5470 opened this issue Feb 3, 2019 · 4 comments
Open
4 tasks

Completion by LanguageServer #338

zxj5470 opened this issue Feb 3, 2019 · 4 comments
Assignees
Labels
completion Better completion or incorrect completions language server Give up writing a complete analyzer
Milestone

Comments

@zxj5470
Copy link
Collaborator

zxj5470 commented Feb 3, 2019

  • Completion startsWith NAME
  • after Symbol DOT (show fields)
    • show a module's fields (names)
    • show an "object's" fields (fieldnames)
@zxj5470 zxj5470 added completion Better completion or incorrect completions language server Give up writing a complete analyzer labels Feb 3, 2019
@zxj5470 zxj5470 added this to the 0.5.0 milestone Feb 3, 2019
@zxj5470 zxj5470 self-assigned this Feb 3, 2019
@zxj5470
Copy link
Collaborator Author

zxj5470 commented Feb 3, 2019

Base.in(a::AbstractString,b::AbstractString)=occursin(a,b)
using REPL
search(name::AbstractString)=REPL.doc_completions(name) |> self->filter(it -> name in it,self)

usage

julia> search("dif")
6-element Array{String,1}:
 "diff"      
 "symdiff"   
 "setdiff"   
 "symdiff!"  
 "setdiff!"  
 "Cptrdiff_t"
julia> search("diff") .|> 
           Meta.parse .|>
               eval |>
               self -> filter(it->it isa Function,self) .|>
               methods |>
               Iterators.flatten |>
               collect .|>
               self -> self.sig

18-element Array{Type,1}:
 Tuple{typeof(diff),SparseArrays.SparseMatrixCSC}                        
 Tuple{typeof(diff),AbstractArray{T,1} where T}                          
 Tuple{typeof(diff),AbstractArray{T,N}} where N where T                  
 Tuple{typeof(symdiff),Any}                                              
 Tuple{typeof(symdiff),Any,Vararg{Any,N} where N}                        
 Tuple{typeof(setdiff),AbstractSet,Vararg{Any,N} where N}                
 Tuple{typeof(setdiff),Any}                                              
 Tuple{typeof(setdiff),Any,Vararg{Any,N} where N}                        
 Tuple{typeof(symdiff!),BitSet,BitSet}                                   
 Tuple{typeof(symdiff!),AbstractArray{T,1},Vararg{Any,N} where N} where T
 Tuple{typeof(symdiff!),BitSet,Any}                                      
 Tuple{typeof(symdiff!),AbstractSet,Any}                                 
 Tuple{typeof(symdiff!),AbstractSet,Vararg{Any,N} where N}               
 Tuple{typeof(setdiff!),BitSet,BitSet}                                   
 Tuple{typeof(setdiff!),AbstractArray{T,1} where T,Vararg{Any,N} where N}
 Tuple{typeof(setdiff!),Set,Set}                                         
 Tuple{typeof(setdiff!),AbstractSet,Any}                                 
 Tuple{typeof(setdiff!),AbstractSet,Vararg{Any,N} where N}               

julia> 

@zxj5470
Copy link
Collaborator Author

zxj5470 commented Apr 6, 2019

using Distributed # Threads
search_module_fields(module_name::String)=names(
  module_name|>Meta.parse|>eval; all = true
)  .|> String |> self->filter!(it->!startswith(it,"#"),self) |> println

O0%MJJZS_Y0JA0ENP(`GH T

@zxj5470
Copy link
Collaborator Author

zxj5470 commented Apr 16, 2019

struct A
 a;b;c
end
aobject = A(1,2,3)

fieldnames(A)
fieldnames(typeof(aobject))
# or
aobject |> typeof |> fieldnames

Return

(:a, :b, :c)
julia> aobject |> typeof |> fieldnames |> collect .|> String
3-element Array{String,1}:
 "a"
 "b"
 "c"

@zxj5470
Copy link
Collaborator Author

zxj5470 commented Jun 27, 2019

get return type

Base.return_types(occursin)
6-element Array{Any,1}:
 Bool                                      
 Bool                                      
 Union{Missing, Bool, ##58#59{_1} where _1}
 Bool                                      
 Bool                                      
 Union{Missing, Bool}                      

Specify param

Base.return_types(occursin,(Regex,SubString))
1-element Array{Any,1}:
 Bool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completion Better completion or incorrect completions language server Give up writing a complete analyzer
Projects
None yet
Development

No branches or pull requests

1 participant