瀏覽代碼

Fixes #2315, #2329 commit details preferences

- uses global storage instead of workspace storage
- fixes _pendingContext.preferences
- updates autolinksExpanded optimistically in UI
main
Keith Daulton 2 年之前
父節點
當前提交
40b6bc61a4
共有 4 個檔案被更改,包括 26 行新增16 行删除
  1. +2
    -0
      CHANGELOG.md
  2. +4
    -4
      src/storage.ts
  3. +5
    -0
      src/webviews/apps/commitDetails/commitDetails.ts
  4. +15
    -12
      src/webviews/commitDetails/commitDetailsWebviewView.ts

+ 2
- 0
CHANGELOG.md 查看文件

@ -37,6 +37,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes [#2292](https://github.com/gitkraken/vscode-gitlens/issues/2292) - Push button in BranchTrackingStatusNode of non-current branch does not trigger "Push force"
- Fixes [#1488](https://github.com/gitkraken/vscode-gitlens/issues/1488) - Open Folder History not working with non-English language pack
- Fixes [#2303](https://github.com/gitkraken/vscode-gitlens/issues/2303) - "Googlesource" gerrit only supports two levels of domain — thanks to [PR #2304](https://github.com/gitkraken/vscode-gitlens/pull/2304) by Matt Buckley ([@Mattadore](https://github.com/Mattadore))
- Fixes [#2315](https://github.com/gitkraken/vscode-gitlens/issues/2315) - Commit details secondary side bar banner doesn't stay dismissed
- Fixes [#2329](https://github.com/gitkraken/vscode-gitlens/issues/2329) - Remember UI settings in Commit Details panel
## [13.0.4] - 2002-11-03

+ 4
- 4
src/storage.ts 查看文件

@ -163,6 +163,10 @@ export interface GlobalStorage {
welcome: {
visible?: boolean;
};
commitDetails: {
autolinksExpanded?: boolean;
dismissed?: string[];
};
};
}
@ -198,10 +202,6 @@ export interface WorkspaceStorage {
keepResults?: boolean;
pinned?: StoredPinnedItems;
};
commitDetails: {
autolinksExpanded?: boolean;
dismissed?: string[];
};
};
pinned: {

+ 5
- 0
src/webviews/apps/commitDetails/commitDetails.ts 查看文件

@ -163,6 +163,11 @@ export class CommitDetailsApp extends App> {
}
private onExpandedChange(e: WebviewPaneExpandedChangeEventDetail) {
this.state.preferences = {
...this.state.preferences,
autolinksExpanded: e.expanded,
};
this.sendCommand(PreferencesCommandType, { autolinksExpanded: e.expanded });
}

+ 15
- 12
src/webviews/commitDetails/commitDetailsWebviewView.ts 查看文件

@ -150,9 +150,9 @@ export class CommitDetailsWebviewView extends WebviewViewBase
if (this._context.preferences == null) {
this.updatePendingContext({
preferences: {
autolinksExpanded: this.container.storage.getWorkspace('views:commitDetails:autolinksExpanded'),
autolinksExpanded: this.container.storage.get('views:commitDetails:autolinksExpanded'),
avatars: configuration.get('views.commitDetails.avatars'),
dismissed: this.container.storage.getWorkspace('views:commitDetails:dismissed'),
dismissed: this.container.storage.get('views:commitDetails:dismissed'),
files: configuration.get('views.commitDetails.files'),
},
});
@ -525,30 +525,33 @@ export class CommitDetailsWebviewView extends WebviewViewBase
return;
}
const changes: Preferences = {};
const changes: Preferences = {
...this._context.preferences,
...this._pendingContext?.preferences,
};
if (this._context.preferences?.autolinksExpanded !== preferences.autolinksExpanded) {
void this.container.storage.storeWorkspace(
'views:commitDetails:autolinksExpanded',
preferences.autolinksExpanded,
);
if (
preferences.autolinksExpanded != null &&
this._context.preferences?.autolinksExpanded !== preferences.autolinksExpanded
) {
void this.container.storage.store('views:commitDetails:autolinksExpanded', preferences.autolinksExpanded);
changes.autolinksExpanded = preferences.autolinksExpanded;
}
if (this._context.preferences?.avatars !== preferences.avatars) {
if (preferences.avatars != null && this._context.preferences?.avatars !== preferences.avatars) {
void configuration.updateEffective('views.commitDetails.avatars', preferences.avatars);
changes.avatars = preferences.avatars;
}
if (this._context.preferences?.dismissed !== preferences.dismissed) {
void this.container.storage.storeWorkspace('views:commitDetails:dismissed', preferences.dismissed);
if (preferences.dismissed != null && this._context.preferences?.dismissed !== preferences.dismissed) {
void this.container.storage.store('views:commitDetails:dismissed', preferences.dismissed);
changes.dismissed = preferences.dismissed;
}
if (this._context.preferences?.files !== preferences.files) {
if (preferences.files != null && this._context.preferences?.files !== preferences.files) {
if (this._context.preferences?.files?.compact !== preferences.files?.compact) {
void configuration.updateEffective('views.commitDetails.files.compact', preferences.files?.compact);
}

Loading…
取消
儲存