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

Bug: backspace (structural editing) occasionally "hangs" #2299

Closed
seancorfield opened this issue Aug 25, 2023 · 29 comments
Closed

Bug: backspace (structural editing) occasionally "hangs" #2299

seancorfield opened this issue Aug 25, 2023 · 29 comments
Labels
bug Something isn't working editing paredit Paredit and structural editing

Comments

@seancorfield
Copy link
Contributor

I'm editing code and start typing a symbol or I'm typing into a string, realize I've mistyped and try to backspace but nothing happens -- I can type more characters but cannot backspace -- and then after a brief period my backspaces suddenly take effect at wherever the cursor happens to be at that point.

It's very odd. I can click elsewhere in the file. I can move the cursor with the arrow keys. Typing anything except backspace seems to work fine. And then those "missing" backspaces get actioned at the (new) cursor position.

It's a fairly recent phenomenon and it happens randomly between a few and maybe half a dozen times a day.

@PEZ PEZ added bug Something isn't working paredit Paredit and structural editing editing labels Aug 25, 2023
@PEZ
Copy link
Collaborator

PEZ commented Aug 25, 2023

Thanks for reporting! When it happens, does the problem go away without reload of the VS Code window?

@seancorfield
Copy link
Contributor Author

The backspaces happen -- just a few seconds later than when they were typed -- and then it's fine and responsive for a while... until it randomly happens again later in the day.

@PEZ
Copy link
Collaborator

PEZ commented Aug 25, 2023

I saw something similar happen today, but only once and I didn't have the patience to wait it out so I reloaded the VS Code window.

Since it happens so frequently for you, @seancorfield, could you consider running with a month-old or so version of Calva and maybe that can help us understand if it seems to be newly introduced by a change in Calva?

@seancorfield
Copy link
Contributor Author

I'm on vacation next week (working on OSS stuff) so if it happens with sufficient frequency while I'm doing that, I'll work my way back through Calva versions and see if I can determine a "stable" version. Because it's intermittent, it's hard to know whether a given version "works" or not but I'll see what I can do.

@eliascotto
Copy link

I'm having the same issue. Pressing backspace totally freezes the environment. I restarted the clojure-lsp server and it seems fixing it for a bit but it'll happen again after a couple of minutes.

@mkreis
Copy link

mkreis commented Aug 29, 2023

I have the suspicion that there is a relation to having lots of output to the terminal or REPL. When clearing the terminal and REPL frequently, the issue seems to occur much less often. Not sure if that makes sense...

@PEZ
Copy link
Collaborator

PEZ commented Aug 29, 2023

@eliascotto I somehow doubt that clojure-lsp is involved in the problem. I could be wrong, but you can try holding off a bit with restarting clojure-lsp and see if the issue fixes itself for a while. If it doesn't, and you can fix it by restarting clojure-lsp, then we should be considering that as a factor. Please let us know how you fare!

@mkreis It does make sense, and could be a factor. Are you experiencing it outside REPL window? I think there might be structural editor code that runs on the output window content even when it is not being edited. I might have that wrong though.

@mkreis
Copy link

mkreis commented Aug 29, 2023

@PEZ yes, mainly the editor is affected. Also I tried to restart clojure-lsp, but nothing happens, only "Activating extensions..." is shown in the footer
grafik

@mkreis
Copy link

mkreis commented Aug 29, 2023

@PEZ I have another observation which occurs during all those instances as well: I was editing code and caused unbalanced brackets due to deletion (select and delete). This cause some bright yellow brackets (I guess that is the highlighting for unmatched) and the backspace key did not work.

@PEZ
Copy link
Collaborator

PEZ commented Aug 29, 2023

Thanks, @mkreis. That could be what's going on. That we have changed something making the structural editor lock up on unbalance. (Or that something has changed under our feet causing this, but let's be optimists for now.)

@seancorfield
Copy link
Contributor Author

@mkreis I see this with well-formed code so I don't think that is the issue (it may be worse with ill-formed code but I can't say I've noticed). I see it in projects with very small Calva output windows too (my current project has only 110 lines in the output window -- again, it may be worse in projects with much larger output windows but I can't say I've noticed).

@PEZ I haven't had a chance to run older versions of Calva to test against yet this week -- I've mostly been editing documentation -- sorry.

@PEZ
Copy link
Collaborator

PEZ commented Aug 29, 2023

I haven't had a chance to run older versions of Calva to test against yet this week -- I've mostly been editing documentation -- sorry

No worries!

Anyone and everyone that can reproduce the problem: Please consider testing some older version of Calva to help see if the problem might have been introduced lately.

@eliascotto
Copy link

Today it blocked for ~1min until I restarted the clojure-lsp and it unblocked the backspace
I got this error, not sure if it's related

[Error - 15:02:25] Request textDocument/documentSymbol failed.
  Message: Timed out waiting for analysis.
  Code: -32803 
[Error - 15:02:25] Request textDocument/documentSymbol failed.
  Message: Timed out waiting for analysis.
  Code: -32803 
[Error - 15:02:25] Request textDocument/semanticTokens/full failed.
  Message: Timed out waiting for analysis.
  Code: -32803 
