Ver código fonte

Adds pinning commit when selecting file actions

main
Keith Daulton 2 anos atrás
pai
commit
7a3a63038c
3 arquivos alterados com 27 adições e 35 exclusões
  1. +22
    -1
      src/webviews/apps/commitDetails/commitDetails.scss
  2. +1
    -0
      src/webviews/apps/commitDetails/commitDetails.ts
  3. +4
    -34
      src/webviews/commitDetails/commitDetailsWebviewView.ts

+ 22
- 1
src/webviews/apps/commitDetails/commitDetails.scss Ver arquivo

@ -205,9 +205,30 @@ ul {
pointer-events: none;
}
&:focus {
outline: 1px solid var(--vscode-focusBorder);
outline-offset: -1px;
}
&:hover {
color: var(--vscode-foreground);
background-color: var(--color-background--lighten-15);
.vscode-dark & {
background-color: var(--color-background--lighten-15);
}
.vscode-light & {
background-color: var(--color-background--darken-15);
}
}
&.is-active {
.vscode-dark & {
color: white;
background-color: var(--color-background--lighten-05);
}
.vscode-light & {
color: black;
background-color: var(--color-background--darken-05);
}
}
}

+ 1
- 0
src/webviews/apps/commitDetails/commitDetails.ts Ver arquivo

@ -236,6 +236,7 @@ export class CommitDetailsApp extends App> {
const label = state.pinned ? 'Unpin this Commit' : 'Pin this Commit';
$el.setAttribute('aria-label', label);
$el.setAttribute('title', label);
$el.classList.toggle('is-active', state.pinned);
const $icon = $el.querySelector('[data-region="commit-pin"]');
$icon?.setAttribute('icon', state.pinned ? 'pinned' : 'pin');

+ 4
- 34
src/webviews/commitDetails/commitDetailsWebviewView.ts Ver arquivo

@ -606,12 +606,8 @@ export class CommitDetailsWebviewView extends WebviewViewBase
const file = await this.getFileFromParams(params);
if (file == null) return;
this.updatePinned(true, true);
void GitActions.Commit.showDetailsQuickPick(this._context.commit, file);
// const uri = GitUri.fromFile(file, this._context.commit.repoPath, this._context.commit.sha);
// void executeCommand(Commands.ShowQuickCommitFile, uri, {
// sha: this._context.commit.sha,
// });
}
private async openFileComparisonWithWorking(params: FileActionParams) {
@ -620,19 +616,12 @@ export class CommitDetailsWebviewView extends WebviewViewBase
const file = await this.getFileFromParams(params);
if (file == null) return;
this.updatePinned(true, true);
void GitActions.Commit.openChangesWithWorking(file.path, this._context.commit, {
preserveFocus: true,
preview: true,
...params.showOptions,
});
// const uri = GitUri.fromFile(file, this._context.commit.repoPath, this._context.commit.sha);
// void executeCommand<[Uri, DiffWithWorkingCommandArgs]>(Commands.DiffWithWorking, uri, {
// showOptions: {
// preserveFocus: true,
// preview: true,
// },
// });
}
private async openFileComparisonWithPrevious(params: FileActionParams) {
@ -641,23 +630,12 @@ export class CommitDetailsWebviewView extends WebviewViewBase
const file = await this.getFileFromParams(params);
if (file == null) return;
this.updatePinned(true, true);
void GitActions.Commit.openChanges(file.path, this._context.commit, {
preserveFocus: true,
preview: true,
...params.showOptions,
});
// const uri = GitUri.fromFile(file, this._context.commit.repoPath, this._context.commit.sha);
// const line = this._context.commit.lines.length ? this._context.commit.lines[0].line - 1 : 0;
// void executeCommand<[Uri, DiffWithPreviousCommandArgs]>(Commands.DiffWithPrevious, uri, {
// commit: this._context.commit,
// line: line,
// showOptions: {
// preserveFocus: true,
// preview: true,
// ...params.showOptions,
// },
// });
}
private async openFile(params: FileActionParams) {
@ -666,14 +644,12 @@ export class CommitDetailsWebviewView extends WebviewViewBase
const file = await this.getFileFromParams(params);
if (file == null) return;
this.updatePinned(true, true);
void GitActions.Commit.openFile(file.path, this._context.commit, {
preserveFocus: true,
preview: true,
...params.showOptions,
});
// const uri = GitUri.fromFile(file, this.commit.repoPath, this.commit.sha);
// void executeCoreCommand(CoreCommands.Open, uri, { background: false, preview: false });
}
private async openFileOnRemote(params: FileActionParams) {
@ -683,12 +659,6 @@ export class CommitDetailsWebviewView extends WebviewViewBase
if (file == null) return;
void GitActions.Commit.openFileOnRemote(file.path, this._context.commit);
// const uri = GitUri.fromFile(file, this.commit.repoPath, this.commit.sha);
// void executeCommand<[Uri, OpenFileOnRemoteCommandArgs]>(Commands.OpenFileOnRemote, uri, {
// sha: this.commit?.sha,
// });
}
}

Carregando…
Cancelar
Salvar