joyride

hairfire 2024-02-28T21:33:16.952179Z

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

borkdude 2024-02-28T21:39:25.424909Z

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 #squint)

hairfire 2024-02-28T21:40:49.447639Z

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

borkdude 2024-02-28T21:45:31.922969Z

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

borkdude 2024-02-28T21:46:08.809269Z

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

borkdude 2024-02-28T21:46:30.012749Z

or an lsp server even?

hairfire 2024-02-28T21:55:42.847549Z

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 🤓

borkdude 2024-02-28T22:00:06.914319Z

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

borkdude 2024-02-28T22:00:40.190439Z

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

borkdude 2024-02-28T22:00:55.622099Z

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

hairfire 2024-02-28T22:02:35.183719Z

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

borkdude 2024-02-28T22:03:57.360399Z

yes

hairfire 2024-02-28T22:05:03.197739Z

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

borkdude 2024-02-28T22:05:40.394259Z

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

borkdude 2024-02-28T22:06:07.240319Z

> 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

hairfire 2024-02-28T22:06:52.375639Z

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

borkdude 2024-02-28T22:07:08.066359Z

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

hairfire 2024-02-28T22:07:51.846259Z

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

borkdude 2024-02-28T22:09:50.935619Z

then why do you need different syntax highlighting from clojure?

hairfire 2024-02-28T22:11:32.806059Z

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

hairfire 2024-02-28T22:12:31.881889Z

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

borkdude 2024-02-28T22:13:15.463459Z

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

hairfire 2024-02-28T22:13:42.155679Z

Wow! I'll take a look.

pez 2024-02-28T22:18:55.154399Z

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

🤓 2