Fork me on GitHub
#lsp
<
2021-08-13
>
Noah Bogart13:08:53

i’ve noticed that test files aren’t scanned initially when determining if a given var is unused. Is that intentional?

ericdallo13:08:37

No, did you check if your test file is part of the source-paths?

Noah Bogart13:08:41

i used deps.edn: it’s in :extra-paths in my :test alias. should I move it up to :paths ?

ericdallo13:08:27

No, clojure-lsp should resolve that, can you double check the clojure-lsp server log?

ericdallo13:08:41

It should say: auto-resolved source paths xyz

Noah Bogart13:08:17

Automatically resolved source-paths from deps.edn: #{"src" "resources"}

Noah Bogart13:08:05

oh, my test alias is :test/cognitect. lemme try if it’s just :test

ericdallo13:08:27

Yeah, you can set source-aliases to fix that

Noah Bogart13:08:02

is :source-aliases a map or a set?

ericdallo13:08:44

LMK if you see anything to improve that on server side

ericdallo13:08:30

But I think there is no way we find :test/cognitect is your test alias automatically

👍 3
Noah Bogart13:08:54

i’m using coc.nvim, so the config is written in json. i’ve written the alias in an array: [":test/cognitect", ":test/kaocha"], and I can see that it’s sent in the initialize call from coc.nvim:

"initializationOptions": {
        "text-document-sync-kind": ":incremental",
        "use-metadata-for-privacy?": true,
        "ignore-classpath-directories": true,
        "source-aliases": [
            ":test/cognitect",
            ":test/kaocha"
        ]
    },

Noah Bogart13:08:23

but then it logs: Automatically resolved source-paths from deps.edn: #{"src" "resources"}

ericdallo13:08:50

I'd suggest not configure via initializationOptions, but via .lsp/config.edn

Noah Bogart13:08:06

do they work different?

ericdallo13:08:44

Not really, but since it's a json, I don't know it will behave the parsing on vim client

Noah Bogart13:08:17

maybe i can take a look at how clojure-lsp processes this

Noah Bogart13:08:20

thanks, i’ll try that out

ericdallo13:08:29

Alright, lmk if it works

ericdallo13:08:28

Ah, try removing the : inside the string

Noah Bogart13:08:27

which part inside the string? the : is already inside the alias string

ericdallo13:08:50

Try: "source-aliases": ["test/cognitect"]

Noah Bogart13:08:35

doesn’t work. putting the keywords into .lsp/config.edn works great tho

ericdallo13:08:23

Good to know, it's the first time I see initializationOptions not behaving similar to .lsp/config.edn

Noah Bogart14:08:57

i’ll get some tests written!

🚀 3
Noah Bogart17:08:06

i’ve updated the docs to make note of this as well