(fileUri: vscode.Uri)
| 116 | |
| 117 | // show the file's diff between current commit and next commit |
| 118 | const commandOpenFileNextRevision = async (fileUri: vscode.Uri) => { |
| 119 | const leftFileUri = await getConcreteFileUri(fileUri); |
| 120 | |
| 121 | const [repo, leftCommitSha] = leftFileUri.authority.split('+').filter(Boolean); |
| 122 | const repository = Repository.getInstance(fileUri.scheme, repo); |
| 123 | const rightCommit = await repository.getNextCommit(leftCommitSha, fileUri.path.slice(1)); |
| 124 | |
| 125 | if (!rightCommit) { |
| 126 | return vscode.window.showInformationMessage('There is no next commit found.'); |
| 127 | } |
| 128 | |
| 129 | const rightFileUri = leftFileUri.with({ authority: `${repo}+${rightCommit.sha}` }); |
| 130 | const hasNextRevision = !!(await repository.getNextCommit(rightCommit.sha, rightFileUri.path.slice(1))); |
| 131 | |
| 132 | const query = queryString.stringify({ |
| 133 | base: leftFileUri.with({ query: '' }).toString(), |
| 134 | head: rightFileUri.with({ query: '' }).toString(), |
| 135 | status: FileChangeStatus.Modified, |
| 136 | hasNextRevision, |
| 137 | }); |
| 138 | |
| 139 | return vscode.commands.executeCommand( |
| 140 | 'vscode.diff', |
| 141 | leftFileUri.with({ query }), |
| 142 | rightFileUri.with({ query }), |
| 143 | getChangedFileDiffTitle(leftFileUri, rightFileUri, FileChangeStatus.Modified), |
| 144 | ); |
| 145 | }; |
| 146 | |
| 147 | export const registerEditorCommands = (context: vscode.ExtensionContext) => { |
| 148 | return context.subscriptions.push( |
nothing calls this directly
no test coverage detected