This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-03
Channels
- # announcements (5)
- # babashka (7)
- # beginners (119)
- # biff (4)
- # cider (7)
- # clj-kondo (26)
- # cljfx (3)
- # cljs-dev (2)
- # clojure (28)
- # clojure-austin (18)
- # clojure-europe (9)
- # clojure-france (6)
- # clojure-norway (4)
- # clojure-uk (3)
- # clojurescript (6)
- # community-development (1)
- # core-async (4)
- # cursive (9)
- # data-science (12)
- # datomic (13)
- # duct (18)
- # emacs (15)
- # etaoin (5)
- # events (13)
- # honeysql (46)
- # hyperfiddle (9)
- # jackdaw (5)
- # jobs (13)
- # keechma (4)
- # lsp (37)
- # malli (32)
- # nbb (14)
- # off-topic (10)
- # other-languages (2)
- # polylith (4)
- # programming-beginners (3)
- # reagent (27)
- # reitit (1)
- # shadow-cljs (32)
- # sql (11)
- # tools-build (5)
- # tools-deps (3)
- # vim (14)
- # xtdb (11)
Hey there. At my company we are using jest test runner for cljs tests. Which means we don’t use clojure.test and instead use our own macros that gets translated to js/describe and js/it etc. My question is is it possible to somehow let lsp know about our macros to make this work for our setup?
(require '[cljest.core :refer [describe it]])
(describe "foo"
(it "returns bar"
(m/=? "bar" (foo))))
still treats it as a reference
(defn test-reference? [source-path {:keys [filename]}]
(and source-path
(not (string/starts-with? filename source-path))
(string/includes? filename "_test.")))
I think this is used to split them up. We use _spec
prefix. I guess that’s why they don’t show up.
it doesn’t need to be
and we haven’t open sourced it yet
we are just using it cos we have karma tests with _test prefix 😄
renaming to *_test, doesn’t help so I think it’s also something to do with classpath
hum, that function is only testing if:
• the current var you are seeing references lens, is not in the test source-path of the usage (e.g. we only show that a var has test references if the var is on src
and the test in another source-path like test
)
• the test reference filename has a _test
in its filename
• source-paths are properly configured (check lsp-clojure-server-info
)
so we have spec files next to the normal files
eg src/a.cljs
, and src/a_spec.cljs
if we can think on some kind of config generic that would work for most users and you we can create a issue
I noticed a regression last week, but I’m not sure if it’s in lsp-mode, or clojure-lsp. When using lsp-mode for xref-find-references
on foo
in (defn foo ...
, previously, the results wouldn’t include the defn line, and if there was only one reference, it would navigate straight to it (without needing to select the single result in the minibuffer). Now it does include it, which means it never thinks there’s a single reference.
This is something on the LSP spec, the client can ask for a references to include it's definition, there is a lsp-mode var for that IIRC
from lsp-mode code:
(cl-defun lsp-find-references (&optional include-declaration &key display-action)
"Find references of the symbol under point."
(interactive "P")
(lsp-find-locations "textDocument/references"
(list :context `(:includeDeclaration ,(lsp-json-bool include-declaration)))
:display-action display-action
:references? t))
Hum, we didn't change anything on clojure-lsp recently related to that and it's working properly to me, so I guess it's something on lsp-mode/your config, not sure what though
Strange. I’m pretty sure it was working for me until very recently, and I don’t think I’ve changed anything related either.
Oh, it’s in the CHANGELOG for 8.0.1:
lsp-find-references to include declaration by default
https://github.com/emacs-lsp/lsp-mode/commit/2c6a0e92402708780f18745f98ca128be64bbc78
I suggest you ask on Emacs-lsp discord why the change and how to change to the previous one
Okay, will do. It doesn’t look configurable, so I guess I need to make a wrapper to pass in the parameter