(changedFile: VSCodeChangedFile)
| 125 | }; |
| 126 | |
| 127 | export const getChangedFileDiffCommand = (changedFile: VSCodeChangedFile): vscode.Command => { |
| 128 | let baseFileUri = changedFile.baseFileUri; |
| 129 | let headFileUri = changedFile.headFileUri; |
| 130 | const status = changedFile.status; |
| 131 | |
| 132 | if (status === adapterTypes.FileChangeStatus.Added) { |
| 133 | baseFileUri = emptyFileUri; |
| 134 | } |
| 135 | |
| 136 | if (status === adapterTypes.FileChangeStatus.Removed) { |
| 137 | headFileUri = emptyFileUri; |
| 138 | } |
| 139 | |
| 140 | const title = getChangedFileDiffTitle(baseFileUri, headFileUri, status); |
| 141 | const query = queryString.stringify({ |
| 142 | status, |
| 143 | base: baseFileUri.with({ query: '' }).toString(), |
| 144 | head: headFileUri.with({ query: '' }).toString(), |
| 145 | }); |
| 146 | |
| 147 | return { |
| 148 | title: 'Diff', |
| 149 | command: 'vscode.diff', |
| 150 | arguments: [baseFileUri.with({ query }), headFileUri.with({ query }), title], |
| 151 | }; |
| 152 | }; |
no test coverage detected