LanguageServer.jl icon indicating copy to clipboard operation
LanguageServer.jl copied to clipboard

Code completion for interfaces

Open gdkrmr opened this issue 4 years ago • 1 comments

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
=#

gdkrmr avatar May 22 '20 11:05 gdkrmr

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.

davidanthoff avatar May 23 '20 02:05 davidanthoff