Open krainboltgreene opened 3 months ago
I've been able to replicate this, going to play around with this a bit and see if I can make this perform better.
This happens to me frequently as well. I have the format on save setting enabled and Lexical seems to be formatting the file and rebuilding the application for each saved file.
I wonder if it would make sense to have some kind of "debounce" to delay the application rebuild for a few milliseconds after saving a file. This way it would be triggered only after saving all the files instead of once for every file.
The build presently already has a debounce, but format doesn't. Things get a little tricky with debounces, because format requests expect a response within some amount of time, and they operate on an unsaved document. Thus, if you miss that window, there's no way that I know of to actually format the document.
@krainboltgreene @crbelaus can you check out the branch in #826, and see if that helps?
Will do.
Queuing this up for tonight, sorry was super busy yesterday.
I gave this a quick spot-check on main since #826 was merged, and it seems like this issue's resolved.
If someone may verify, I'll mark this issue as completed.
@krainboltgreene Can you verify?
It's very simple to test, I will do so in 14h when I start work again. (In case I fall off the earth the test is this: (1) turn on format-on-save in vscode, (2) turn on auto-save on unfocus, (3) search-and-replace for something small fooooooooooooooooooo
and replace it with something absurdly long fooooooooooooooooooo
, this will cause a multiline format, and if this change works you won't lose any code)
I did a search/replace in VSCode for "Core" to "Dashboard" across many files (200~) and VSCode hangs while letting Lexical format it. This also seems to result in future search/replace issues as a replace of
Core.AccountAuth
toDashboard.AccountAuth
turnsCore.AccountAuth, :ensure_authenticated
intoDashboard.AccountAuthure_authenticated
. While the below screenshot shows them being saved each "save" takes ~3s and actually finishes (it's not locked up). That said the file is already saved, regardless of what the indicator says.Metadata: