MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / initLiveShare

Function initLiveShare

src/liveShare/index.ts:66–100  ·  view source on GitHub ↗
(context: vscode.ExtensionContext)

Source from the content-addressed store, hash-verified

64// Initialises the Liveshare functionality for host & guest
65// * session watcher is required *
66export 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
103export async function LiveSessionListener(): Promise<void> {

Callers

nothing calls this directly

Calls 7

initTreeViewFunction · 0.90
initGuestFunction · 0.90
attachActiveGuestFunction · 0.90
LiveSessionListenerFunction · 0.85
isGuestFunction · 0.85
refreshMethod · 0.65
toggleMethod · 0.45

Tested by

no test coverage detected