[Show & Tell] Editor Tooling: Janet LSP and Janet++ for VS Code #1305
Replies: 7 comments 4 replies
-
I have limited time to evaluate the Janet++, but from what I have seen, it is very high quality! Thank you very much. I see this as a big step forward! I will report back when I have more time to spend with it. <3 |
Beta Was this translation helpful? Give feedback.
-
I’m not a VSCode user, but heavy LSP user via neovim. Super excited that someone’s picked up the torch and would be really happy to pitch in where useful. |
Beta Was this translation helpful? Give feedback.
-
For the record, CFiggers' janet-lsp fork is useful already in Emacs 29.1 using eglot. This bit of code may be helpful if using (with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(janet-ts-mode . ("janet-lsp")))) or if using one of the (with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(janet-mode . ("janet-lsp")))) cfiggers-janet-lsp-emacs-eglot.mp4 |
Beta Was this translation helpful? Give feedback.
-
There are some rough edges still, but had some success hooking up CFiggers' For the adventurous (note: CFiggers'
|
Beta Was this translation helpful? Give feedback.
-
Janet++ is pretty cool, gave it a shot with vscode and it worked out of the box! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
With the pre-release version active, this issue seems to be fixed! Thanks a bunch for the heads up and working on it :) |
Beta Was this translation helpful? Give feedback.
-
For the past year or so (and since February in earnest) I've been working on a personal fork of the official VS Code extension for Janet. I'm heavily inspired to do so by (and I have directly adapted significant amounts of the internals of) BetterThanTomorrow/Calva, which is, without competition, the best VS Code extension for Clojure on the VS Code Extension marketplace.
I like Calva a lot, and when switching from Clojure to Janet as my tinkering language of choice I quickly missed a number of things that Calva offers (this list is non-exhaustive and in no particular order):
Tab
)let
bindingsWith my fork of vscode-janet, I've been trying to recreate the Calva experience as much as possible, but for Janet instead of Clojure. I've been moderately successful—mostly by just swiping the bits from Calva that I miss and haphazardly adapting them to Janet!
Over the past month, I've finally gotten it to a point where the bugs are occasional annoyances rather than things to be constantly and actively worked around (which is how things started). And also, I've added one of the last remaining "big pieces" that Calva offers that my pale imitation did not—and that is, an LSP-compliant Language Server. I started with the work of John Doneth in JohnDoneth/janet-language-server. I completely reworked and expanded the on-hover documentation feature, fixed some bugs with the RPC responses that were causing errors/crashes in some situations, and got dynamic relative imports working (I think), which removed some of the hard-coding that was in there when John Doneth last touched it. Otherwise, I'm mostly using John's code unchanged. I then compiled the server into binaries (for Linux and Windows only, at the moment) and bundled those with the VS Code extension. So on installing, the LSP just works out of the box in VS Code, hopefully without needing direct configuration or setup from the user. That's just like Calva does it with clojure-lsp.
This expanded version of vscode-janet, which I'm calling Janet++ for the time being, is now published on the VS Code Extension marketplace and if you use VS Code you can go find and install it right now by searching for "janet" in the regular ol' extension panel in the VS Code sidebar!
The other thing about Janet LSP is, I did check to see whether John Doneth is still around and interested in collaborating on his janet-language-server project. But, in absence of a response from him to that inquiry from two weeks ago (yet, I would still be interested in collaborating on his project as the main repo for a Janet LSP server if he resurfaces at some point), in the mean time I have forked janet-language-server into CFiggers/janet-lsp as a place to store my updates and pull from for building Janet++. Ideally, that project could be useful for anyone with an LSP-capable editor, not just VS Code. I am not a vim/neovim user primarily, but in ~20 minutes of tinkering I was able to pretty easily get Janet LSP talking to NeoVim and providing completion and on-hover documentation for Janet! So the proof-of-concept is there at least.
I think having a well-supported LSP could be a big jump up in tooling support for Janet, particularly because it works across a wide variety of different editor setups (as long as the editor has or can get an LSP client). So, even if you don't use VS Code, I'd be really eager for collaborators on Janet LSP because I think that could move the general state of Janet tooling forward in a big way. The best part is, unlike the VS Code extension, which is written in both TypeScript and ClojureScript (because that's how Calva is written, and I just shamelessly stole 99% of this thing from them... woof), Janet LSP is written entirely in Janet, so it should be readily hack-on-able for any of us who know Janet and would be interested in tinkering!
Take-aways/Calls to action
The take-aways are, Janet++ and Janet LSP exist, such as they are. Yay!
As for calls to action, I'd really love it if anyone here who's interested would like to:
Thanks for reading!
Beta Was this translation helpful? Give feedback.
All reactions