Skip to content

Optimize rehighlighting #4

Description

@johnzhou721

What is the problem or limitation you are having?

Even on very small text, rehighlighting is performed with a delay. This is expected:

Highlighting re-lexes the whole buffer after a short pause in typing. Files of a few thousand lines are fine on a desktop; very large files are slower on phones.

but can feel a bit sluggish when you're editing files.

Describe the solution you'd like

For small amounts of text, perhaps apply the re-lexing and highlighting directly; only do the current behavior of after a short pause in typing after the text is beyond a certain character limit.

This design is helpful because larger files are often edited the least in some code writing context, so at least for most things we can maintain the illusion of 'instant rehighlighting as you type.'

Describe alternatives you've considered

Status quo; this is sort of hackish because pygments fundamentally needs the whole file to be lexed rather than just a small part, so this is more in the "workarounds" territory.

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions