This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-16
Channels
- # announcements (25)
- # babashka (15)
- # beginners (14)
- # calva (60)
- # circleci (1)
- # clerk (1)
- # clj-kondo (13)
- # cljdoc (7)
- # clojure (45)
- # clojure-austin (1)
- # clojure-bay-area (1)
- # clojure-brasil (4)
- # clojure-dev (9)
- # clojure-europe (24)
- # clojure-norway (105)
- # clojure-uk (2)
- # clojurescript (6)
- # conjure (1)
- # core-typed (4)
- # cursive (4)
- # datalevin (1)
- # datomic (25)
- # emacs (31)
- # fulcro (3)
- # humbleui (10)
- # hyperfiddle (19)
- # jobs (2)
- # luminus (3)
- # malli (13)
- # nbb (5)
- # off-topic (16)
- # polylith (2)
- # portal (7)
- # releases (2)
- # shadow-cljs (5)
- # sql (8)
Have a question about indentation in clojure-mode
. both clojure-mode
and clojure-lsp
has its own config for indentation. I want to stick with clojure-lsp
, how I can apply it to line indent(i.g. the indent behavior each time I press RET
)?
not your exact question, but you could apply clojure lsp indent on file save with https://github.com/radian-software/apheleia
For one time format I can do lsp-format-buffer
without problem. But it's annoying that the format is different during the typing. I guess lsp only has formatting for whole buffer, there's no line based format?
If you use CIDER: cider alters clojure-mode indentation rules dynamically. And it's possible for CIDER to read .cljfmt.edn dynamically (I have a wip https://github.com/clojure-emacs/cider-nrepl/pull/754) So that would be a possible solution. It technically doesn't use clojure-lsp, but both solutions would essentially use cljfmt and .cljfmt.edn. So the result would be the same. I'm highly interested in formatting being less of a mess (i.e. have most tools follow the same basic rule) so I might look into this again soon.
I'd be interesting in a feature like that @U0NBGRGD6 as well without the need of a REPL on, I think we could achive this making some minor changes in https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-clojure.el, like after lsp started, request clojure/serverInfo
which will bring cljfmt settings, and then convert to indent config like cider does :)
Should be a nice contribution and not hard to do, LMK if you have interest in contributing :)
I have two questions,
Does clojure-lsp
provide a way to query cljfmt config?
How could clojure-mode handle those rules specified with regexp?
Yes, that's how calva does ATM, it requests clojure/serverInfo
which contains the cljfmt setting being used there, there is already a function in lsp-clojure.el requesting that.
Good question, maybe check how cider does?
Anybody tried the treesitter mode for Clojure? Any advantages over good old clojure-mode
?
I tried and failed to get Treesitter working with Emacs (didn't have much time), although Treemacs is excellent with Neovim and Clojure. Very fast. In theory, a Clojure-mode on top of Treesitter should be very perfomant and potentially simplify the code in Clojure-mode (or reduce the codebase). But I've only had a cursory glance...
I see - I just followed this guide from Mastering Emacs https://www.masteringemacs.org/article/how-to-get-started-tree-sitter - seems to work out of the box with tsx-/elisp-/makefile-
modes. Although I'm on 29.1 version so maybe I why I didn't run into any issues so far
I'm interested to know what difference treesitter makes for Clojure development and if https://github.com/clojure-emacs/clojure-ts-mode helps, as it seems to be an eventual successor to clojure-mode
one thing that is annoying right now is that major mode hooks have to be updated, e.g. despite instructing emacs to use clojure-ts-mode when clojure-mode is requested, it doesn't know that for clojue-mode-hooks, you have to update all your configuration to use clojure-ts-mode-hooks. You can follow along as I'm updating my config 😉 https://github.com/lukaszkorecki/command-center/pull/3/files
Another option is (add-to-list 'major-mode-remap-alist '(clojure-mode . clojure-ts-mode))
It won’t, and other major modes that depend on Clojure-mode explicitly (Monroe) seem to break, at least that’s how I’m experiencing it. Gonna wait until tree sitter modes are the default
im daily driving clojure-ts-mode, works great, i love it, although for the moment i set indent functions back to clojure-mode, but that’ll be improved shortly.
if you’re interested in the general ecosystem surrounding treesit, ts-fold, combobulate, DIY stuff, etc there’s advantages , otherwise for now best case scenario you’ll notice no real difference (feature parity is current goal), maybe a slight performance increase
if you’re interested in any non lisp languages, treesit makes it possible to manipulate languages as if they were lisps , in terms of the editing experience you’re probably use to in clojure/paredit/etc
So far I installed a bunch of modes for non-Clojure languages and things seem to work... a bit faster I guess?
couldn't make it work as a replacement for clojure-mode, too many things didn't work for me
@U0JEFEZH6 no parinfer? that’s like running with scissors