fix package-lock
This commit is contained in:
parent
7b03823424
commit
1e0ebc6863
File diff suppressed because it is too large
Load Diff
|
@ -18,12 +18,11 @@ export class GViewProvider implements vscode.WebviewViewProvider {
|
|||
) {
|
||||
webviewView.webview.options = { enableScripts: true };
|
||||
this._view = webviewView;
|
||||
console.log("resolveWebviewView:------------");
|
||||
webviewView.webview.html = this.generateHtml(webviewView);
|
||||
|
||||
// 添加事件监听器
|
||||
webviewView.webview.onDidReceiveMessage(
|
||||
(message) => {
|
||||
(message: { command: any; text: any; filePath: any; hash: any; }) => {
|
||||
switch (message.command) {
|
||||
case "filterCommits":
|
||||
const filterText = message.text;
|
||||
|
@ -32,9 +31,6 @@ export class GViewProvider implements vscode.WebviewViewProvider {
|
|||
case "openFile":
|
||||
const filePath = message.filePath;
|
||||
const commit = message.hash;
|
||||
// should open git change for file and commit
|
||||
// vscode.commands.executeCommand('git.showCommit',commit)
|
||||
// this.openFileInCommit(commit, filePath);
|
||||
this.openDiff(commit, filePath);
|
||||
return;
|
||||
}
|
||||
|
@ -52,19 +48,6 @@ private makeUri(repoPath:string, filePath:string, commit:string) {
|
|||
}
|
||||
return fUri.with({ scheme: 'git',path:fUri.path, query: JSON.stringify(params) });
|
||||
}
|
||||
private openFileInCommit(commitHash: any, filePath: any) {
|
||||
const workspaceFolder = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
||||
if(!workspaceFolder){
|
||||
throw new Error('Please open a workspace folder first');
|
||||
}
|
||||
const repoPath = workspaceFolder.replace(/\\/g, '/')
|
||||
.replace(/'/g, "'")
|
||||
.replace(/ /g, " ");
|
||||
const fileUri = vscode.Uri.parse(`git://${repoPath}?${commitHash}#${filePath}`);
|
||||
vscode.workspace.openTextDocument(fileUri).then(doc => {
|
||||
vscode.window.showTextDocument(doc);
|
||||
})
|
||||
}
|
||||
|
||||
private async openDiff(commitId: string, filePath: string) {
|
||||
const workspaceFolder = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
||||
|
@ -95,10 +78,6 @@ private async openDiff(commitId: string, filePath: string) {
|
|||
|
||||
const previousUri = this.makeUri(sanitizedWorkPath, sanitizedFilePath, encodedPrevCommit);
|
||||
|
||||
// 调试输出
|
||||
console.log('Current URI:', currentUri.toString());
|
||||
console.log('Previous URI:', previousUri.toString());
|
||||
|
||||
await vscode.commands.executeCommand(
|
||||
"vscode.diff",
|
||||
previousUri,
|
||||
|
|
Loading…
Reference in New Issue