Fork me on GitHub
#joyride
<
2024-02-28
>
hairfire21:02:16

Has anyone ever written a VSCODE Language Extension for a DSL using Joyride? Is this even possible?

borkdude21:02:25

joyride is aimed a little scripts, not extensions that other people can install. For writing extensions I would just choose JS/TS, or CLJS (or #C03U8L2NXNC)

hairfire21:02:49

Thanks for the quick response. Do you know of an example in CLJS or #C03U8L2NXNC?

borkdude21:02:31

I don't have one at hand, but perhaps PEZ will chime in later

borkdude21:02:08

An extension for a DSL, do you mean something like diagnostics, a linter?

borkdude21:02:30

or an lsp server even?

hairfire21:02:42

I'm new to this subject. I have designed a DSL, and a Clojure utility program that consumes files written in the DSL and generates C++ code. Some of my utility users want to be able to develop the DSL input files in VSCODE, and have all of the syntax highlighting and other features that an LSP for my DSL can provide. I hope that makes sense 🤓

borkdude22:02:06

yeah makes sense. well, clj-kondo + clojure-lsp do something similar, but neither of those are written in something that compiles to JavaScript

borkdude22:02:40

the thing is, if you have an lsp server, it kind of works out of the box with VSCode because you implement a protocol

borkdude22:02:55

you need just a tiny amount of JS to hook stuff up

hairfire22:02:35

An lsp server? Is that a stand-alone program?

hairfire22:02:03

VSCODE starts a platform-specific executable, and communicates with it via some protocol?

borkdude22:02:40

but for syntax highlighting I think you need something else. lsp is more for navigation, linting etc. I think if I were you I'd just follow the vscode docs and try to hack something in JS using their basic examples and then when you have something working migrate to CLJS These are the syntax highlighting docs https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide

borkdude22:02:07

> VSCODE starts a platform-specific executable, and communicates with it via some protocol? Yes, but it can also be a Java process or JS process or whatever, doesn't have to be an executable

hairfire22:02:52

Thank you for the pointers, @U04V15CAJ, it sounds like this is going to be "fun" 😬

borkdude22:02:08

Is the DSL clojure-like or more C-like?

hairfire22:02:51

It is Clojure-like (e.g., (KEYWORD Param1 Param2 (NESTED-KEYWORD P1 P2)))

borkdude22:02:50

then why do you need different syntax highlighting from clojure?

hairfire22:02:32

I'm not sure I do. I will probably need support different from Clojure when it comes to other things (e.g., completions)

hairfire22:02:31

There are also a dozen, or so, semantic rules that I'll need to implement as well

borkdude22:02:15

I've done an lsp server for a custom-clojure once which has completions: https://github.com/zen-lang/zen-lsp

hairfire22:02:42

Wow! I'll take a look.

pez22:02:55

As it happens, Joyride is an example of an extension written in ClojureScript.

🤓 2