-
Notifications
You must be signed in to change notification settings - Fork 324
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
Metadata should not depend on absolute text spans #11390
Metadata should not depend on absolute text spans #11390
Conversation
@@ -25,6 +25,7 @@ | |||
"debug": "^4.3.6", | |||
"fast-diff": "^1.3.0", | |||
"isomorphic-ws": "^5.0.0", | |||
"js-base64": "^3.7.7", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpm add js-base64
caused some disturbance in pnpm-lock.yaml
ide: { ...this.syncedMeta.ide, node: newMetadata }, | ||
ide: { | ||
...this.syncedMeta.ide, | ||
...newSnapshot, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saving an updated code snapshot here
contentsReceived, | ||
this.syncedCode ?? undefined, | ||
unsyncedIdMap, | ||
this.syncedMeta?.ide?.node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Providing the newCode
argument to save the updated code snapshot after the successful metadata recovery
@@ -483,6 +484,14 @@ class ModulePersistence extends ObservableV2<{ removed: () => void }> { | |||
} | |||
} | |||
|
|||
private static encodeCodeSnapshot(code: string): string { | |||
return Base64.encode(code) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could compress it with some fast (not necessarily super-efficient) widely-available algo, like gzip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a nodejs zlib module. But it will require adding zlib support for the GraalVM version. I'll implement it as a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed as #11420
The description of #11304 issue states following constraints. Were they all implemented by #11390? I am not sure:
OK, I see no changes to the UUID system in this PR.
OK, I see addition of the
OK, only the
OK, no Y.js dependency as far as I can see.
Is this tested somewhere?
I don't see any change making the META-DATA section a comment. I am not sure about the last two. @4e6 can you confirm these constrains were both met? |
Another goal of #11304 was:
I don't see any signs of versioning, @4e6. Given you already plan to change the format in there is a need to differentiate between the |
Pull Request Description
close #11304
Changelog:
ide.snapshot
optional metadata field containing the source code of the filesyncFileContents
method tries to repair the metadata spans when it detects that the source file was edited and the received code does not match the code stored in theide.snapshot
metadata fieldImportant Notes
Tested in gui
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.