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

In MonacoEditorModel, use value for snapshot #12418

Conversation

colin-grant-work
Copy link
Contributor

What it does

Fixes #12406 by changing the snapshotting logic in MonacoEditorModel

It turns out that the brand of ITextModel that we use in Monaco has this size restriction on its snapshots:

https://github.com/microsoft/vscode/blob/7bd1368261677fa160c28ff043c444d905331ee7/src/vs/editor/common/model/textModel.ts#L155-L157

That means that in general, we want to use the value rather than delegating to that implementation of createSnapshot.

How to test

  1. Create a large file (> 64kb)
  2. Use save as to create a copy of that file.
  3. Check that the new file has the same size and content as the original.
  4. Create a large untitled file.
  5. Use save (as) to save it.
  6. Ensure that the new file has the same size and content as its untitled source.

Review checklist

Reminder for reviewers

@colin-grant-work colin-grant-work added the monaco issues related to monaco label Apr 14, 2023
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

LGTM 👍
I confirmed that the size after performing a save as... is the same as the original.

@colin-grant-work colin-grant-work merged commit b1c9e43 into eclipse-theia:master Apr 14, 2023
@colin-grant-work colin-grant-work deleted the bugfix/save-as-truncation branch April 14, 2023 19:33
@colin-grant-work colin-grant-work added this to the 1.37.0 milestone Apr 14, 2023
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.

Save As has a 64Kib size limit
2 participants