Fork me on GitHub
#lsp
<
2024-07-08
>
borkdude12:07:41

Does anyone have a slow moving cursor in emacs with lsp-mode when you hit the up or down arrow? When I disable lsp, it's normal again

lassemaatta12:07:10

Nope. Have you ran the profiler?

borkdude12:07:47

tell me how to do that again

lassemaatta12:07:42

1. M-x profiler-start , choose cpu 2. scroll up and down for a while 3. M-x profiler-stop 4. M-x profiler-report

ericdallo12:07:54

Looks ok to me too

lassemaatta12:07:57

you can use tab to expand those + to see the call stack and maybe identify some lsp-* taking a large %

borkdude12:07:35

I don't see any lsp- thing in there

lassemaatta12:07:39

just for reference here's what it looks on my machine running on WSL (sure, comparing different emacs setups is pointless but still)

lread12:07:15

Maybe start with wiping all emacs caches and built stuff? I've found that can sometimes "fix" mysteries.

borkdude12:07:04

yeah, I wiped my .elc files and the entire elpa dir a few times already

lassemaatta12:07:12

I'd try expanding that command-execute branch and see what's eating up the cpu there

ericdallo12:07:23

ido-completing-read looks suspicious

ericdallo12:07:10

do you have ido-mode enabled on that buffer?

borkdude12:07:05

disabling ido-mode doesn't make a difference

ericdallo12:07:49

try a new profilling without ido, that function should not be in the profile now

lassemaatta12:07:29

or expand the tree further, as those ido functions seem to just add advice wrappers which show up in the call stack when running interactive commands

☝️ 1
lassemaatta12:07:06

iow. check if you can expand that #<compiled 0xbf...> node and see whats under it

borkdude12:07:23

it's still there but perhaps it is because I do M-x profiler-stop ?

lassemaatta12:07:03

yeah, that's possible. I've bound the profiler functions to F9-F11 to work around that

borkdude13:07:03

ok binding to those hotkeys helped. here's the new result

borkdude13:07:03

not much to see

lassemaatta13:07:21

at least some of that stuff seems to related to updating the mode line, perhaps try if something like (setq lsp-modeline-code-actions-enable nil) has any effect? (https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/)

borkdude13:07:54

let me put it like this. go to a reasonably dense clojure file. move up and down with cursor. switch to text-mode. do you feel the difference?

borkdude13:07:01

setq didn't help

lassemaatta13:07:06

I enabled some lsp(-ui) settings (`lsp-headerline-breadcrumb-enable`, lsp-modeline-code-actions-enable, lsp-ui-sideline-*) (I've normally disabled most of the UI stuff) and set lsp-idle-delay from 0.5 to 0.01 -> scrolling up and down still feels fast but I get a similarish profiler report as you (especially that compiled -> mapc -> compiled -> lsp--parser-on-message -tree). My cpu usage on a couple of cores goes up, but the same happens on text-mode :man-shrugging:

2️⃣ 1
borkdude11:07:33

it could also be that I'm simply hitting memory limits, while working on an application on a 16gb machine

lassemaatta11:07:28

time to rename emacs to sgacs 🙂

borkdude11:07:01

I'm afraid this reference is lost on me

lassemaatta11:07:38

emacs = eight megabytes and constantly swapping -> sixteen gigabytes and constantly swapping

borkdude15:07:12

it seems to be proportional to the length of the file I'm in

borkdude11:07:11

I downloaded emacs-mac again via brew install --cask and the problem vanished. Note to self: don't use emacsforosx again

👍 1
🎉 1
borkdude11:07:31

It's no fun when you dread using your clojure development environment because of an issue like this

lread18:07:18

You must have been operating below 10 borks, when you usually hover at around 10000. Glad you are back in borkness!

borkdude18:07:18

well, I was away for a vacation anyway, but I dreaded going back to that slow editor...

ivangalbans15:07:09

Hi folks, I'm using a re-frame tracing fn-traced and I have set in .clj-kondo/config.edn to lint as fn

{:lint-as {day8.re-frame.tracing/fn-traced clojure.core/fn}}
This works but the formatting is not working as expected:
;; what I get: Wrong!

(rf/reg-event-fx
 :initialize
 (fn-traced [_ _]
            {}))

;; how it should be: OK!

(rf/reg-event-fx
 :initialize
 (fn-traced [_ _]
   {}))

;; what I get with fn: OK!

(rf/reg-event-fx
 :initialize
 (fn [_ _]
   {}))
What am I missing to format it correctly as fn?

ericdallo16:07:42

clj-kondo has nothing with format, format is a cljfmt feature that we use, so you want to change the :cljfmt setting in a .lsp/config.edn