Просмотр исходного кода

Adds a refresh button to Commit Details

main
Eric Amodio 1 год назад
Родитель
Сommit
9f9b70263c
2 измененных файлов: 44 добавлений и 10 удалений
  1. +30
    -0
      package.json
  2. +14
    -10
      src/webviews/commitDetails/commitDetailsWebview.ts

+ 30
- 0
package.json Просмотреть файл

@ -6275,6 +6275,12 @@
"category": "GitLens"
},
{
"command": "gitlens.views.commitDetails.refresh",
"title": "Refresh",
"category": "GitLens",
"icon": "$(refresh)"
},
{
"command": "gitlens.views.commits.copy",
"title": "Copy",
"category": "GitLens"
@ -6480,6 +6486,12 @@
"category": "GitLens"
},
{
"command": "gitlens.views.graphDetails.refresh",
"title": "Refresh",
"category": "GitLens",
"icon": "$(refresh)"
},
{
"command": "gitlens.views.home.refresh",
"title": "Refresh",
"category": "GitLens",
@ -9070,6 +9082,10 @@
"when": "false"
},
{
"command": "gitlens.views.commitDetails.refresh",
"when": "false"
},
{
"command": "gitlens.views.commits.copy",
"when": "false"
},
@ -9218,6 +9234,10 @@
"when": "false"
},
{
"command": "gitlens.views.graphDetails.refresh",
"when": "false"
},
{
"command": "gitlens.views.home.refresh",
"when": "false"
},
@ -10585,6 +10605,11 @@
"group": "navigation@11"
},
{
"command": "gitlens.views.commitDetails.refresh",
"when": "view =~ /^gitlens\\.views\\.commitDetails/",
"group": "navigation@99"
},
{
"command": "gitlens.views.commits.setMyCommitsOnlyOff",
"when": "view =~ /^gitlens\\.views\\.commits/ && gitlens:views:commits:myCommitsOnly",
"group": "navigation@50"
@ -10780,6 +10805,11 @@
"group": "5_gitlens@0"
},
{
"command": "gitlens.views.graphDetails.refresh",
"when": "view =~ /^gitlens\\.views\\.graphDetails/",
"group": "navigation@99"
},
{
"command": "gitlens.views.home.refresh",
"when": "view =~ /^gitlens\\.views\\.home/",
"group": "navigation@99"

+ 14
- 10
src/webviews/commitDetails/commitDetailsWebview.ts Просмотреть файл

@ -27,7 +27,7 @@ import type { GitRevisionReference } from '../../git/models/reference';
import { createReference, getReferenceFromRevision, shortenRevision } from '../../git/models/reference';
import type { GitRemote } from '../../git/models/remote';
import type { ShowInCommitGraphCommandArgs } from '../../plus/webviews/graph/protocol';
import { executeCommand, executeCoreCommand } from '../../system/command';
import { executeCommand, executeCoreCommand, registerCommand } from '../../system/command';
import { configuration } from '../../system/configuration';
import { getContext } from '../../system/context';
import type { DateTimeFormat } from '../../system/date';
@ -197,6 +197,19 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
return true;
}
includeBootstrap(): Promise<Serialized<State>> {
this._bootstraping = true;
this._context = { ...this._context, ...this._pendingContext };
this._pendingContext = undefined;
return this.getState(this._context);
}
registerCommands(): Disposable[] {
return [registerCommand(`${this.host.id}.refresh`, () => this.host.refresh(true))];
}
private onCommitSelected(e: CommitSelectedEvent) {
if (
e.data == null ||
@ -214,15 +227,6 @@ export class CommitDetailsWebviewProvider implements WebviewProvider
}
}
includeBootstrap(): Promise<Serialized<State>> {
this._bootstraping = true;
this._context = { ...this._context, ...this._pendingContext };
this._pendingContext = undefined;
return this.getState(this._context);
}
onFocusChanged(focused: boolean): void {
if (this._focused === focused) return;

Загрузка…
Отмена
Сохранить