diff --git a/src/vs/workbench/parts/comments/electron-browser/commentGlyphWidget.ts b/src/vs/workbench/parts/comments/electron-browser/commentGlyphWidget.ts index 59b96a65b483e3e74f699d377c4242076f6d966a..44d7a10810ed4c77b750a454b40e10736c0f569a 100644 --- a/src/vs/workbench/parts/comments/electron-browser/commentGlyphWidget.ts +++ b/src/vs/workbench/parts/comments/electron-browser/commentGlyphWidget.ts @@ -33,6 +33,10 @@ export class CommentGlyphWidget implements IContentWidget { return this._id; } + setLineNumber(lineNumber: number): void { + this._lineNumber = lineNumber; + } + getPosition(): IContentWidgetPosition { return { position: { diff --git a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts index 40f453a5e8b883c9a4e6e7887b3148bc65a75d4d..39933cc652afd45e37a7d1d80cb4bb2cbd7db62e 100644 --- a/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts +++ b/src/vs/workbench/parts/comments/electron-browser/commentThreadWidget.ts @@ -296,7 +296,12 @@ export class ReviewZoneWidget extends ZoneWidget { this._localToDispose.push(this.editor.onMouseDown(e => this.onEditorMouseDown(e))); this._localToDispose.push(this.editor.onMouseUp(e => this.onEditorMouseUp(e))); - + this._localToDispose.push(this.editor.onDidChangeModelContent(() => { + if (this._commentGlyph.getPosition().position.lineNumber !== this.position.lineNumber) { + this._commentGlyph.setLineNumber(this.position.lineNumber); + this.editor.layoutContentWidget(this._commentGlyph); + } + })); var headHeight = Math.ceil(this.editor.getConfiguration().lineHeight * 1.2); this._headElement.style.height = `${headHeight}px`; this._headElement.style.lineHeight = this._headElement.style.height; diff --git a/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts b/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts index 08383e72584893e3e91a5176105f8d1bdcad99c0..11985caeba4cd3aca35742617fb67a7017ea0ce3 100644 --- a/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts +++ b/src/vs/workbench/parts/comments/electron-browser/commentsEditorContribution.ts @@ -182,6 +182,12 @@ export class ReviewController implements IEditorContribution { this._commentWidgets = []; this.localToDispose.push(this.editor.onMouseMove(e => this.onEditorMouseMove(e))); + this.localToDispose.push(this.editor.onDidChangeModelContent(() => { + if (this._newCommentGlyph) { + this.editor.removeContentWidget(this._newCommentGlyph); + this._newCommentGlyph = null; + } + })); this.localToDispose.push(this.commentService.onDidUpdateCommentThreads(e => { const editorURI = this.editor && this.editor.getModel() && this.editor.getModel().uri; if (!editorURI) {