lsp

:clojure-lsp: Clojure implementation of the Language Server Protocol: https://clojure-lsp.io/
2021-03-16T11:26:58.001600Z

I’m still having problems with lsp-lens-mode making smartparens commands e.g. slurp/barf etc intollerably slow (like several seconds). I’ve set the lsp-idle-delay to 1.0 and similarly for company-idle-delay, is there anything else I can do?

ericdallo 2021-03-16T12:09:11.001700Z

lsp-lens should not affect that I think, does the issue only happen with lsp-lens-mode enabled?

2021-03-16T12:11:53.001900Z

to be honest I’m not too sure, it seems slowest with it… but also slower than it used to be without it

2021-03-16T12:12:07.002100Z

It could well be something else

2021-03-16T12:15:10.002300Z

- command-execute                                                 785  95%
 - call-interactively                                             785  95%
  - funcall-interactively                                         785  95%
   + counsel-M-x                                                  560  67%
   - sp-forward-barf-sexp                                         136  16%
    - sp--indent-region                                           126  15%
     - indent-region                                              126  15%
      - lsp-format-region                                         126  15%
       - lsp-request                                              120  14%
        - accept-process-output                                     1   0%
         - timer-event-handler                                      1   0%
          + apply                                                   1   0%
       - lsp--apply-text-edits                                      6   0%
        - mapc                                                      6   0%
         + #<compiled 0x1fe085d5cab5>                               6   0%

2021-03-16T12:15:32.002500Z

Is there a way to switch of lsp indentation support?

ericdallo 2021-03-16T12:16:31.002700Z

Yes

ericdallo 2021-03-16T12:16:48.002900Z

lsp-enable-identation or something like that

ericdallo 2021-03-16T12:17:06.003100Z

We have a issue about indentation performance on huge buffers

2021-03-16T12:17:25.003300Z

current buffer is maybe just 200 locs

2021-03-16T12:19:00.003500Z

ok setting that to nil seems to improve things

ericdallo 2021-03-16T12:20:29.003700Z

so maybe the issue is indeed the indentation, could you check the logs between server and client and see how much time is taking each server response

ericdallo 2021-03-16T12:20:34.003900Z

via lsp-workspace-show-log

ericdallo 2021-03-16T12:21:04.004100Z

BTW this can help as well: https://emacs-lsp.github.io/lsp-mode/page/performance/

ericdallo 2021-03-16T13:01:29.004400Z

I created a issue to solve this problem on cljfmt: https://github.com/clojure-lsp/clojure-lsp/issues/266

2021-03-16T13:04:13.004700Z

🙇 thanks

2021-03-16T13:06:41.004900Z

incidentally it seems sometimes my smartparen commands like slurp forward are now generating garbled states, is that a known issue?

ericdallo 2021-03-16T13:07:27.005100Z

not really, could you elaborate with a repro?

2021-03-16T13:09:05.005300Z

not sure I’ve only seen it in a proprietary code base at the minute… but it looks like the parser is generating a syntax error where there isn’t one

2021-03-16T13:10:39.005500Z

hmm actually there is an error, but it’s really a semantic one… i.e. an unbound var that I’m trying to slurp forward a let over…

2021-03-16T13:10:53.005700Z

2021-03-16T13:11:07.006100Z

I suspect the broken highlighting is because of that too

2021-03-16T13:12:30.006300Z

that’s the before state above… If I slurp forward the let vanishes

2021-03-16T13:12:43.006500Z

2021-03-16T13:12:50.006900Z

(after state)

2021-03-16T13:15:22.007100Z

hmm I fixed it up by hand but still got the syntax error, however closing and reopening the file worked

2021-03-16T13:16:50.007300Z

It’s weird though because lsp indentation should also now be disabled

2021-03-16T13:17:22.007500Z

ahh maybe I need to restart the workspace…

ericdallo 2021-03-16T13:18:07.007700Z

yeah, that's definitively is a out of sync clojure-lsp error 😞 the same issue we are discussing yesterday on the channel

ericdallo 2021-03-16T13:18:28.007900Z

at least now we have a way to repro, that always happen with smartparens actions?

