anko / eslisp

un-opinionated S-expression syntax and macro system for JavaScript
ISC License
528 stars 31 forks source link

Question: docs/tips for syntax highlighting? #59

Open branneman opened 3 years ago

branneman commented 3 years ago

Which VS Code extension to you recommend to use for eslisp? I started using Lisp by Yasuhiro Matsumoto, but I'm unsure if better ones are available. What are your thoughts on this?

I think it adds value to recommend an existing VS Code extension in the readme or the docs. Why single out VS Code? Because it's the biggest one out there (especially in the JS community), and it's not a bad choice. (source)

Ideally, a specific eslisp syntax highlighter extension is created, but that would be a significant undertaking, and I can imagine you may have already had thoughts about this?

anko commented 3 years ago

Which VS Code extension to you recommend to use for eslisp?

I use vim for everything, so I wouldn't know.

Maybe eslisp secretly shares more syntax with different lisps such as Scheme or Clojure. [...] Ideally, a specific eslisp syntax highlighter extension is created

Eslisp's syntax is pretty much identical to Scheme, so I imagine modifying a Scheme highlighter would be the easiest option. I'm sure the source or such a highlighter has a list of standard forms somewhere, which could just be changed to correspond to eslisp's built-in macros instead.

If you want to make it, please do. I think it would be best in a separate repo, to separate concerns.

I think it adds value to recommend an existing VS Code extension in the readme or the docs.

I agree! It could go under doc/editor-extensions.md or such.

branneman commented 3 years ago

I use vim for everything, so I wouldn't know.

And which highlighting rules/package do you use in vim then? The one for Scheme?

anko commented 3 years ago

@branneman Yep.

autocmd BufEnter *.esl set filetype=scheme

Though I use that less for the highlighting, and more for how it changes the rules of vim's built-in autoformat command (=) to use a "wider" Lisp style:

(= value
   (object k1 v1
           k2 v2))

The more compact style it uses with no filetype is sometimes less clear:

(= value
 (object k1 v1
  k2 v2))