Fork me on GitHub
#lsp
<
2022-03-09
>
anonimitoraf08:03:41

Anyone using corfu + LSP? Completions in this form ns/some-fn don't auto-complete the fn name

mpenet12:03:09

I am using both, works for me

mpenet12:03:50

your link points to cider, either you use cider or lsp for completion. Not both

anonimitoraf05:03:27

Hey @U050SC7SV, do your auto completions for ns/complete-this-fn-name ? Gif? Also my point was: maybe I can use cider's hacks for filtering the results/supporting the / separators for ns vs value

anonimitoraf06:03:27

Oh wow, mind linking your config again? I couldn't find it in my history

mpenet06:03:28

it's not visible on the gist, but the first candidates are all starting with str/s

mpenet06:03:03

you need to disable cider auto-completion if you want that to work

anonimitoraf08:03:26

(Not related to corfu) I've also noticed that core and 3rd party fns doc strings don't show up anymore. Is this just me?

lassemaatta08:03:35

I don't recall having this problem, works on my machine â„ąïž

anonimitoraf08:03:47

Which version of clojure-lsp are you using?

lassemaatta08:03:38

the latest nightly build 🙂

lassemaatta08:03:47

have you checked your lsp logs? perhaps the classpath scanning fails to find the 3rd party jars?

anonimitoraf08:03:27

Ah, weird, same: https://github.com/clojure-lsp/clojure-lsp/releases/tag/2022.02.23-12.12.12 Anything I can specifically look for, in the lsp logs?

lassemaatta08:03:13

Classpath found, paths: [ <here be a bunch of paths to jars> ]

lassemaatta08:03:07

it should list your local source paths (`"/home/user/project/src/clj/package"`) and libs (`"/home/user/.m2/repository/com/foo/bar/some-lib.jar"`)

anonimitoraf08:03:21

Hmm I don't see that log message 😕 (I searched for Classpath found)

anonimitoraf08:03:38

Weird, here's what mine looks like

2022-03-09T08:53:31.600Z  INFO [clojure-lsp.server:552] - Starting server...
2022-03-09T08:53:31.603Z  DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2022-03-09T08:53:31.607Z  INFO [clojure-lsp.server:341] - Initializing...
2022-03-09T08:53:31.621Z  INFO [clojure-lsp.db:?] - Reading transit analysis cache from db took 0.00 secs
2022-03-09T08:53:31.628Z  INFO [clojure-lsp.crawler:178] - Using cached db for project root /home/anonimito/work/audience-republic/server-4
2022-03-09T08:53:31.628Z  INFO [clojure-lsp.source-paths:214] - Using default source-paths: #{"src" "test"}
2022-03-09T08:53:31.628Z  INFO [clojure-lsp.crawler:210] - Analyzing source paths for project root /home/anonimito/work/audience-republic/server-4
2022-03-09T08:53:31.629Z  INFO [clojure-lsp.feature.clojuredocs:40] - Refreshing clojuredocs cache...
2022-03-09T08:53:33.756Z  INFO [clojure-lsp.feature.clojuredocs:?] - Refreshing clojuredocs cache took 2.13 secs.
2022-03-09T08:53:41.523Z  INFO [clojure-lsp.crawler:?] - Project only paths analyzed, took 9.89 secs
2022-03-09T08:53:42.450Z  INFO [clojure-lsp.crawler:215] - Analyzing test paths for project root /home/anonimito/work/audience-republic/server-4
2022-03-09T08:53:42.451Z  DEBUG [clojure-lsp.server:?] - :initialize 10843ms
2022-03-09T08:53:42.463Z  INFO [clojure-lsp.server:394] - Initialized!
2022-03-09T08:53:42.464Z  DEBUG [clojure-lsp.server:?] - :initialized 0ms
2022-03-09T08:53:42.543Z  DEBUG [clojure-lsp.server:?] - :didOpen 75ms
2022-03-09T08:53:42.559Z  INFO [clojure-lsp.server:?] - Refreshing testTree took 0.02 secs
2022-03-09T08:53:42.565Z  DEBUG [clojure-lsp.server:?] - :codeLens 20ms
2022-03-09T08:53:43.103Z  DEBUG [clojure-lsp.server:?] - :codeLens 544ms
2022-03-09T08:53:43.103Z  DEBUG [clojure-lsp.server:?] - :codeLens 559ms
2022-03-09T08:53:43.135Z  DEBUG [clojure-lsp.server:?] - :codeAction 590ms
2022-03-09T08:53:43.148Z  DEBUG [clojure-lsp.server:?] - :resolveCodeLens 20ms
2022-03-09T08:53:45.980Z  INFO [clojure-lsp.server:?] - Refreshing testTree took 3.53 secs

