Conversation
|
A quick peek looks good so far. Would you be able to add a It should contain some small examples of JavaScript code that can evaluated successfully in the client. The examples should give a sense of the expected behavior as well as help future contributors. Maybe show code that can't be evaluated so that a contributor in the future could resolve the problem. |
|
Hi! Sandbox has been added. |
|
The Almost all of the lines in
The Thanks for creating a very nice client! Works smoothly from what I can tell (I'm an infrequent user of JavaScript). |
|
I have some suggestions:
|
|
|
@Olical has a guide for Reloadable Fennel in Neovim. I hope that I got this correct. I believe the way it works is the I found that you first compile the module's file or the entire buffer (of the module's file if you're editing it). After that, you can switch back to a code buffer and see the new behavior of the client when you evaluate pieces of code. I find that another benefit of using |
|
Test your latest changes and they work. I think you don't have to worry too much about processing messages via stderr. That can come later. What you have now works well. I'll dig into my old notes and see if I can come up with some suggestions. |
|
@russtoku Thank you for your interest and suggestions! |
|
I just tested your recent changes and they work nicely! |
Olical
left a comment
There was a problem hiding this comment.
A great start! I have some comments on some Fennel code but I'll help you work through that where required. Thanks for putting the effort into learning so much for this! I know it's a bit of a mountain to climb but you're doing great so far.
|
And thanks for jumping in here to help while I was busy all week @russtoku! Much appreciated as always! |
|
Giving this a go locally and it seems to be working great for the most part. I ran into an issue with Looks like this if statement just falls through to a nil sometimes then when we try to concat it with a string it throws an exception because |
|
If I delete the very first line from the sandbox and re-eval the whole file I get the following: Which is interesting! |
|
@Olical Hi! Yes it was definitely a bug that I fixed, now <localleader>ef works. // eval (file): /home/olical/repos/Olical/conjure/dev/javascript/sandbox.js
(out) | | | | | | | | | let a = "foo";
(out) ^
(out) Uncaught SyntaxError: Identifier 'a' has already been declaredAnd that one is a result of the first one. |
|
Some small suggestions.
|
|
I ran through the |
|
Hello @russtoku, your suggestions are always on point! Thank you. |
|
I just found out about Conjure a day ago, and got it setup to help write and evaluate Lua code for Neovim. It's amazing! I also write a fair amount of JavaScript, and I'm looking forward to these changes. Thank you @Stansom for initiating it. It's great to see all the collaboration and support in this PR from @russtoku and @Olical. Great work guys. 👏 |
|
@gbroques, Thanks for the feedback! |
|
@Stansom, I ran through the sandbox.js agin and things are still working. |
…working with asynchronous code
|
You have a duplicate key mapping for (config.merge
{:client
{:javascript
{:stdio
{:mapping {:start :cs
:stop :cS
:restart :cr
:interrupt :ei
:stray :cs}}}}}))so both The Neovim command, When I changed the key mapping for Might I suggest using |
|
@russtoku Ohhhh, I'm blind... Thank you for catching the bug. |
Olical
left a comment
There was a problem hiding this comment.
Code and docs look good, it works great for me, this is a massive addition. Excellent work everyone! I'm really happy with this.
I want to find a way to remove the out prefix and mark things as evaluation results in some cases, but that requires some better stdio wrapping code. That's something I'll provide at some point and we can migrate clients to it. You've done a great job with the stdio wrapping code available right now, hopefully I can provide something more robust and smart some day soon!
| <localleader>ei Interrupt running command. Same as pressing Ctrl-C | ||
| in a cmdline REPL. | ||
|
|
||
| <localleader>cs Toggle stray out. |
There was a problem hiding this comment.
Should be ts but I'm updating that. Great addition for this language specifically. This is why we have clients with lots of freedom, mappings that make sense for one might not for others, we have wiggle room to get specific for each language and community 🎉
|
@Olical I wanted to thank you for this fantastic plugin. It was the main reason I switched from VSCode to NeoVim. I really wanted that quick feedback loop when working with Clojure, something VSCode's equivalent plugins couldn't provide at the time. When I saw how simple it was to work with the Clojure REPL in NeoVim using Conjure, I was instantly sold. It took some time to get used to, but the benefits have been huge. However, when working with JavaScript, I still had to go back to VSCode to get anything resembling “REPL-like” features. I wanted to write JavaScript in the “Clojure way,” with the same tight feedback loop for exploring and experimenting with code. Unfortunately, VSCode plugins couldn’t match the experience, they lacked proper support for imports and top-level asynchronous code. One day, I decided to look into Conjure’s source code to see if I could implement a client for a JavaScript REPL. I was delighted to find the sources were easy to understand. Your plugin's architecture is incredibly extensible, and the surrounding ecosystem is so well-designed that it allowed me to move quickly and have a great time building the client. The project is well-structured, the automatic compilation from Fennel to Lua is beautiful, and writing Fennel with Conjure is just so cool and fun. Thank you for creating such a great tool! Thank you as well, @russtoku . I really appreciate your quick feedback and helpful suggestions. Your involvement made a big difference! I hope this small contribution helps JavaScript developers write code faster and enjoy the “LISP way” of coding, with instant feedback and plenty of joy. |
Hi, I've added JavaScript support for Conjure. Because I use JS quite a lot, REPL support really helps me move faster and make fewer mistakes, providing a pretty similar experience to Clojure.
However, the Node.js REPL doesn't allow "dynamic rebinding" of vars. Functions declared using the "const fnName = (...args) =>" form are not re-declarable. I've introduced some transformations from the "const" form into the standard JS function form, so you don't have to constantly keep that Node.js quirk in mind. Also, the Node.js REPL doesn't support "import". My solution is to change "import" into the "const importName = require(...)" form, so you can use it easily.
JavaScript support helps me make quick sketches and experiments, and test my code immediately, just like I do in Clojure. I hope someone else finds it helpful too.