Fork me on GitHub
#lsp
<
2023-01-26
>
ericdallo12:01:01

clojure-lsp Released https://clojure-lsp.io/ 2023.01.26-11.08.16 with lots of improvements and new features! 🚀 • General ◦ Bump clj-kondo to 2023.01.20 ◦ Avoid false-positives of unused-public-var for functions used in :gen-class that starts with - as convention. https://github.com/clojure-lsp/clojure-lsp/issues/1443 ◦ New jar available on releases: clojure-lsp-server.jar, an Uberjar not aot-ed containing both clojure-lsp core + server code, improving startup time for JVM clients, for example for lein-clojure-lsp. Any lib using clojure-lsp-standalone.jar should consider switch to this new jar. ◦ Change :source-paths-ignore-regex default value to ["target.*"], removing resource folders. https://github.com/clojure-lsp/clojure-lsp/issues/1452 ◦ Bump cljfmt to 0.9.2 ◦ Bump lsp4clj to 1.7.0 • Editor ◦ Fix add missing import code action when there are multiple options. https://github.com/clojure-lsp/clojure-lsp/issues/1422 ◦ Only show completion items if no changed code is being processed, avoiding wrong completion items. https://github.com/clojure-lsp/clojure-lsp/issues/1425 ◦ Improve semantic tokens for defprotocol, definterface coloring as interface tokens. ◦ Include reffered vars in completion. https://github.com/clojure-lsp/clojure-lsp/issues/1440 ◦ Allow rename alias of function calls, renaming properly both function usages and alias definition. ◦ Add support for keyword analysis in edn files, allowing find-references, document highlight and other lsp features to keywords. ◦ find-definition and references for quoted symbols like 'clojure.core/inc and symbols mentioned in .edn files. https://github.com/clojure-lsp/clojure-lsp/issues/1446 ◦ Show error messages when can't apply edits after commands. https://github.com/clojure-lsp/clojure-lsp/issues/1448 • API/CLI ◦ Make diagnostics command print as json or edn. https://github.com/clojure-lsp/clojure-lsp/issues/1419 ◦ Make possible starting a chan server with clojure-lsp components, useful to other clients extend. ◦ Consider edn files when linting project, allowing to format edn files. https://github.com/clojure-lsp/clojure-lsp/issues/1452 ◦ Report diagnostics lines and columns as 1 based, not 0 like LSP, following clj-kondo standard. https://github.com/clojure-lsp/clojure-lsp/issues/1459 Main highlights: • clojure-lsp now understand edn files, making most features work out of the box, like navigate to/from keywords and symbols (gif) • Navigation of quoted symbols (e.g. 'clojure.core/inc) now works • Lint now consider edn files, not only clj* ones. • Tweaks across multiple features, renaming, completion, semantic tokens, code actions. Thank you for all contributors and sponsors! gratitude

clojure-lsp 16
clj-kondo 8
calva 6
emacs 10
catjam 10
neovim 4
❤️ 10
borkdude12:01:12

> Uberjar not aot-ed ... improving startup time for JVM clients How does not AOT-ing improve startup time?

ericdallo13:01:45

It's aot, but the lein-clojure-lsp was using the standalone jar, not the lib one

elken13:01:23

> Add support for keyword analysis in edn files Thanks for adding this! Is this something I have to opt-in to?

elken13:01:21

Ah so it's not! Great release 🙂

🍻 2
emilaasa16:01:04

Keywords! Weee !

Felipe18:01:13

I get Internal error when running lsp-format-buffer. went through the troubleshooting docs but no luck. any ideas?

2
Felipe18:01:52

I would, but lsp-clojure-server-log also gives me Internal error

Felipe18:01:34

and there's nothing in /tmp. unless macos throws tmp files in a different place

ericdallo18:01:39

weird, but you can set the server log via :log-path as well

Felipe18:01:23

wait, I found $TMPDIR

ericdallo18:01:10

Usually it's on /tmp/clojure-lsp-*.out

Felipe18:01:44

2023-01-26T18:00:28.707Z  ERROR [clojure-lsp.server:55] - Error receiving message: Internal error (-32603)
{:id 1133, :method "textDocument/rangeFormatting"}
com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine  PosixPlatformThreads.java:  203
            com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine       PlatformThreads.java:  775
                            java.util.concurrent.ForkJoinWorkerThread.run  ForkJoinWorkerThread.java:  183
                              java.util.concurrent.ForkJoinPool.runWorker          ForkJoinPool.java: 1594
                                   java.util.concurrent.ForkJoinPool.scan          ForkJoinPool.java: 1656
                 java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec          ForkJoinPool.java: 1020
                                 java.util.concurrent.ForkJoinTask.doExec          ForkJoinTask.java:  290
                  java.util.concurrent.CompletableFuture$AsyncSupply.exec     CompletableFuture.java: 1692
                   java.util.concurrent.CompletableFuture$AsyncSupply.run     CompletableFuture.java: 1700
                                         promesa.util.SupplierWrapper/get                  util.cljc:   21
                                            promesa.exec/wrap-bindings/fn                  exec.cljc:  147
                                                 clojure-lsp.server/fn/fn                 server.clj:  291
                                    clojure-lsp.handlers/range-formatting               handlers.clj:  401
                              clojure-lsp.feature.format/range-formatting                 format.clj:   54
                                                                      ...                                 
                                  clojure.core.memoize/cached-function/fn                memoize.clj:  231
                                                       clojure.core/deref                   core.clj: 2337
                                 clojure.core.memoize.RetryingDelay/deref                memoize.clj:   47
                                      clojure.core.memoize/through*/fn/fn                memoize.clj:  106
                                            clojure.core.cache/through/fn                  cache.clj:   55
                                         clojure.core.memoize/through*/fn                memoize.clj:  107
                                                       clojure.core/apply                   core.clj:  667
                                                                      ...                                 
                         clojure-lsp.feature.format/resolve-cljfmt-config                 format.clj:   36
                    clojure-lsp.feature.format/resolve-user-cljfmt-config                 format.clj:   32
                                                  clojure.edn/read-string                    edn.clj:   46
                                                                      ...                                 
java.lang.RuntimeException: No dispatch macro for: "

2023-01-26T18:00:29.225Z  INFO [clojure-lsp.handlers:410] - :code-actions 6ms
2023-01-26T18:00:42.822Z  INFO [clojure-lsp.handlers:410] - :code-actions 5ms
2023-01-26T18:01:25.796Z  INFO [clojure-lsp.handlers:410] - :code-actions 3ms

Felipe18:01:20

bizarre. I think emacs is failing to send the correct thing?

ericdallo18:01:50

we can confirm that enabling client-logs on lsp-mode or enabling trace on server side

ericdallo18:01:07

try running clojure-lsp --trace-level verbose

ericdallo18:01:16

then server log should print all client<->server communication

Felipe18:01:25

awesome!

Felipe18:01:00

logs still look the same, but I'm not sure if emacs opened a different clojure-lsp process

Felipe18:01:13

I ran felipecortez@izac clj-collage % clojure-lsp --trace-level verbose in the terminal and then did M-x lsp. is that ok?

ericdallo18:01:48

not really, emacs spawns a clojure-lsp process you should then change a variable

💡 2
ericdallo18:01:04

lsp-clojure-custom-server-command

Felipe18:01:31

2023-01-26T18:20:09.294Z  DEBUG [clojure-lsp.server:55] - [Trace - 2023-01-26T18:20:09.294Z] Received request 'textDocument/rangeFormatting - (304)'
Params: {
  "text-document" : {
    "uri" : "file:///Users/felipecortez/Dev/clj-collage/src/clj/collage/core.clj"
  },
  "options" : {
    "tab-size" : 2,
    "insert-spaces" : true
  },
  "range" : {
    "start" : {
      "line" : 2,
      "character" : 0
    },
    "end" : {
      "line" : 4,
      "character" : 0
    }
  }
}



2023-01-26T18:20:09.299Z  ERROR [clojure-lsp.server:55] - Error receiving message: Internal error (-32603)
{:id 304, :method "textDocument/rangeFormatting"}
com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine  PosixPlatformThreads.java:  203
            com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine       PlatformThreads.java:  775
                            java.util.concurrent.ForkJoinWorkerThread.run  ForkJoinWorkerThread.java:  183
                              java.util.concurrent.ForkJoinPool.runWorker          ForkJoinPool.java: 1594
                                   java.util.concurrent.ForkJoinPool.scan          ForkJoinPool.java: 1656
                 java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec          ForkJoinPool.java: 1020
                                 java.util.concurrent.ForkJoinTask.doExec          ForkJoinTask.java:  290
                  java.util.concurrent.CompletableFuture$AsyncSupply.exec     CompletableFuture.java: 1692
                   java.util.concurrent.CompletableFuture$AsyncSupply.run     CompletableFuture.java: 1700
                                         promesa.util.SupplierWrapper/get                  util.cljc:   21
                                            promesa.exec/wrap-bindings/fn                  exec.cljc:  147
                                                 clojure-lsp.server/fn/fn                 server.clj:  291
                                    clojure-lsp.handlers/range-formatting               handlers.clj:  401
                              clojure-lsp.feature.format/range-formatting                 format.clj:   54
                                                                      ...                                 
                                  clojure.core.memoize/cached-function/fn                memoize.clj:  231
                                                       clojure.core/deref                   core.clj: 2337
                                 clojure.core.memoize.RetryingDelay/deref                memoize.clj:   47
                                      clojure.core.memoize/through*/fn/fn                memoize.clj:  106
                                            clojure.core.cache/through/fn                  cache.clj:   55
                                         clojure.core.memoize/through*/fn                memoize.clj:  107
                                                       clojure.core/apply                   core.clj:  667
                                                                      ...                                 
                         clojure-lsp.feature.format/resolve-cljfmt-config                 format.clj:   36
                    clojure-lsp.feature.format/resolve-user-cljfmt-config                 format.clj:   32
                                                  clojure.edn/read-string                    edn.clj:   46
                                                                      ...                                 
java.lang.RuntimeException: No dispatch macro for: "

ericdallo18:01:14

that looks correct, does that happen on what clojure-lsp version? if latest, could you try previous version?

Felipe18:01:07

I think I got it now; I had a malformed .cljfmt.edn facepalm

ericdallo18:01:36

oh, makes sense 😅 the exception really mentions resolve-cljfmt-config

Felipe18:01:56

yeah, that was what gave me the idea

Felipe18:01:04

sorry about the confusion!

Felipe18:01:07

and thanks for the help 😄

ericdallo18:01:18

np, you're welcome!