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

Add command for expanding unresolved comments #180521

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,14 @@ export class CommentController implements IEditorContribution {
}
}

public expandUnresolved(): void {
for (const widget of this._commentWidgets) {
if (widget.commentThread.state === languages.CommentThreadState.Unresolved) {
widget.expand();
}
}
}

public nextCommentThread(): void {
this._findNearestCommentThread();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
when: WorkspaceHasCommenting
});

const EXPAND_UNRESOLVED_COMMENT_COMMAND = 'workbench.action.expandUnresolvedComments';
CommandsRegistry.registerCommand({
id: EXPAND_UNRESOLVED_COMMENT_COMMAND,
handler: (accessor) => {
return getActiveController(accessor)?.expandUnresolved();
}
});

MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: EXPAND_UNRESOLVED_COMMENT_COMMAND,
title: nls.localize('comments.expandUnresolved', "Expand Unresolved Comments"),
category: 'Comments'
},
when: WorkspaceHasCommenting
});

KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'workbench.action.submitComment',
weight: KeybindingWeight.EditorContrib,
Expand Down