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

make sure to sync views when applying edits to unfocused views #9173

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

gabydd
Copy link
Member

@gabydd gabydd commented Dec 26, 2023

this fixes bugs when applying workspace edits with lsp to a view where the most recent selection range is outside the current document or when adding a newline/formatting during write all in the same situation

fixes #9157 and fixes #6752

I decided to sync the view when getting the id instead of calling sync when applying the transaction. I am not sure if I put the utility function in the correct place, I did have to take the tree instead of the editor because rust was giving me error for passing the editor within the closure in write-all, which I wasnt able to figure out

(I think we might be able to use this function in reload-all as well, though it already properly handles this)

@gabydd
Copy link
Member Author

gabydd commented Dec 26, 2023

I can also confirm it fixes a bug similar to the one in the discussion but with renaming.where you open a document (a) then create a split and go to near the end of the file there, then change to a different document(b) that has a function you can rename that is referenced in file (a), then go to file (a) in the other split find the reference to the function you are going to rename and delete from the line after there to the end of the file, switch back to the other split with file (b) and rename the function, before this pr helix crashes there

helix-view/src/document.rs Outdated Show resolved Hide resolved
helix-view/src/document.rs Outdated Show resolved Hide resolved
this fixes bugs when applying workspace edits with lsp to a view
where the most recent selection range is outside the current document
or when adding a newline/formatting during write all in the same situation
@gabydd
Copy link
Member Author

gabydd commented Jan 7, 2024

I moved it to editor, needed to change some things to appease the borrow checker stuff

@pascalkuthe pascalkuthe added this to the next milestone Jan 7, 2024
@pascalkuthe pascalkuthe added C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer. labels Jan 7, 2024
@archseer archseer merged commit 84e24b3 into helix-editor:master Jan 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Position ... is out of range for changeset len ....!' panic on ~23.03 when saving a file
3 participants