This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-23
Channels
- # announcements (3)
- # babashka (68)
- # beginners (297)
- # calva (13)
- # cider (4)
- # clj-kondo (8)
- # cljs-dev (10)
- # cljsrn (26)
- # clojure (100)
- # clojure-europe (4)
- # clojure-germany (1)
- # clojure-italy (9)
- # clojure-nl (5)
- # clojure-spec (9)
- # clojure-uk (41)
- # clojurescript (69)
- # conjure (70)
- # cursive (44)
- # data-science (20)
- # datascript (2)
- # datomic (55)
- # emacs (1)
- # exercism (3)
- # graalvm (2)
- # kaocha (11)
- # leiningen (6)
- # meander (9)
- # mental-health (1)
- # off-topic (73)
- # pathom (6)
- # pedestal (1)
- # re-frame (3)
- # reagent (52)
- # reitit (8)
- # rum (39)
- # shadow-cljs (152)
- # spacemacs (10)
- # tools-deps (28)
- # xtdb (5)
Hello! I use Copy as Kill to copy whole forms. However it does not work in library files because they are read only. Is there another solution? Perhaps it could be modified to work in these files? Thanks!
Hah, I never really understood what the use for copy as kill could be, thanks for the idea 🙂 I mostly use expand selection until I get what I want and normal copy
Someone somewhere talked about paredit/parinfer toggle being gone with 2020.1, and that it wasn't possible to find it in prefs either. Can't find the thread now, though. Any solution to this?
There is an issue for it in the cursive GH. Workaround is use the menu, under Smart Keys select Clojure therecitbis
Great! There’s actually a problem with the setting search due to an IntelliJ bug (I forgot to mention that in the release email) but hopefully no-one will need that if the widget is working again.
whoops, thanks guys 🙂 In reality we have a macro that does the quoting automatically and that cursive can't really resolve well
(defmacro ns-alias
"Set up a custom alias for use with namespace keywords.
(ns-alias com.nextjournal.journal.system sys)"
[ns as]
`(do
(create-ns '~ns)
(alias '~as '~ns)))
@helios If you swap your args as potetm and imre suggest then you could resolve your macro as alias
, which should work. However things may still be funky if that namespace doesn’t actually exist in your source code.
and we use it as (ns-alias foo bar)
since the quoting happens in the macro. But bar is unresolved
Yeah, there is a way to do custom resolution, but it needs to mirror clojure constructs.
you could also try reversing the order there and tell cursive to interpret it as the ns macro perhaps?
Yeah same. Probably best to just use symbols. Free-floating “symbols” are pretty bizarre in clojureland.
Cursive thinks a required namespace is unused when only used in a map with the namespace syntax. In the below example, foo
is marked as "Unused alias".
(ns unused
(:require
[foo :as foo]))
#::foo{:a "a"}
@cfleming by default the REPL scrolls all the way down on a new result. When the result is long I often find myself scrolling up to where it started being printed. With a long REPL history, I sometimes can't easily find the beginning so I just clear the whole REPL and type *1
or eval again. This is definitely an anti-pattern. Is there a configuration setting to auto-scroll not to the bottom but to the top of the last REPL result?
There isn’t, but that’s an interesting idea. Let me think about this and see if I can come up with a general solution.
Is there a way to rename a symbol to a namspaced symbol? As soon as I type the /
I get that error message and the Refactor button disables.
I just tested this, and it doesn’t do that in CLJ either. But that case is because there are only two lines in the docstring.
The way this works is that Cursive will find the shortest indent of all lines after the first one, and then trim that indent from all those lines. The first line is ignored because it usually has no indent due to the string itself being indented (like in your example).
If you add a third line after the second, indented to match the first one, then it works.
Unfortunately I think this is just an artifact of docstrings not being a great format for docs.
I’m actually planning to implement markdown for docstrings shortly, which should hopefully make all this nicer.
Hmm I understand the problem. We often will document functions like this:
(defn example
"Pass in a map of options with the keys:
foo: configure foo
bar: configure bar"
[opts])
The rendered docstring is a lot harder to read. Perhaps the solution is to always have the first line long enough that you need to indent to the second line 🙂 Empty lines seem to be ignored so it'd need to be a line with actual text.
Curious how markdown docstrings would solve this.