Skip to content

Dirty-diff decorations lost when editor hidden #15426

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

Open
pisv opened this issue Apr 8, 2025 · 2 comments
Open

Dirty-diff decorations lost when editor hidden #15426

pisv opened this issue Apr 8, 2025 · 2 comments

Comments

@pisv
Copy link
Contributor

pisv commented Apr 8, 2025

Bug Description:

When an editor with dirty-diff decorations is hidden and shown again (e.g. when switching editor tabs), the dirty-diff decorations disappear.

Steps to Reproduce:

  1. Open a file with diff changes in a text editor. Verify that dirty-diff decorations are shown for the changes.

  2. Open another editor. Switch back to the first. Note that there are no dirty-diff decorations now.

Additional Information

The issue is present on the current master. It looks like a regression from #14909. I have checked that the issue is present in 72ca8ed, while the parent commit does not have this issue.

@pisv
Copy link
Contributor Author

pisv commented Apr 11, 2025

Turns out that setting the editor's model to null removes all decorations owned by the editor. The call stack is

TextModel.removeAllDecorationsWithOwnerId (/eclipse-theia/node_modules/@theia/monaco-editor-core/src/vs/editor/common/model/textModel.ts:1697)
StandaloneEditor._postDetachModelCleanup (/eclipse-theia/node_modules/@theia/monaco-editor-core/src/vs/editor/browser/widget/codeEditor/codeEditorWidget.ts:1885)
StandaloneEditor._postDetachModelCleanup (/eclipse-theia/node_modules/@theia/monaco-editor-core/src/vs/editor/standalone/browser/standaloneCodeEditor.ts:484)
StandaloneEditor.setModel (/eclipse-theia/node_modules/@theia/monaco-editor-core/src/vs/editor/browser/widget/codeEditor/codeEditorWidget.ts:510)
MonacoEditor.handleVisibilityChanged (/eclipse-theia/packages/monaco/src/browser/monaco-editor.ts:273)
EditorPreviewWidget.handleVisiblityChanged (/eclipse-theia/packages/editor/src/browser/editor-widget.ts:64)

@pisv
Copy link
Contributor Author

pisv commented Apr 11, 2025

The issue is even worse, since an open dirty-diff peek view is also severely affected by just switching editor tabs:

  1. Open a file with diff changes in a text editor. Open a dirty-diff peek view for a change. Everything is fine so far:
Image
  1. Open another editor. Switch back to the first. Now it looks completely broken. The peek view is no longer seamlessly integrated with the main text editor content but just overlays it:
Image

...and doesn't scroll with it:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant