Remix.run Logo
NeutralForest 6 days ago

Janet is awesome but pretty please, work on the tooling. There's very little in the way of working and debugging interactively with the REPL from any IDE that I know of and last time I tried (on Emacs) there was barely a dedicated mode to work with it.

NeutralForest 6 days ago | parent | next [-]

Since other people mentioned there's been work there, here is my Emacs config now:

  (use-package janet-ts-mode
    :ensure t
    :defer t
    :vc (:url "https://github.com/sogaiu/janet-ts-mode"
            :rev :newest))

  (use-package ajrepl
    :ensure t
    :defer t
    :vc (:url "https://github.com/sogaiu/ajrepl"
            :rev :newest)
    :hook (janet-ts-mode . ajrepl-interaction-mode))
Also, a fix for treesit auto to not ask for the grammar every time:

  (use-package treesit-auto
    :pin melpa
    :ensure t
    :custom
    (treesit-auto-install 'prompt)
    :config
    (add-to-list 'treesit-load-name-override-list
               '(janet "libtree-sitter-janet-simple" "tree_sitter_janet_simple"))
    (add-to-list 'treesit-language-source-alist
             '(janet-simple . ("https://github.com/sogaiu/tree-sitter-janet-simple")))  
    (treesit-auto-add-to-auto-mode-alist 'all)
    (global-treesit-auto-mode))
terminalbraid 6 days ago | parent | prev | next [-]

Janet is also supported by conjure in neovim

https://github.com/Olical/conjure

The LSP for it works reasonably well.

packetlost 6 days ago | parent | prev | next [-]

I've also added Janet support to nvim-paredit [0] and use a combination of that, conjure [1], and nvim-parinfer to get a really slick editing experience in neovim.

[0]: https://github.com/julienvincent/nvim-paredit

[1]: https://github.com/julienvincent/nvim-paredit

[2]: https://github.com/olical/conjure

packetlost 5 days ago | parent [-]

Oops, I really messed up those links:

[0]: https://github.com/julienvincent/nvim-paredit

[1]: https://github.com/olical/conjure

[2]: https://github.com/gpanders/nvim-parinfer

chubot 6 days ago | parent | prev | next [-]

Have you tried contributing any tools?

worthless-trash 6 days ago | parent | prev [-]

I use janet ts mode in emacs and Ajsc netrepl integration, for at least a while now.

You should try again.

NeutralForest 6 days ago | parent | next [-]

I've been trying to use ajrepl but as mentioned in the README, there's a lot of cruft that gets output. How do you setup ajsc?

worthless-trash 6 days ago | parent [-]

In Emacs

  (add-hook 'janet-ts-mode-hook
          #'ajsc-interaction-mode)

  (add-hook 'janet-ts-mode-hook
          (lambda ()
            (local-set-key "\C-c\C-x" 'ajsc)))

  (add-hook 'janet-ts-mode-hook
          (lambda ()
            (local-set-key (kbd "C-x C-e") #'ajsc-send-expression-at-point)))

In the janet itself:

    (def repl-server
        (netrepl/server "127.0.0.1" "9365" (fiber/getenv (fiber/current))))
If you have tight main loop, make sure you have something like:

    (ev/sleep 0)             
To allow the netrepl server to take time.

Start janet (usually i do it via jpm)

  $ jpm -l janet -d main.janet
Then m-x ajsc and localhost:9365

This should be default.

If you dont start it in debug mode, you can't redefine functions as they are running.

I have an example using it for live web stuff here: https://github.com/wmealing/janet-joy-live

6 days ago | parent | prev [-]
[deleted]