[Error - 15:02:25] Request textDocument/documentSymbol failed.
  Message: Timed out waiting for analysis.
  Code: -32803 
[Error - 15:02:25] Request textDocument/documentSymbol failed.
  Message: Timed out waiting for analysis.
  Code: -32803 
[Error - 15:02:25] Request textDocument/documentSymbol failed.
  Message: Timed out waiting for analysis.
  Code: -32803 

This bug is a bit annoying since if I keep pressing the backspace again, and move the cursor, it mess up the code when it finally execute the keyboard action.

@PEZ
Copy link
Collaborator

PEZ commented Aug 30, 2023

Thanks, @eliascotto ! Maybe it is something todo with clojure-lsp after all... Even if I can't quite imagine how that could cause these symptoms... Maybe you can try with an older version of clojure-lsp and see if that changes anything. I don't think we had this issue a month ago.

@mkreis
Copy link

mkreis commented Aug 31, 2023

I could reproduce the issue with Calva version 2.0.386. Will now switch to 2.0.385.

@mkreis
Copy link

mkreis commented Sep 1, 2023

Also reproducible with 2.0.385, will switch to 2.0.384 now.

@PEZ
Copy link
Collaborator

PEZ commented Sep 1, 2023

It could be that we should be testing with different versions of clojure-lsp. That's decoupled from Calva versions.

@mkreis
Copy link

mkreis commented Sep 1, 2023

Okay. It's also reproducible with 2.0.384. I'll switch to latest of Calva now and use older clojure-lsp versions.

@eliascotto
Copy link

eliascotto commented Sep 4, 2023

Reproducible with 2.0.374. It seems happening less rarely than the newest versions

@mkreis
Copy link

mkreis commented Sep 5, 2023

...and reproducible with settings.json setting "calva.clojureLspVersion": "2023.07.01-22.35.41"

@mkreis
Copy link

mkreis commented Sep 11, 2023

Reproducible with clojure-lsp 2023.05.04-19.38.01 (and Calva v2.0.388)

@eliascotto
Copy link

Happening on 2.0.370

@PEZ
Copy link
Collaborator

PEZ commented Sep 15, 2023

Can someone who can reproduce this, run Calva with clojure-lsp disabled for a while?

Also, what extensions are you people using?

@PEZ
Copy link
Collaborator

PEZ commented Sep 15, 2023

The quickest way I know of to produce a list of the enabled extensions is to:

  1. List all installed extensions into a VS Code editor: code --list-extensions --show-versions | code -
  2. Search for @disabled in the Extensions pane in VS Code
  3. Manually remove the disabled extensions from the list

NB: For 1. remember to replace code (in both places) for whatever stream you are using. In my case it's often code-insiders.

@eliascotto
Copy link

Happens with 2.0.360. So I suspect is something related to clojure-lsp, since is not only the backspace that hangs but also the tab key formatting. I may try to not use latest for clojure-lsp but going back to some older versions.

My extensions list

ahmadawais.shades-of-purple@7.2.0
alekangelov.alek-kai-theme@0.4.0
BeeverFeever.kanagawa-vscode@0.0.2
betterthantomorrow.calva@2.0.360
Catppuccin.catppuccin-vsc@3.3.0
eamodio.gitlens@14.3.0
esbenp.prettier-vscode@10.1.0
eseom.nunjucks-template@0.5.1
jdinhlife.gruvbox@1.8.0
mattn.Lisp@0.1.12
ms-vscode.cmake-tools@1.15.31
ms-vscode.cpptools@1.17.5
ms-vscode.cpptools-extension-pack@1.3.0
ms-vscode.cpptools-themes@2.0.0
qingpeng.common-lisp@1.2.4
qwtel.sqlite-viewer@0.3.13
rocketseat.theme-omni@1.0.12
ssmi.after-dark@1.6.4
twxs.cmake@0.0.17
Vue.volar@1.8.11

@PEZ
Copy link
Collaborator

PEZ commented Sep 20, 2023

since is not only the backspace that hangs but also the tab key formatting

The structural editor is involved in both backspace and tab key formatting, so I don't think this points in the direction of clojure-lsp (which is involved in neither, afaik).

@PEZ
Copy link
Collaborator

PEZ commented Oct 20, 2023

I'm not sure how related, but here is a gist with what could be a reproduction freezing Calva: https://gist.github.com/ingydotnet/5b97cc4e503d705633e9c59c05d7154d

Any help with testing and refining the repro is highly appreciated! 🙏 ❤️

@PEZ
Copy link
Collaborator

PEZ commented Oct 21, 2023

OK. So here's a build of Calva with potential for fixing this:

Please give it a spin!

  1. Download
  2. Make sure it has the extension .vsix
  3. From the VS Code Extensions pane, select Install from VSIX…

@PEZ PEZ mentioned this issue Oct 22, 2023
13 tasks
@PEZ
Copy link
Collaborator

PEZ commented Oct 23, 2023

Hi there everyone! I am hoping that the latest release, v2.0.392, fixes this. Please let me know if you agree or if the issue is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working editing paredit Paredit and structural editing
Projects
None yet
Development

No branches or pull requests

4 participants