anonimitoraf08:03:39

Ok, I see that log message after I wiped the cache

2022-03-09T08:55:10.551Z  INFO [clojure-lsp.server:552] - Starting server...
2022-03-09T08:55:10.553Z  DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2022-03-09T08:55:10.557Z  INFO [clojure-lsp.server:341] - Initializing...
2022-03-09T08:55:10.570Z  ERROR [clojure-lsp.db:80] - No cache DB file found
2022-03-09T08:55:10.571Z  INFO [clojure-lsp.db:?] - Reading transit analysis cache from db took 0.00 secs
2022-03-09T08:55:10.581Z  INFO [clojure-lsp.classpath:53] - Finding classpath via `lein with-profile +test,+dev classpath`
2022-03-09T08:55:13.159Z  DEBUG [clojure-lsp.classpath:65] - Classpath found, paths:  ["/home/anonimito/work/audience-republic/server-4/.cpcache/6D1005E097D9EA5E33FBD0BCB6BDC880.jar"]
2022-03-09T08:55:13.160Z  INFO [clojure-lsp.source-paths:214] - Using default source-paths: #{"src" "test"}
but docstring still doesn't show up (I tried conj)

lassemaatta08:03:19

that's a leiningen project, right?

lassemaatta09:03:25

I'm no expert on lsp, but I would think that it should list more than just that 6D1005E097D9EA5E33FBD0BCB6BDC880.jar. On my project I get over 100 lines of jars, including my own sources.

lassemaatta09:03:59

are you using some exotic lein profile(s) to pull in your dependencies?

anonimitoraf09:03:01

Ah fair enough, @UKFSJSM38 any ideas why?

anonimitoraf09:03:20

Hmm, not too sure, I wasn't the one who set it up

anonimitoraf09:03:35

I might try with a non-lein project and see

lassemaatta09:03:18

in the log you can see how LSP tries to find out your classpath: lein with-profile +test,+dev classpath. You can call that from the command line and it should print what the lsp logs show.

lassemaatta09:03:40

but I would imagine it should list a lot of stuff

anonimitoraf09:03:40

Ok yea with a non-lein project it's fine

ericdallo11:03:56

Yeah, quite odd lein classpath is returning that

ericdallo11:03:00

Never saw that

ericdallo11:03:14

If you run manually on your project lein classpath you also get that?

anonimitoraf12:03:59

$ lein with-profile +test,+dev classpath
/home/anonimito/work/audience-republic/server-4/.cpcache/6D1005E097D9EA5E33FBD0BCB6BDC880.jar

lassemaatta12:03:03

can you share your project.clj? If I had to guess I'd say you project uses some additional profiles to pull-in your actual dependencies.

ericdallo13:03:47

yes, looks quite wrong that classpath

ericdallo13:03:59

seems like it's bringing the cache from deps.cli

anonimitoraf13:03:29

Unfortunately I can't, since it's a proprietary project 😞 Weirdly, it was working weeks/months back. What changed in terms of retrieving classpaths?

lassemaatta13:03:23

do you supply any special profiles when running the app or starting a repl? lein with-profile +foo +bar run

ericdallo13:03:44

try without the aliases, just lein classpath

ericdallo13:03:05

but we didn't change anything recently related to that, it's more a lein responsibility bringing the classpath

anonimitoraf21:03:17

I see, yea this is weird

$ lein classpath
/home/anonimito/work/audience-republic/server-4/.cpcache/95D2770C28E5B5B672E05FFA5B07A7A2.jar

anonimitoraf21:03:37

I opened up that JAR and found this Any way for LSP to make sense of this?

ericdallo21:03:50

I don't think so, AFAIK .cpcache it's a clojure folder, not related with lein, we need to understand why lein classpath is returning that for that project

anonimitoraf22:03:08

Yeah weird, I searched around in lein's repo and didn't really find relevant occurrences of cache

ericdallo22:03:45

Try removing that folder

anonimitoraf22:03:31

