Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/github/conflictResolutionCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MergeOutputProvider implements vscode.FileSystemProvider {
clear(): void {
const fileEvents: vscode.FileChangeEvent[] = [];
for (const file of this._mergedFiles.keys()) {
fileEvents.push({ uri: vscode.Uri.from({ scheme: Schemes.MergeOutput, path: file }), type: vscode.FileChangeType.Changed });
fileEvents.push({ uri: vscode.Uri.from({ scheme: this._conflictResolutionModel.mergeScheme, path: file }), type: vscode.FileChangeType.Changed });
this.updateFile(file, buffer.Buffer.from(ORIGINAL_FILE));
}
this._onDidChangeFile.fire(fileEvents);
Expand Down Expand Up @@ -124,7 +124,7 @@ export class ConflictResolutionCoordinator {

private register(): void {
this._disposables.push(vscode.workspace.registerFileSystemProvider(Schemes.GithubPr, new GitHubContentProvider(this._githubRepositories), { isReadonly: true }));
this._disposables.push(vscode.workspace.registerFileSystemProvider(Schemes.MergeOutput, this._mergeOutputProvider));
this._disposables.push(vscode.workspace.registerFileSystemProvider(this._conflictResolutionModel.mergeScheme, this._mergeOutputProvider));
this._disposables.push(vscode.commands.registerCommand('pr.resolveConflict', (conflict: Conflict) => {
return this.openConflict(conflict);
}));
Expand Down Expand Up @@ -184,7 +184,7 @@ export class ConflictResolutionCoordinator {
const tabsToClose: vscode.Tab[] = [];
for (const group of vscode.window.tabGroups.all) {
for (const tab of group.tabs) {
if ((tab.input instanceof vscode.TabInputTextMerge) && (tab.input.result.scheme === Schemes.MergeOutput)) {
if ((tab.input instanceof vscode.TabInputTextMerge) && (tab.input.result.scheme === this._conflictResolutionModel.mergeScheme)) {
tabsToClose.push(tab);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/github/conflictResolutionModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { randomUUID } from 'crypto';
import * as vscode from 'vscode';
import { Schemes, toGitHubUri } from '../common/uri';

Expand All @@ -26,6 +27,7 @@ export class ConflictResolutionModel {
private readonly _resolvedConflicts: Map<string, ResolvedConflict> = new Map();
private readonly _onAddedResolution: vscode.EventEmitter<void> = new vscode.EventEmitter<void>();
public readonly onAddedResolution: vscode.Event<void> = this._onAddedResolution.event;
public readonly mergeScheme = `${Schemes.MergeOutput}-${randomUUID()}`;

constructor(public readonly startingConflicts: Conflict[], public readonly repositoryName: string, public readonly prBaseOwner: string,
public readonly latestPrBaseSha: string,
Expand Down Expand Up @@ -67,7 +69,7 @@ export class ConflictResolutionModel {
}

public mergeOutputUri(conflict: Conflict) {
return vscode.Uri.parse(`${Schemes.MergeOutput}:/${conflict.prHeadFilePath}`);
return vscode.Uri.parse(`${this.mergeScheme}:/${conflict.prHeadFilePath}`);
}

public mergeBaseUri(conflict: { prHeadFilePath: string }): vscode.Uri {
Expand Down