Skip to content

Commit

Permalink
active editor has commenting range is true even when it should not be (
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 authored Sep 22, 2023
1 parent 39b7442 commit 0e77475
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/vs/workbench/contrib/comments/browser/commentsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ export class CommentController implements IEditorContribution {
if (!this._hasRespondedToEditorChange) {
if (this._commentInfos.some(commentInfo => commentInfo.commentingRanges.ranges.length > 0 || commentInfo.commentingRanges.fileComments)) {
this._hasRespondedToEditorChange = true;
this._activeEditorHasCommentingRange.set(true);
const verbose = this.configurationService.getValue(AccessibilityVerbositySettingId.Comments);
if (verbose) {
const keybinding = this.keybindingService.lookupKeybinding(AccessibilityCommandId.OpenAccessibilityHelp)?.getAriaLabel();
Expand All @@ -863,8 +862,6 @@ export class CommentController implements IEditorContribution {
} else {
status(nls.localize('hasCommentRanges', "Editor has commenting ranges."));
}
} else {
this._activeEditorHasCommentingRange.set(false);
}
}
});
Expand Down Expand Up @@ -1129,7 +1126,12 @@ export class CommentController implements IEditorContribution {
// create viewzones
this.removeCommentWidgetsAndStoreCache();

let hasCommentingRanges = false;
this._commentInfos.forEach(info => {
if (!hasCommentingRanges && (info.commentingRanges.ranges.length > 0 || info.commentingRanges.fileComments)) {
hasCommentingRanges = true;
}

const providerCacheStore = this._pendingNewCommentCache[info.owner];
const providerEditsCacheStore = this._pendingEditsCache[info.owner];
info.threads = info.threads.filter(thread => !thread.isDisposed);
Expand Down Expand Up @@ -1157,6 +1159,12 @@ export class CommentController implements IEditorContribution {

this._commentingRangeDecorator.update(this.editor, this._commentInfos);
this._commentThreadRangeDecorator.update(this.editor, this._commentInfos);

if (hasCommentingRanges) {
this._activeEditorHasCommentingRange.set(true);
} else {
this._activeEditorHasCommentingRange.set(false);
}
}

public closeWidget(): void {
Expand Down

0 comments on commit 0e77475

Please sign in to comment.