Yeah I've tried multiple times, it just recreates it

ericdallo22:03:50

Any chance your project is not only a lein one, but a deps.edn too?

anonimitoraf22:03:10

I don't have a deps.edn in the project, but I do have a ~/.clojure.deps.den - I'll try removing

anonimitoraf22:03:31

Didn't work. Any way to verify if a project is using some deps.edn?

ericdallo22:03:48

Maybe check what clojure -Spath return?

ericdallo22:03:05

But that doesn't make sense, lein is returning that, pretty crazy

anonimitoraf22:03:14

clojure -Spath
src:/home/anonimito/.m2/repository/org/clojure/clojure/1.10.3/clojure-1.10.3.jar:/home/anonimito/.m2/repository/org/clojure/core.specs.alpha/0.2.56/core.specs.alpha-0.2.56.jar:/home/anonimito/.m2/repository/org/clojure/spec.alpha/0.2.194/spec.alpha-0.2.194.jar

ericdallo22:03:22

Maybe ask on #clojure if anyone knows why that would happen

anonimitoraf22:03:27

Hmm, that's not complete at all

anonimitoraf22:03:30

Ok thanks, good idea

ericdallo22:03:38

Yes, so not a clojure project

👍 1
anonimitoraf08:03:59

but my own fns' docstrings do

Yuner Bekir10:03:48

Hello! Does someone know the reason why unused symbols are not colored differently? The same can be said for namespaces function and etc. To my knowledge clj-kondo should do handle this part and I have it installed as part of the calva extension.

pez11:03:40

This happens to me as well, now and then. I haven't seen a pattern other than that it is more common in my work project which is a quite huge monorepo. And it's not isolated to linting. I think it is the analysis as such.

ericdallo11:03:37

Not aware of any bug like this, sounds like calva not analyzing that file or something

pez11:03:17

You mean Calva not sending the file to clojure-lsp for analysis?

ericdallo11:03:40

Yes, we need to debug logs to understand

pez11:03:17

I'll enable to logging when this happens to me next time then.

ericdallo11:03:30

A sample repro would help too if you manage to know how to repro

pez11:03:07

I do. For some reason the images don't want to upload.

pez11:03:56

Hmmm, what did you refer to about the repro? I had just started talking about semantic tokens in ns forms, but now Slack tells me I couldn't send it...

pez11:03:20

In any case. Sent that as a separate message now. I can repro that one. This stuff with analysis sometimes not happening I have no clue how to repro. It's been happening for a while, but I can't see a pattern to it at all.

ericdallo12:03:27

For this one, check if didOpen was sent properly to server, and if clojure-lsp is returning diagnostics /semantic-tokens for that file

Yuner Bekir12:03:30

another thing I noticed is that if I decide to use a function or symbols which are not declared, no visual warning is displayed in any way. I have to eval the file/function and check the repl for errors

ericdallo13:03:03

it seems like LSP is not running for that file indeed, so no feature is being used

borkdude10:03:34

Maybe you have linting disabled?

pez11:03:11

@yuner.bekir mentions the ns form, btw. The semantic tokenizing of keywords doesn't happen there. But for other keywords it does. Want an issue?

👍 2
ericdallo11:03:56

Yeah, it seems clj-kondo doesn't return a keyword analysis for :require, is that on purpose somehow @U04V15CAJ?

borkdude12:03:29

I think it was on purpose, but we could change it if there's a good reason

ericdallo12:03:25

Without keyword analysis we can't know that keyword and not offer color and other features, so IMO we should consider it

borkdude12:03:05

ok, issue welcome

borkdude13:03:59

thanks! If anyone feels like a PR, please do, else I hope to get it in before next release

👍 1
pez13:03:30

I'd like to give it a shot, but am a bit tied up with trying to prevent more fire fighting in Calva land.

pez17:03:13

Now I've spent some time to try figure out how to make my failing test pass, but I fail. 😃 I probably won't find time to spend on this again, so don't hold off fixing it @U04V15CAJ.

apt15:03:19

Hi folks. When a function is redefined, shouldn’t its first definition get the unused font, rather than the first? As Clojure is evaluated from top to bottom, the last defintion ‘wins’. Example:

(defn foo
  [])

;; this gets the unused font
(defn foo
  [])

(defn bar []
  (foo))
(slack is having trouble to upload images)