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

Don't perform full syntax update on edit #2318

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hbina
Copy link
Contributor

@hbina hbina commented Apr 4, 2023

Only perform a partial scan of the syntax and update the old one instead of replacing it entirely.
This will help a lot with editing large files.
There's an issue with this method however when dealing with syntax changes that are very big.
For example, commenting out a huge block of code will not trigger a syntax update for the block of code.
So there needs to be a better way to figure out which section of the code needs to be updated.

Alternative solutions:

  1. Walk the syntax tree itself.
  2. Perform the full update on a separate thread and send a command to update the syntax tree in the UI thread.

Similar optimization is also possible here https://github.com/lapce/lapce/blob/master/lapce-core/src/syntax/mod.rs#L280
The cursor will currently walk the entire syntax tree instead of only the relevant changes.

  • Added an entry to CHANGELOG.md if this change could be valuable to users

@hbina hbina force-pushed the hbina-optimize-syntax-update branch from b235c78 to b33bf76 Compare November 18, 2023 05:43
@hbina hbina force-pushed the hbina-optimize-syntax-update branch from b33bf76 to 86b97b0 Compare November 25, 2023 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant