(fileUri)
| 37 | }; |
| 38 | |
| 39 | const openFileToEditor = async (fileUri) => { |
| 40 | const isCurrentAuthority = fileUri.authority === (await router.getAuthority()); |
| 41 | |
| 42 | // In order to make the file explorer focus corresponding file when |
| 43 | // the `fileUri.authority` equals `current authority`, set the |
| 44 | // `fileUri.authority` to '' in this case |
| 45 | const targetFileUri = isCurrentAuthority ? fileUri.with({ authority: '' }) : fileUri; |
| 46 | |
| 47 | let editorLabel: string | undefined = undefined; |
| 48 | if (!isCurrentAuthority) { |
| 49 | // the authority here should be `{repo}+{commitSha}` |
| 50 | const [_repo, commitSha] = targetFileUri.authority.split('+'); |
| 51 | editorLabel = `${basename(targetFileUri.path)} (${commitSha.slice(0, 7)})`; |
| 52 | } |
| 53 | |
| 54 | return vscode.commands.executeCommand('vscode.open', targetFileUri, { preview: false }, editorLabel); |
| 55 | }; |
| 56 | |
| 57 | // open the left file in the diff editor title |
| 58 | const commandDiffViewOpenLeftFile = async (fileUri: vscode.Uri) => { |
no test coverage detected