mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 12:33:35 +01:00
Git - extract history item detail provider (#238041)
* Initial refactor of hover commands * Delete old code for hover commands * More refactoring
This commit is contained in:
@@ -12,7 +12,7 @@ import { Branch, LogOptions, Ref, RefType } from './api/git';
|
||||
import { emojify, ensureEmojis } from './emoji';
|
||||
import { Commit } from './git';
|
||||
import { OperationKind, OperationResult } from './operation';
|
||||
import { provideRemoteSourceLinks } from './remoteSource';
|
||||
import { ISourceControlHistoryItemDetailProviderRegistry, provideSourceControlHistoryItemMessageLinks } from './historyItemDetailProvider';
|
||||
|
||||
function toSourceControlHistoryItemRef(repository: Repository, ref: Ref): SourceControlHistoryItemRef {
|
||||
const rootUri = Uri.file(repository.root);
|
||||
@@ -97,7 +97,11 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
|
||||
|
||||
private disposables: Disposable[] = [];
|
||||
|
||||
constructor(protected readonly repository: Repository, private readonly logger: LogOutputChannel) {
|
||||
constructor(
|
||||
private historyItemDetailProviderRegistry: ISourceControlHistoryItemDetailProviderRegistry,
|
||||
private readonly repository: Repository,
|
||||
private readonly logger: LogOutputChannel
|
||||
) {
|
||||
const onDidRunWriteOperation = filterEvent(repository.onDidRunOperation, e => !e.operation.readOnly);
|
||||
this.disposables.push(onDidRunWriteOperation(this.onDidRunWriteOperation, this));
|
||||
|
||||
@@ -268,7 +272,8 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
|
||||
const historyItems: SourceControlHistoryItem[] = [];
|
||||
for (const commit of commits) {
|
||||
const message = emojify(commit.message);
|
||||
const messageWithLinks = await provideRemoteSourceLinks(this.repository, message) ?? message;
|
||||
const messageWithLinks = await provideSourceControlHistoryItemMessageLinks(
|
||||
this.historyItemDetailProviderRegistry, this.repository, message) ?? message;
|
||||
|
||||
const newLineIndex = message.indexOf('\n');
|
||||
const subject = newLineIndex !== -1
|
||||
|
||||
Reference in New Issue
Block a user