Fork me on GitHub
#lsp
<
2021-02-25
>
ingesol11:02:52

Hi! I used Calva for about. week now. Worked fine with refactorings, references search and other Clojure features for somedays, but last few days the message “Initializing clojure language features via clojure-lsp” is spinning in the bottom bar, and things like references search don’t work. I’ve tried restarting VS code and my mac. Any ideas?

ingesol11:02:29

This is also posted in #calva channel, @U0ETXRFEW thought it was a good idea to ask for help here as well. I tried different versions of calva from february, no luck so far.

dharrigan11:02:50

Is there any output on /tmp/clojure-lsp.*.out?

dharrigan11:02:04

I don't use a mac, but the clojure-lsp process does write out to /tmp

ingesol11:02:40

Found a bunch of statements like this

ingesol11:02:18

2021-02-25T11:27:54.356Z UnknownHost DEBUG [clojure-lsp.crawler:150] - Cannot find position for: fn* {:name fn*, :filename “/Users/…/util.clj”, :from myns.util, :col nil, :from-var group-and-count, :arity 2, :bucket :var-usages, :row nil, :to clojure.core} nil

dharrigan11:02:57

Those are okay

dharrigan11:02:09

It's overly verbose

ingesol11:02:11

Oh wait, maybe it actually completed this time? I suspect (embarrassingly) that it was a bad hook I wrote for clj-kondo

ericdallo12:02:47

I'll remove the verbose log for fn* 🙂

practicalli_john15:02:24

Is there a config to set a delay on symbol highlighting? I can switch highlighting off with lsp-symbol-highlighting-skip-current nil it seems, however, it would be more useful to me for a delay of a few seconds, so it only highlights when I linger on a symbol. This would be in the same way I can add a delay to the docstring popup with lsp-ui-doc-delay

ericdallo15:02:02

not sure there is a lsp-mode setting for that, let me check

practicalli_john15:02:46

I can use the function lsp-toggle-symbol-highlighting as a work around, toggling the highlighting on when I am most interested.

ericdallo16:02:32

@U05254DQM it seems it follows the lsp-idle-delay , but increasing that will cause other lsp features to delay too

👍 1
otfrom17:02:23

trying to figure out how to get this to work for M-. w/o doom emacs

(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)
searching for M-. is hard 😄

ericdallo17:02:52

What is M-. ? I don't know that BTW I use doom-emacs

otfrom18:02:26

M-. is cider-find-var. I'm just wondering the best way to re-bind it

ericdallo18:02:22

I think lsp-find-definition and lsp-find-references or lsp-ui-pee-find-references are enough indeed

otfrom18:02:59

yep, got that bit. Just failing on finding the right thing to do the rebinding just in clojure modes (or I suppose cider). Tho as it is a general lsp-ui-* thing it isn't just for clojure so I suppose I could tweak the global-key-map

otfrom18:02:07

ah, looks like I should have a lambda in the cider-hook that does a local-set-key (cribbing from other code)

ericdallo18:02:18

Yes, for your case using a cider-hook should be the best to add keybindings just for that

borkdude21:02:03

@ericdallo I sometimes copy functions to a new namespace but then my namespace form naturally is broken. Can LSP fix this?

ericdallo21:02:43

What do you mean namespace form?

borkdude21:02:39

e.g. I copy:

borkdude21:02:56

(deftest foo (is (str/starts-with? :foo :bar)))

borkdude21:02:16

and then I want clojure.test and clojure.string to turn up magically ;)

ericdallo21:02:47

Oh, you mean lap auto import the alias used on the moved function?

borkdude21:02:53

There was a project like that, but it's deprecated: https://github.com/technomancy/slamhound Maybe this can be done by inferring this from the clj-kondo aliases, etc

ericdallo21:02:11

Yeah, it could be done I think, I just wonder how user would use it

ericdallo21:02:18

Like via a code action

borkdude22:02:46

yeah, lsp-clojure-fix-namespace-form or something

ericdallo22:02:54

A single emacs command to that makes sense, but a code action not sure, since there is already the add-missing-require code action

snoe22:02:39

I think cider refactor has something like that... that's really a good source of actions before making up our own too

ericdallo22:02:10

you mean clj-refactor?

jumar08:02:30

cljr-move-form can do this