2021-03-16T13:19:00.008100Z

They seem prone to it

2021-03-16T13:19:06.008300Z

not sure if it’s always the case

2021-03-16T13:19:39.008500Z

only started using lsp in the past few weeks; so I’m still figuring it all out

ericdallo 2021-03-16T13:19:46.008700Z

yeah, I could not repro using paredit

2021-03-16T13:19:56.008900Z

I wasn’t expecting formatting to be baked in

2021-03-16T13:20:16.009100Z

ok, I suppose I could switch back to paredit at somepoint

ericdallo 2021-03-16T13:21:01.009300Z

we still need to fix it somehow on clojure-lsp side, but if you could test with paredit just to check if that makes any difference, would help a lot

ericdallo 2021-03-16T13:21:14.009500Z

I need to repro the issue to understand how to fix it

1👍
dpsutton 2021-03-16T16:03:10.010200Z

i'm getting lots of out-of-sync issues requiring reopening the buffer.

ericdallo 2021-03-16T16:04:14.010300Z

😕 Do you have a repro?

ericdallo 2021-03-16T16:04:34.010500Z

Maybe we will need to disable that by default

dpsutton 2021-03-16T16:05:35.010700Z

no, but using it for longer than 20 minutes i kinda can't not run into it

dpsutton 2021-03-16T16:05:41.010900Z

i made a function

dpsutton 2021-03-16T16:05:45.011100Z

(defun personal/kick-it ()
  (interactive)
  (let ((b (buffer-file-name (current-buffer))))
    (save-buffer)
    (kill-buffer)
    (find-file b)
    (inf-clojure-minor-mode)))

ericdallo 2021-03-16T16:08:46.011300Z

yeah, we need to understand when that happens, I suspect is related with some specific client changes, like a change with iedit , smartparens and etc

rafaeldelboni 2021-03-16T20:08:54.011500Z

Just a followup, using the previous version all is working fine here.

ericdallo 2021-03-16T20:09:33.011700Z

@rafaeldelboni I'll release a new version tonight rollingback the incremental text changes until we fix it, maybe it should fix your issue

1🎉
ericdallo 2021-03-16T20:54:18.014500Z

:clojure-lsp: Released 2021.03.16-20.28.06 version • Fix server not analyzing after a wrong code on cljs files - https://github.com/clojure-lsp/clojure-lsp/pull/367Rollback incremental didChange adding a new :text-document-sync-kind setting with :full as default. Check https://clojure-lsp.github.io/clojure-lsp/settings/for more details This release should fix the out of sync issues until we make the incremental changes stable.

ericdallo 2021-03-16T20:54:38.014900Z

Could you try latest release?

ericdallo 2021-03-16T20:55:06.015400Z

@rafaeldelboni could you try latest release? https://clojurians.slack.com/archives/CPABC1H61/p1615928058014500

dpsutton 2021-03-16T20:55:44.015700Z

one thing i remembered i had was the semantic tokens turned on, but i never really saw any benefit

dpsutton 2021-03-16T20:55:57.015900Z

i just turned it off, and gonna try it out to make sure that wasn't it

ericdallo 2021-03-16T20:56:17.016100Z

The semantic tokens should not affect that, they are only visual

ericdallo 2021-03-16T20:56:48.016300Z

also, clojure-lsp only support macros, but I'll add support for other things like functions calls etc just like CIDER add colors when repl is on

dpsutton 2021-03-16T20:57:02.016500Z

goodness

dpsutton 2021-03-16T20:57:29.016900Z

that's weird that it would highlight the f function binding and the entire call site

ericdallo 2021-03-16T20:57:37.017100Z

Yeah, I think that is another issue when you have a local variable that is a function call

ericdallo 2021-03-16T20:58:04.017300Z

I think it's a clj-kondo analysis range issue, but I need to test it locally and confirm that

dpsutton 2021-03-16T20:59:14.017500Z

ah ok

dpsutton 2021-03-16T21:37:35.017700Z

feeling better after upgrading

ericdallo 2021-03-16T21:37:47.017900Z

nice 🙂