Skip to content

Commit fe157bc

Browse files
authored
New comment from "Create Pull Request Suggestion" should probably be expanded by default (#6185)
Fixes #6170
1 parent a501657 commit fe157bc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/github/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ export const COMMENT_EXPAND_STATE_SETTING = 'commentExpandState';
133133
export const COMMENT_EXPAND_STATE_COLLAPSE_VALUE = 'collapseAll';
134134
export const COMMENT_EXPAND_STATE_EXPAND_VALUE = 'expandUnresolved';
135135
export function getCommentCollapsibleState(thread: IReviewThread, expand?: boolean, currentUser?: string) {
136-
if (thread.isResolved
137-
|| (!thread.isOutdated && currentUser && (thread.comments[thread.comments.length - 1].user?.login === currentUser))) {
136+
const isFromCurrent = (currentUser && (thread.comments[thread.comments.length - 1].user?.login === currentUser));
137+
const isJustSuggestion = thread.comments.length === 1 && thread.comments[0].body.startsWith('```suggestion') && thread.comments[0].body.endsWith('```');
138+
if (thread.isResolved || (!thread.isOutdated && isFromCurrent && !isJustSuggestion)) {
138139
return vscode.CommentThreadCollapsibleState.Collapsed;
139140
}
140141
if (expand === undefined) {

0 commit comments

Comments
 (0)