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

Adjust openview #191907

Merged
merged 2 commits into from
Sep 7, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
markdownDeprecationMessage: nls.localize('comments.openPanel.deprecated', "This setting is deprecated in favor of `comments.openView`.")
},
'comments.openView': {
enum: ['never', 'file', 'firstFile'],
enumDescriptions: [nls.localize('comments.openView.never', "The comments view will never be opened."), nls.localize('comments.openView.file', "The comments view will open when a file with comments is active."), nls.localize('comments.openView.firstFile', "If the comments view has not been opened yet during this session it will open the first time during a session that a file with comments is active.")],
enum: ['never', 'file', 'firstFile', 'firstFileUnresolved'],
enumDescriptions: [nls.localize('comments.openView.never', "The comments view will never be opened."), nls.localize('comments.openView.file', "The comments view will open when a file with comments is active."), nls.localize('comments.openView.firstFile', "If the comments view has not been opened yet during this session it will open the first time during a session that a file with comments is active."), nls.localize('comments.openView.firstFileUnresolved', "If the comments view has not been opened yet during this session and the comment is not resolved, it will open the first time during a session that a file with comments is active.")],
default: 'firstFile',
description: nls.localize('comments.openView', "Controls when the comments view should open."),
restricted: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,10 @@ export class CommentController implements IEditorContribution {

private async openCommentsView(thread: languages.CommentThread) {
if (thread.comments && (thread.comments.length > 0)) {
if (this.configurationService.getValue<ICommentsConfiguration>(COMMENTS_SECTION).openView === 'file') {
const openViewState = this.configurationService.getValue<ICommentsConfiguration>(COMMENTS_SECTION).openView;
if (openViewState === 'file') {
return this.viewsService.openView(COMMENTS_VIEW_ID);
} else if (this.configurationService.getValue<ICommentsConfiguration>(COMMENTS_SECTION).openView === 'firstFile') {
} else if (openViewState === 'firstFile' || (openViewState === 'firstFileUnresolved' && thread.state === languages.CommentThreadState.Unresolved)) {
const hasShownView = this.viewsService.getViewWithId<CommentsPanel>(COMMENTS_VIEW_ID)?.hasRendered;
if (!hasShownView) {
return this.viewsService.openView(COMMENTS_VIEW_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

export interface ICommentsConfiguration {
openView: 'never' | 'file' | 'firstFile';
openView: 'never' | 'file' | 'firstFile' | 'firstFileUnresolved';
useRelativeTime: boolean;
visible: boolean;
maxHeight: boolean;
Expand Down