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

Custom completions in macro context

Open chris-b1 opened this issue 3 years ago • 2 comments

This might be too specific to be implemented in the LanguageServer, but for consideration

Inside the context of macro, I would like the ability to hook into the autocomplete machinery and provide custom completions. E.g., consider the simplified example below, where ns. is spot I'd like to intercept.

I'd imagine this as an argument to the instantiation, something like like LanguageServerInstance(; macro_complections=Dict(:dsl => my_custom_completion_function)?


macro dsl(namespace, blk)
    # ....
end

@dsl ns begin
  function calc()
      return ns. # < custom tab completion here >
  end
end

chris-b1 avatar Mar 28 '22 19:03 chris-b1

Agreed, it would be very nice if we had a mechanism that allowed macros to hook into the LS. That will require a lot of thinking, thought, to come up with a way that works with our stability guarantees and is still general enough.

davidanthoff avatar Mar 28 '22 21:03 davidanthoff

Somewhat related, but I'd also like for a way to convey more information about syntax too, to affect syntax highlighting. I think that could make macros easier to debug (?) for the people writing them. I believe Language Servers can provide semantic information about syntax, right?

kdheepak avatar Aug 03 '23 02:08 kdheepak