Fork me on GitHub
#vscode
<
2022-03-17
>
craftybones06:03:07

How hard would it be to have an extension check an edn against a schema and highlight? Also, provide relevant autocomplete suggestions. Every time I use Vega Lite in Clojure, I miss this. The JSON version points to a schema and VSCode automatically highlights and completes based on this. It would be awesome to have while editing Clojure as well

pez06:03:40

This is a long shot. But recently @U02EMBDU2JU has added some extension points to Calva that might help with this. I think we would have to do more around these extension points to support it in EDN files, but anyway, it might be the way to go. The mechanism is that a library can provide Clojure code snippets whose results will populate the Calva hover view. So, maybe we could get it to where a library (that needs to be loaded in the REPL) gets called on hover, with the EDN and the current hovered symbol/form/whatever and responds with content for the hover.... Also clj-kondo has similar extension points, I think. Maybe the library can provide linting somehow... DISCLAIMER: I am purely speculating about all of this.

craftybones07:03:59

What if it isn’t in calva and is exclusively just an edn plugin?

pez07:03:04

That would be totally possible and possibly the best thing to do. if you go that route I'd suggest using ClojureScript all the way for such an extension. It'll give you access to big chunks of the Clojure ecosystem and the npm ecosystem as well. I don't really have an idea how much work it would be. Maybe have a look at @U5GP9FMC0’s cljfmt extension to get a quick starting point for some experiments: https://github.com/pedrorgirardi/vscode-cljfmt