This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-16
Channels
- # announcements (2)
- # asami (124)
- # babashka (30)
- # babashka-sci-dev (73)
- # beginners (40)
- # biff (1)
- # calva (39)
- # clj-kondo (54)
- # clj-otel (1)
- # cljdoc (59)
- # cljs-dev (8)
- # clojars (2)
- # clojure (96)
- # clojure-austin (16)
- # clojure-boston (6)
- # clojure-europe (51)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-russia (60)
- # clojure-uk (4)
- # clojurescript (34)
- # community-development (6)
- # cursive (2)
- # datahike (10)
- # datascript (18)
- # emacs (109)
- # etaoin (1)
- # events (3)
- # figwheel-main (41)
- # fulcro (13)
- # helix (4)
- # introduce-yourself (5)
- # jobs (1)
- # leiningen (5)
- # lsp (8)
- # malli (6)
- # meander (7)
- # nrepl (6)
- # off-topic (60)
- # pathom (29)
- # polylith (8)
- # re-frame (5)
- # reitit (1)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (33)
- # sci (3)
- # shadow-cljs (3)
- # xtdb (82)
I’ve a question on Calva +cljfmt. Basically Calva can read a .cljfmt.edn file, the file content is basically
{:indents {some-indents-settings}}
However, for the command
clojure -Sdeps '{:deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}}' -M -m cljfmt.main --indents indentation.clj
The expected contend of indentation.clj
is {some-indents-settings}
instead of the whole content {:indents xxx.
My question is, how can I reuse .cljfmt.edn for both calva and the above command?@U2DART3HA See what ?
Sorry, I was raising my finger because I'm interested in the answer too.
This is more generally a cljfmt question, I think. It's cljfmt that specifies the cljfmt.edn
shape, and also the options for the cljfmt command line. What you can do is to make a script that extracts the :indents
entry and writes it to a file, then something like:
extract-indents.clj > indents.edn && clojure -Sdeps '{:deps {cljfmt/cljfmt {:mvn/version "0.8.0"}}}' -M -m cljfmt.main --indents indents.edn
Not sure how VS-Code calls this feature, but is really driving me crazy. Since recently, Calva added “snippets”, so that common used forms such as defmethod
expand to a form with placeholders that you can jump to using <Tab>
.
However, this is inconsistent with other Clojure completion, and regularly gets into my way.
For example, when typing (if-
, I get a menu with auto-completion for if-let
, if-some
, etc. I can select one and hit <Enter>
or <Tab>
and can continue typing.
However, this breaks with forms that have a “snippet”. For example, when I select if
from the list after typing (if
, I will end up with the snippet expanded within the parentheses, ending up with double parentheses:
((if test-expr
then-expr
else-expr))
How can I turn this off?I don't know where these snippets are coming from, actually. Is it clojure-lsp, @UKFSJSM38? This happens to me quite often with Rich comments. Anyone else in the <!subteam^S03BGSAUPTQ|@calva-team> have an idea what's going on?
yes, they come from clojure-lsp https://clojure-lsp.io/features/#snippets
Thanks! Do you want an issue about this? I like the help, but it seems wrong that even though the input is something like (comm)
the snippet inserts ((comment))
.
yes, would not be a easy fix on clojure-lsp as all snippets are independent from current code context
Thanks for the support ❤️ I did not use LSP outside of what comes with Calva yet… is there maybe a way to disable snippets?
Yeah, the clojure-lsp snippets got recently added to calva’s autocomplete. They’ve existed for a while, but “snippets” itself had a broken lsp protocol interaction until around 2 months ago. And until a few weeks ago nrepl autocomplete was preferred over clojure-lsp, so you’d only see the snippets if you didn’t connect a repl
no, ATM there is no way to disable via clojure-lsp config, but there is via client initiationOptions snippetSupport
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_completion
Can you file that, issue, @U031CHTGX1T? I need to go afk for some hours here.
Of course, leave that to me. And thanks again!
Oh and while fixing the snippet lsp protocol bug we made a design decision to not provide two versions for the things that have snippets. So if-let only exits as a snippet, not as a macro autocomplete. If we can’t find a better fix, we could change that decision. That way you could choose if you want the basic completion or the snippet.
@UKFSJSM38 Could we use the client/unregisterCapability
request to unregister snippets after initialization? Would support for that need to be added to clojure-lsp?
Yes we can do that already, or yes that support can be added to clojure-lsp and then we can do that?
sorry, I misread the questions.
ATM clojure-lsp doesn't support unregisterCapability
, so we would need to add support for that, even so, a config to disable snippets may be convenient too
I think it would be pretty awesome to have that support in clojure-lsp. Calva could then add settings to enable/disable features without a server restart, and those same settings could be used when creating the initialize request so that only the desired capabilities are enabled at server startup.
yep, makes senses, and it should not be hard to implmement it I think, feel free to create one more issue about that 😂
I'm still researching how to solve #982 properly, but that idea of supporing register/unregister capabilities on the fly is a nice to have
@U031CHTGX1T, this should be fixed on clojure-lsp master, you can test it via #clojure-lsp-builds or wait for next release which should be soon.
I managed to fix for cases like (|)
or whatever that it has valid parens match, but not (|
because we can't parse code properly, but I don't think this is that common as most users use paredit like features.
For are
testing function I'm getting this warning
; WARNING: Use of undeclared Var forever-clojure.core/are at line 1 <cljs repl>
I started a cljs node
repl.
Hi. This issue is probably more of the vscode side. clojure-lsp has a nice feature of lint on unused public vars
. However, the lint messages are show in the problems pane
in vscode. I’d like the relevant unused public vars to be only decorated (hinted) in the editor, but NOT shown in the problems pane. Way to achieve?
I am aware vscode has a filter functionality on problem pane, but yet, the problem count is not affected by this option.