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

Avoid using 'deltaDecorations' directly in setDecorationsByType #203902

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

roblourens
Copy link
Member

Fix #202374

@roblourens roblourens requested a review from hediet January 31, 2024 14:56
@vscodenpa vscodenpa added this to the February 2024 milestone Jan 31, 2024
@@ -1367,14 +1367,14 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE

// update all decorations
const oldDecorationsIds = this._decorationTypeKeysToIds[decorationTypeKey] || [];
this._decorationTypeKeysToIds[decorationTypeKey] = this.deltaDecorations(oldDecorationsIds, newModelDecorations);
this._decorationTypeKeysToIds[decorationTypeKey] = this.changeDecorations(accessor => accessor.deltaDecorations(oldDecorationsIds, newModelDecorations));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this._decorationTypeKeysToIds[decorationTypeKey] = this.changeDecorations(accessor => accessor.deltaDecorations(oldDecorationsIds, newModelDecorations));
this.changeDecorations(accessor => this._decorationTypeKeysToIds[decorationTypeKey] = accessor.deltaDecorations(oldDecorationsIds, newModelDecorations));

Copy link
Member

Choose a reason for hiding this comment

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

this stores the new decoration ids before recursion can happen

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right, thanks

@@ -1367,14 +1367,14 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE

// update all decorations
const oldDecorationsIds = this._decorationTypeKeysToIds[decorationTypeKey] || [];
this._decorationTypeKeysToIds[decorationTypeKey] = this.deltaDecorations(oldDecorationsIds, newModelDecorations);
this._decorationTypeKeysToIds[decorationTypeKey] = this.changeDecorations(accessor => accessor.deltaDecorations(oldDecorationsIds, newModelDecorations));
Copy link
Member

Choose a reason for hiding this comment

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

this stores the new decoration ids before recursion can happen

@roblourens roblourens enabled auto-merge (squash) February 1, 2024 18:18
@roblourens roblourens merged commit 4493cd7 into main Feb 1, 2024
6 checks passed
@roblourens roblourens deleted the roblou/isolated-swallow branch February 1, 2024 18:32
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when updating decorations after deleting chat variable
3 participants