(context: vscode.ExtensionContext)
| 64 | // Initialises the Liveshare functionality for host & guest |
| 65 | // * session watcher is required * |
| 66 | export async function initLiveShare(context: vscode.ExtensionContext): Promise<void> { |
| 67 | if (enableSessionWatcher) { |
| 68 | await LiveSessionListener(); |
| 69 | isGuestSession = isGuest(); |
| 70 | if (!isGuestSession) { |
| 71 | // Construct tree view for host |
| 72 | initTreeView(); |
| 73 | } else { |
| 74 | // Construct guest session watcher |
| 75 | initGuest(context); |
| 76 | } |
| 77 | |
| 78 | // Set context value for hiding buttons for guests |
| 79 | void vscode.commands.executeCommand('setContext', 'r.liveShare:isGuest', isGuestSession); |
| 80 | |
| 81 | // push commands |
| 82 | if (!isGuestSession) { |
| 83 | context.subscriptions.push( |
| 84 | vscode.commands.registerCommand( |
| 85 | 'r.liveShare.toggle', (node: ToggleNode) => node.toggle(rLiveShareProvider) |
| 86 | ), |
| 87 | vscode.commands.registerCommand( |
| 88 | 'r.liveShare.retry', async () => { |
| 89 | await LiveSessionListener(); |
| 90 | rLiveShareProvider.refresh(); |
| 91 | } |
| 92 | ) |
| 93 | ); |
| 94 | } else { |
| 95 | context.subscriptions.push( |
| 96 | vscode.commands.registerCommand('r.attachActiveGuest', () => attachActiveGuest()) |
| 97 | ); |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // Listens for the activation of a LiveShare session |
| 103 | export async function LiveSessionListener(): Promise<void> { |
nothing calls this directly
no test coverage detected