(token: vscode.CancellationToken)
| 480 | } |
| 481 | |
| 482 | const switchHeaderSource: (token: vscode.CancellationToken) => Promise<void> = async (token: vscode.CancellationToken) => { |
| 483 | try { |
| 484 | let targetFileName: string = await clients.ActiveClient.requestSwitchHeaderSource(rootUri, fileName, token); |
| 485 | if (!targetFileName) { |
| 486 | return; |
| 487 | } |
| 488 | // If the targetFileName has a path that is a symlink target of a workspace folder, |
| 489 | // then replace the RootRealPath with the RootPath (the symlink path). |
| 490 | let targetFileNameReplaced: boolean = false; |
| 491 | clients.forEach(client => { |
| 492 | if (!targetFileNameReplaced && client.RootRealPath && client.RootPath !== client.RootRealPath |
| 493 | && targetFileName.startsWith(client.RootRealPath)) { |
| 494 | targetFileName = client.RootPath + targetFileName.substring(client.RootRealPath.length); |
| 495 | targetFileNameReplaced = true; |
| 496 | } |
| 497 | }); |
| 498 | const document: vscode.TextDocument = await vscode.workspace.openTextDocument(targetFileName); |
| 499 | await vscode.window.showTextDocument(document).then(undefined, logAndReturn.undefined); |
| 500 | } catch (e) { |
| 501 | if (e instanceof vscode.CancellationError) { |
| 502 | return; |
| 503 | } |
| 504 | throw e; |
| 505 | } |
| 506 | }; |
| 507 | |
| 508 | const tokenSource: vscode.CancellationTokenSource = new vscode.CancellationTokenSource(); |
| 509 | try { |
no test coverage detected