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

Debugger decorations are not working properly #1165

Closed
bpringe opened this issue May 1, 2021 · 3 comments
Closed

Debugger decorations are not working properly #1165

bpringe opened this issue May 1, 2021 · 3 comments
Labels
bug Something isn't working debugger ux User experience related

Comments

@bpringe
Copy link
Member

bpringe commented May 1, 2021

Debugger decorations were working fine before from what I know, after I spent some time on fixes and enhancements in the past. I noticed while working on another debugger feature that they are functioning oddly now. The only thing I know off hand that changed is the version of clojure-lsp, but since the code uses lsp to get references, and I doubt there's a mistake with lsp, I'll have to revisit the code 😞.

Hopefully I can find a more resilient solution.

Repro:

(ns hello)

(defn thing [x]
  (println x))

(comment
  (thing "foo"))
  1. Instrument thing
  2. Add a newline before the call to thing in the comment form, notice the decoration there disappears.
  3. Add letters to the call to thing or remove letters, i.e. things or thin and notice weird behavior with the decoration showing up when or where it shouldn't, or not showing up when it should

Seems likely to be a problem with the timing of the update/render.

@bpringe bpringe added bug Something isn't working ux User experience related debugger labels May 1, 2021
@bpringe
Copy link
Member Author

bpringe commented Jun 16, 2021

An idea came to me so I'll put it here, though I haven't investigated it yet. The issue could be because of a timing issue with when clojure-lsp updates its database of where references are located, and when we send a request to get the locations. We may be able to fix this by waiting a short time after a document update to send the request for reference locations.

It may also help to clear decorations right after a doc update, then render them again when we get the new locations. This way there won't be moments when (or they'll be hopefully too short to notice) the decorations are off between document update and re-render of decorations. I think a flicker off/on of the decorations is better than a moment of a buggy-looking rendering.

We may just need to increase the debounce time here:

@PEZ
Copy link
Collaborator

PEZ commented May 31, 2022

By chance I found the issue. It is nsPath() on the repl session that returns blank. So we don't get any document uri:

https://github.com/BetterThanTomorrow/calva/blob/dev/src/debugger/decorations.ts#L48

Changing to get the Uri from editor.document.uri works though. But seems there might have been a reason why this was not used to begin with. Do you recall, @bpringe?

@bpringe
Copy link
Member Author

bpringe commented Jun 1, 2022

I don't recall right now if there was a reason to use nsPath(), but I'm glad it seems to be fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working debugger ux User experience related
Projects
None yet
Development

No branches or pull requests

2 participants