Fork me on GitHub
#lsp
<
2022-03-21
>
snoe01:03:24

I'm trying to figure out which way to fix a bug introduced here: https://github.com/clojure-lsp/clojure-lsp/pull/716/files#diff-c4f2705d9ea712285fa2f27dcfacf16733b610505fc7d60229ffd9896f5d5a23R278 introduce-let at the bottom of a file will wrap the whole file in a let binding. My idea is to only skip-whitespace z/up when we're not at edit/top? . The problem is that it breaks the from trailing comment test in introduce-let-test Is it ok if this test produced nil? If not, these tests are all pretty inconsistent as it stands, feels weird that a trailing comment is "part of" the previous form depending on if the cursor is touching it or if something comes after it. Any ideas?:

(h/code "(inc a)|" ";; comment")
(h/code "(inc a)" "|;; comment")
(h/code "(inc a)" "|;; comment" "")
(h/code "(inc a)" "|;; comment" "x")
cc @jacob.maine

jacob.maine04:03:51

@U0BUV7XSA it’s fine to return nil in that case. Those tests were all added when we changed the parser to return a comment or whitespace node if that’s what the cursor was on. There were lots of refactorings that threw errors if they were invoked on a comment at the end of a file, and the fix was usually to move to some valid node before continuing with the refactoring. I wasn’t always sure whether the exceptions had always been there or if they were from the parser change, but in any case, I fixed as many as I could find. It wasn’t too important to me what was returned in those locations, just that there weren’t any exceptions. So, those tests were added at that time to prevent regressions. There are other scenarios where I think it does make sense to move up before introducing a let, if you’re on whitespace or comment. There should be tests for those cases. But I agree, it obviously doesn’t make sense if you’re already at the top.

👍 1
timo09:03:55

Since lately (roundabout 3 weeks) I was not able anymore to use go to definition anymore when the definition is in a different namespace. lsp logs "No location found". I am using Neovim and was using latest release of clojure-lsp, today I tried with the latest build on CI. It was working and then stopped working after I updated nvim-plugins and clojure-lsp. Anyone has an idea where to search for the problem? Anyone ever seen this behaviour?

dharrigan09:03:17

Is the different namespace in a library or in your same project source?

timo10:03:16

same project source. but it does not jump to library as well

dharrigan10:03:15

Are you perchance using coc-clojure?

timo10:03:01

no, using nvim-lspconfig

timo10:03:00

it was leiningen-projects that had these problems. now trying a deps-project and it does not even send the event. :thinking_face:

dharrigan10:03:29

Ah, well, okay, not sure. I don't use nvm-lspconfig

dharrigan10:03:31

I'm using coc

timo10:03:39

I have the feeling that it is a classpath problem but not sure why. it works on one machine...same setup but this one it does not

timo10:03:15

so it seems just to be very slow in analyzing classpath. now 10 minutes in into a new project and it just logged 36 percent analyzed

timo10:03:35

maybe that's a thing....wait now it finished...

timo10:03:26

ok, it works fine in the deps-project but not in the leiningen-project... :thinking_face:

timo10:03:37

oh no...found it... leiningen was printing Warning: profile :profiles/dev not found. to stdout before printing the classpath facepalm

timo10:03:05

maybe it would be good to give a more concise message when the classpath can not be parsed?

timo11:03:42

seeing same problem in another repo though 😢 there the classpath is properly printed to stdout

ericdallo11:03:18

Clojure-lsp already prints to editor when classpath is not found properly

ericdallo11:03:29

What prints to you?

timo12:03:36

I saw it throwing when pedantic was a problem. can't see anything on the borked project

timo12:03:33

it does load the project it seems though

timo12:03:15

ok, will do that otherwise I'll open an issue

ericdallo22:03:09

Funny development shot 🧵

ericdallo22:03:32

Ops, I accidentally made clojure-lsp print as word art 😂

❤️ 1
😂 1
🆒 1
ericdallo22:03:52

Looks cooler, I think I'll keep this way 😛

Noah Bogart00:03:51

I love it. How did this happen?

ericdallo00:03:50

a wrong apply 😅

(defn my-print [msg]
  (apply println msg))

(my-print "foo")
f o o
=> nil

ericdallo00:03:27

since a string is still a coll of chars

ericdallo00:03:38

println receives multiple chars as separated args

Noah Bogart12:03:34

Oooh yeah haha nice