Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files from outside "current project" adds to the problem count #1864

Closed
jacobemcken opened this issue Sep 15, 2022 · 12 comments
Closed

Files from outside "current project" adds to the problem count #1864

jacobemcken opened this issue Sep 15, 2022 · 12 comments

Comments

@jacobemcken
Copy link

I find the following behavior in Calva (lsp?) a bit annoying:

  1. Open your favorite project with fairly few "Problems"
  2. Open a file from outside your project to inspect some code
  3. See the "problem" count skyrocket 😅
  4. Close the file outside your project again

Expected behavior:
The "problem" count goes back down, when the file is closed.

Actual behavior:
The problems from the "external" file lingers and now drown my "real" problems.

Workaround:
Restart VS Code.

Also worth noting:
Clear Document Diagnostics doesn't seem to work on "outside files". I reopen the problematic outside file in the hope that I can "clear diagnostics" and then quickly close it again before the problems are picked up.

@PEZ
Copy link
Collaborator

PEZ commented Sep 15, 2022

Thanks for reporting!

Pinging @ericdallo. It might be something we need to tell clojure-lsp when that file closes.

As for workarounds. A slightly less dramatic (depending on your usage of VS Code) way is to only reload the current window. One way to do so is to use the command Developer: Reload Window. You can even make the REPL survive this by starting it yourself and use Calva Connect instead of Jack-in. VS Code terminals survive window reloads. (Sadly this doesn't go for the Jack-in terminal yet.)

Clear Document Diagnostics doesn't seem to work on "outside files".

TIL. I didn't know about this command. Have been needing it! Anyway, this indicates that it might be a VS Code problem. We'll see.

@ericdallo
Copy link
Contributor

I think it makes sense to count the errors while the file is opened but I agree that after receiving a didClose on server we should check if it's inside the project and update the diagnostics if not, please open a ticket on clojure-lsp

ericdallo added a commit to clojure-lsp/clojure-lsp that referenced this issue Sep 15, 2022
@ericdallo
Copy link
Contributor

Fixed on clojure-lsp master, please test the nightly build

@PEZ PEZ added the upstream label Sep 15, 2022
@jacobemcken
Copy link
Author

jacobemcken commented Sep 17, 2022

I might not understand something, but using a "nightly" does not seem to have fixed the problem.

lsp nightly configuration

  1. I open my project from the folder ~/Private/Projects/my-project/ in VS Code/Calva with an initial "Problem count" of 2.
  2. I open a file outside my project folder ~/Private/Projects/mongo-driver-3/src/mongo_driver_3/operator.clj (cloned from Mongo Driver 3)
  3. "Problem count" rise to 363.
  4. Upon closing the file, the "Problem count" fall to 176

error count before

error count after

Expectation: The "Problem count" would fall to 2 which it was initially.

@ericdallo
Copy link
Contributor

@PEZ is that related to Calva not downloading nightly properly?

@bpringe
Copy link
Member

bpringe commented Sep 20, 2022

@ericdallo It might be related. @jacobemcken A new version of Calva was released since your last comment that fixed an issue with the nightly build download. I would try it again and see if the problem persists.

@jacobemcken
Copy link
Author

jacobemcken commented Sep 21, 2022

Tried again this morning using Calva version [2.0.304] - 2022-09-20.

Same problem (as in: the problem count goes somewhat down, but only around half... see screenshots about for example)

@jacobemcken
Copy link
Author

jacobemcken commented Oct 2, 2022

@ericdallo do you want me to create an issue over at https://github.com/clojure-lsp/clojure-lsp ?

or is the bug somewhere else?... the nightly did reduce the number of warnings (see above screenshots).

@ericdallo
Copy link
Contributor

@jacobemcken is there any repro I can try? The fix I made should fix cases like that

@jacobemcken
Copy link
Author

Thanks for your patience @ericdallo
The bug is fixed.

The reason why only some linting warnings would disappear once I closed the external file, was because I also had the clj-kondo VS Code extension installed. I don't know how many months I've been running double linting checks 😱

Now that I've uninstalled that clj-kondo, I can verify that nightly fixes the issue for me.
🙏

@ericdallo
Copy link
Contributor

Good, I think that 's more common that you think.
Maybe we should present some warning when both are installed c/c @PEZ

@bpringe
Copy link
Member

bpringe commented Oct 4, 2022

It appears I thought it was a good idea to remove that warning in the past 😅: #1091. Sorry @jacobemcken! I think we should add that back...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants