Open bjorn3 opened 1 year ago
I would love for an LSP implementation to exist someday for ISLE -- if anyone is looking for a fairly substantial and impactful, but well-defined and orthogonal, project, then this would be a great one.
Regarding syntax highlighting and automatic code formatting: I've gotten decent results by treating ISLE like Lisp, FWIW: lisp-mode
in Emacs auto-indents the s-expressions and lets me navigate the structure (paired parens, up a level, etc). Vim likely has equivalents too. A very janky first-draft implementation of isle-fmt
might just be Emacs in batch mode running indent-region
over the file! (Ideally we have something more self-contained and efficient than that eventually, of course.)
Apparently somebody has already implemented the "run Emacs in batch mode" approach to formatting Lisp source: https://github.com/eschulte/lisp-format/blob/master/lisp-format
As a quick way to get go-to-definition working, it would be pretty easy to emit a tags file from islec. vim
and emacs
both know how to navigate those, and that could make working with the codebase a little bit easier.
I don't think it would be much harder to implement a basic lsp server. Rust-analyzer has the lsp-server crate that does half the work.
https://github.com/yuyang-ok/isle-analyzer/blob/main/editors/code/README.md I have been developing IDE support for ISLE language a while. right now I think it is ready to launch.
Cool! What license does it have?
@bjorn3 Apache License 2.0 :-)
I made a tree sitter grammar which is working pretty well for syntax highlighting and navigation in Helix, but I haven't tested it very thoroughly yet.
https://github.com/jwnrt/tree-sitter-isle
FYI, I think the grammar in the language reference has fallen out of sync with the parser. It's missing some additions like if-let
, if
, partial
, pure
, and infallible
.
@jwnrt this is pretty cool! If you'd like to link to it from the ISLE docs, please feel free to submit a PR for that (maybe cranelift/isle/docs/language-reference.md
-- we'd be happy to take updates to the grammar there too if you have them top-of-mind, as it seems likely we've missed updates there as you note).
Currently ISLE doesn't have any IDE functionality. It would be nice to get the following: