This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-01
Channels
- # babashka (2)
- # beginners (45)
- # calva (2)
- # cider (20)
- # clj-kondo (9)
- # cljsrn (1)
- # clojure (25)
- # clojure-europe (7)
- # clojure-nl (24)
- # clojure-spec (4)
- # clojure-uk (3)
- # clojurescript (16)
- # datahike (6)
- # datalevin (6)
- # emacs (35)
- # fulcro (3)
- # holy-lambda (1)
- # lsp (55)
- # nrepl (2)
- # off-topic (17)
- # spacemacs (11)
- # specter (1)
- # xtdb (3)
How to let lsp understand the babashaka related files, for example, as in this project: https://github.com/juxt/site/blob/master/bin/site/#L1. This file does not support functionalties such as jump to definition.
@UGC0NEP4Y it's required to have a bb.edn at project root pointing to the project paths so LSP can run bb print-deps
2022-01-01T14:17:09.941Z INFO [clojure-lsp.server:450] - Starting server...
2022-01-01T14:17:10.036Z DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2022-01-01T14:17:10.084Z INFO [clojure-lsp.server:319] - Initializing...
2022-01-01T14:17:10.181Z INFO [clojure-lsp.source-paths:190] - Using given source-paths: #{"src" "dev" "test"}
2022-01-01T14:17:10.224Z INFO [clojure-lsp.source-paths:190] - Using given source-paths: #{"src" "dev" "test"}
2022-01-01T14:17:11.404Z INFO [clojure-lsp.db:?] - Reading analysis cache from Datalevin db took 1.19 secs
2022-01-01T14:17:11.410Z INFO [clojure-lsp.crawler:140] - Using cached classpath for project root /Users/matthew/Drive/dev/samples/site
2022-01-01T14:17:11.412Z INFO [clojure-lsp.crawler:227] - Analyzing source paths for project root /Users/matthew/Drive/dev/samples/site
2022-01-01T14:17:11.414Z INFO [clojure-lsp.source-paths:190] - Using given source-paths: #{"src" "dev" "test"}
2022-01-01T14:17:11.416Z INFO [clojure-lsp.feature.clojuredocs:40] - Refreshing clojuredocs cache...
2022-01-01T14:17:12.350Z INFO [clojure-lsp.crawler:?] - Project only paths analyzed, took 0.94 secs
2022-01-01T14:17:12.369Z DEBUG [clojure-lsp.server:?] - :initialize 2285ms
2022-01-01T14:17:12.381Z INFO [clojure-lsp.server:371] - Initialized!
2022-01-01T14:17:12.383Z DEBUG [clojure-lsp.server:?] - :initialized 1ms
2022-01-01T14:17:12.383Z WARN [clojure-lsp.server:267] - {}
2022-01-01T14:17:12.416Z INFO [clojure-lsp.source-paths:190] - Using given source-paths: #{"src" "dev" "test"}
2022-01-01T14:17:12.419Z DEBUG [clojure-lsp.server:?] - :didOpen 33ms
2022-01-01T14:17:12.422Z INFO [clojure-lsp.producer:?] - :testTree 0.00 secs
2022-01-01T14:17:12.446Z DEBUG [clojure-lsp.server:?] - :documentSymbol 10ms
2022-01-01T14:17:12.492Z DEBUG [clojure-lsp.server:?] - :semanticTokensRange 3ms
2022-01-01T14:17:12.689Z DEBUG [clojure-lsp.server:?] - :semanticTokensFull 1ms
2022-01-01T14:17:12.822Z INFO [clojure-lsp.kondo:?] - Linting whole project files took 0.48 secs
2022-01-01T14:17:21.844Z INFO [clojure-lsp.source-paths:190] - Using given source-paths: #{"src" "dev" "test"}
2022-01-01T14:17:21.849Z DEBUG [clojure-lsp.server:?] - :didOpen 5ms
2022-01-01T14:17:21.849Z INFO [clojure-lsp.producer:?] - :testTree 0.00 secs
2022-01-01T14:17:21.852Z DEBUG [clojure-lsp.server:?] - :semanticTokensFull 0ms
2022-01-01T14:17:21.852Z DEBUG [clojure-lsp.server:?] - :documentSymbol 0ms
2022-01-01T14:17:21.904Z DEBUG [clojure-lsp.server:?] - :codeAction 52ms
2022-01-01T14:17:21.948Z DEBUG [clojure-lsp.server:?] - :documentSymbol 0ms
2022-01-01T14:18:46.403Z INFO [clojure-lsp.source-paths:190] - Using given source-paths: #{"src" "dev" "test"}
Try this:
• rm .lsp/.cache
• make sure the bb.edn file exists with that :path and you have updated babashka version
• Reload vscode window
• Get the logs
That's the issue, BTW next clojjre-lsp version will print the reason on this popup, meanwhile you can check logs like you were checking
Looks good now: https://bpa.st/EOGQ#1L10
Does Calva can either understand deps.edn or bb.end at a single time? So I somehow have to disable the deps.edn part and tell lsp to switch to the bb.edn part?
Almost sure it's a calva issue now, of finding definition of a external deps, I'll try to repro on emacs here first, one sec

maybe this is relevant somehow? https://github.com/juxt/site/blob/master/bin/site#L2
the file needs to be a clojure one 😅 like bin/site.clj
or bin/site.cljc
or bin/site.cljs
, in this case only bin/site.clj
makes sense
otherwise calva will not recognize this as a clojure file and not activate lsp on that one
Maybe I can tell VSCode to treat it differently.
It should be something related with Calva.
my suggestion is to rename it, clojure-lsp for some features check the file type as well alongside with other tools
even fixing it on clojure-lsp/calva for example, the basic modes would't behave like it behaves for .clj files
you can see how bb also use .clj files for script examples: https://book.babashka.org/#_explicit_requires
Yup. I understand the shebang line part. > you can check how vscode/emacs basic funcionality doesn’t work for non .clj files Thinking on this, for emacs, major-mode file local variable should be fine. Dunno VSC.
yeah, the major-mode file local variable fix that indeed, but calva is probably not activating LSP on that file
Indeed the activation should depend on the interpreted file type instead of the extension extracted from the file name.
not sure all the places we would need to fix, for sure there is somethign on lsp side about guessing the file type from the extension which is not reliable for those cases
I know this is how calva sets the LSP: https://github.com/BetterThanTomorrow/calva/blob/published/src/lsp/main.ts#L29-L30