julia-vscode / LanguageServer.jl

An implementation of the Microsoft Language Server Protocol for the Julia language.
Other
365 stars 80 forks source link

Code completion for interfaces #712

Open gdkrmr opened 4 years ago

gdkrmr commented 4 years ago

Here is a fun idea: Provide templates for interfaces. I.e. I want to provide an iterator interface for the type T LanguageServer.jl could provide skeletons for all required functions. Not sure how much hand holding is required. Here is an example:

function Base.iterate(x::T)
  if # condition that the iterator has finished
    return nothing
  else
    # element = the element
    # next = next state
    (element, next)
  end
end

function Base.iterate(x::T, state)

end

#= optional functions
function Base.eltype(::Type{T})

end
function Base.length(t::T)

end
=#
davidanthoff commented 4 years ago

Hm, couldn't this be done with some sort of snippet in VS Code?

In general, this seems too specific to me, in particular given that Julia doesn't have a notion of a formal interface.