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

monaco: update tokenization #11416

Merged
merged 1 commit into from
Jul 15, 2022
Merged

monaco: update tokenization #11416

merged 1 commit into from
Jul 15, 2022

Conversation

vince-fugnitto
Copy link
Member

What it does

The commit updates the monaco tokenization with the following improvements for performance:

  • skip tokenizations for lines exceeding the limit.
  • skip tokenizations which take too long to complete.

The fix ultimately resolves an issue which prevented large files from being opened and the application hanging.

How to test

  1. start the application using theia as a workspace
  2. confirm that tokenization works well for regular files
  3. open a large compressed js file (ex: ~/.vscode/extensions/eamodio.gitlens-12.1.2/dist/gitlens.js)
  4. confirm that the file opens, and does not hang the UI

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto [email protected]

@vince-fugnitto vince-fugnitto added the monaco issues related to monaco label Jul 13, 2022
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Opening and scrolling through a large, single line file is about as fast as in vscode without any noticeable regressions. It still hangs the UI (I tested it with the extension.js of the vscode.typescript-language-features extension) for 2-3 seconds, but it does the same in vscode, so I don't think there's anything we can improve on.

The commit updates the monaco tokenization with the following
improvements for performance:

- skip tokenizations for lines exceeding the limit.
- return partial tokenizations for line which take too long to tokenize.

The fix ultimately resolves an issue which prevented large files from
being opened and the application hanging.

Signed-off-by: vince-fugnitto <[email protected]>
@vince-fugnitto vince-fugnitto force-pushed the vf/tokenization-update branch from 5387999 to 5a272eb Compare July 13, 2022 16:56
@vince-fugnitto
Copy link
Member Author

vince-fugnitto commented Jul 13, 2022

I made a minor change following offline discussions with @colin-grant-work to return partial results (similarly to vscode) for work done before the time limit was reached.

Copy link
Contributor

@colin-grant-work colin-grant-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, and the UI is more responsive when opening large files with long lines. 👍

@vince-fugnitto vince-fugnitto merged commit 22f698b into master Jul 15, 2022
@vince-fugnitto vince-fugnitto deleted the vf/tokenization-update branch July 15, 2022 16:47
@github-actions github-actions bot added this to the 1.28.0 milestone Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
monaco issues related to monaco
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants