-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.js
More file actions
732 lines (637 loc) · 21.6 KB
/
extension.js
File metadata and controls
732 lines (637 loc) · 21.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
const fs = require('fs');
const path = require('path');
const os = require('os');
const cp = require('child_process');
const vscode = require('vscode');
let client;
let configSubscription;
let languageClientModule;
let outputChannel;
let statusItem;
let showOutputCommandSubscription;
let viewAstCommandSubscription;
let viewInferredAstCommandSubscription;
let openReplCommandSubscription;
let sendSelectionToReplCommandSubscription;
let executeCurrentScriptInReplCommandSubscription;
let diagnosticsSubscription;
let textChangeSubscription;
let textOpenSubscription;
let stdlibContentProviderSubscription;
let replTerminal;
const pendingAnalysis = new Map();
const REPL_TERMINAL_NAME = 'FScript REPL';
function getConfig() {
const cfg = vscode.workspace.getConfiguration('fscript');
return {
lspEnabled: cfg.get('lsp.enabled', true),
inlayHintsEnabled: cfg.get('inlayHints.enabled', true),
hoverHintsEnabled: cfg.get('hoverHints.enabled', true),
serverPath: (cfg.get('server.path', '') || '').trim(),
logLevel: cfg.get('server.logLevel', 'info'),
replCommand: (cfg.get('repl.command', 'auto') || '').trim() || 'auto'
};
}
function getDocumentSelector() {
return [
{ scheme: 'file', language: 'fscript' },
{ scheme: 'untitled', language: 'fscript' }
];
}
async function resolveDotnetCommand(context) {
const requestingExtensionId = `${context.extension.packageJSON.publisher}.${context.extension.packageJSON.name}`;
try {
const runtime = await vscode.commands.executeCommand('dotnet.acquire', {
version: '10.0',
requestingExtensionId
});
if (runtime && runtime.dotnetPath) {
return runtime.dotnetPath;
}
} catch {
// Fallback to PATH-based dotnet when acquisition is unavailable.
}
return 'dotnet';
}
function hasDotnetSdkOnPath() {
const probe = cp.spawnSync('dotnet', ['--list-sdks'], { encoding: 'utf8' });
return probe.status === 0 && Boolean((probe.stdout || '').trim());
}
async function createServerOptions(context, config) {
const { TransportKind } = require('vscode-languageclient/node');
const runtimeDotnetCommand = await resolveDotnetCommand(context);
if (config.serverPath) {
const userProvidedPath = path.isAbsolute(config.serverPath)
? config.serverPath
: path.resolve(vscode.workspace.workspaceFolders?.[0]?.uri.fsPath || context.extensionPath, config.serverPath);
if (fs.existsSync(userProvidedPath)) {
return {
run: { command: runtimeDotnetCommand, args: [userProvidedPath], transport: TransportKind.stdio },
debug: { command: runtimeDotnetCommand, args: [userProvidedPath], transport: TransportKind.stdio }
};
}
vscode.window.showWarningMessage(
`FScript extension: configured server path does not exist: ${userProvidedPath}`
);
}
const packagedDll = path.join(context.extensionPath, 'server', 'FScript.LanguageServer.dll');
if (fs.existsSync(packagedDll)) {
return {
run: { command: runtimeDotnetCommand, args: [packagedDll], transport: TransportKind.stdio },
debug: { command: runtimeDotnetCommand, args: [packagedDll], transport: TransportKind.stdio }
};
}
if (context.extensionMode !== vscode.ExtensionMode.Development) {
vscode.window.showErrorMessage(
'FScript extension: packaged language server is missing. Reinstall the extension or set fscript.server.path.'
);
return null;
}
const projectPath = path.resolve(
context.extensionPath,
'..',
'src',
'FScript.LanguageServer',
'FScript.LanguageServer.csproj'
);
const outputDll = path.resolve(
context.extensionPath,
'..',
'src',
'FScript.LanguageServer',
'bin',
'Debug',
'net10.0',
'FScript.LanguageServer.dll'
);
if (!hasDotnetSdkOnPath()) {
vscode.window.showErrorMessage(
'FScript extension: language server build fallback requires a .NET SDK in PATH. Install an SDK or set fscript.server.path.'
);
return null;
}
const build = cp.spawnSync('dotnet', ['build', projectPath, '-nologo', '-v', 'q'], {
cwd: context.extensionPath,
encoding: 'utf8'
});
if (build.status !== 0 || !fs.existsSync(outputDll)) {
const details = [build.stdout, build.stderr].filter(Boolean).join('\n');
vscode.window.showErrorMessage(
`FScript extension: unable to build language server.\n${details}`.trim()
);
return null;
}
return {
run: { command: runtimeDotnetCommand, args: [outputDll], transport: TransportKind.stdio },
debug: { command: runtimeDotnetCommand, args: [outputDll], transport: TransportKind.stdio }
};
}
async function stopClient() {
if (client) {
const current = client;
client = undefined;
await current.stop();
}
for (const timeout of pendingAnalysis.values()) {
clearTimeout(timeout);
}
pendingAnalysis.clear();
}
function getActiveFscriptFileUri() {
const editor = vscode.window.activeTextEditor;
if (!editor) {
vscode.window.showErrorMessage('FScript extension: no active editor.');
return null;
}
const document = editor.document;
if (document.languageId !== 'fscript') {
vscode.window.showErrorMessage('FScript extension: active editor is not an FScript file.');
return null;
}
if (document.isUntitled || document.uri.scheme !== 'file') {
vscode.window.showErrorMessage('FScript extension: save the FScript file before viewing AST.');
return null;
}
return document.uri;
}
function getActiveFscriptEditor() {
const editor = vscode.window.activeTextEditor;
if (!editor) {
vscode.window.showErrorMessage('FScript extension: no active editor.');
return null;
}
if (editor.document.languageId !== 'fscript') {
vscode.window.showErrorMessage('FScript extension: active editor is not an FScript file.');
return null;
}
return editor;
}
function getTerminalWorkingDirectory() {
const editor = vscode.window.activeTextEditor;
const activeDocDir = editor?.document?.uri?.scheme === 'file'
? path.dirname(editor.document.uri.fsPath)
: undefined;
return activeDocDir || vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
}
function resolveWorkspaceRoot() {
return vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
}
function resolveReplLaunchCommand() {
const config = getConfig();
if (config.replCommand !== 'auto') {
return config.replCommand;
}
const workspaceRoot = resolveWorkspaceRoot();
if (workspaceRoot) {
const localCliProject = path.join(workspaceRoot, 'src', 'FScript', 'FScript.fsproj');
if (fs.existsSync(localCliProject)) {
return `dotnet run --project "${localCliProject}" --`;
}
}
return 'fscript';
}
function ensureReplTerminal() {
if (replTerminal && !replTerminal.exitStatus) {
replTerminal.show(true);
return replTerminal;
}
const replLaunchCommand = resolveReplLaunchCommand();
replTerminal = vscode.window.createTerminal({
name: REPL_TERMINAL_NAME,
cwd: getTerminalWorkingDirectory()
});
replTerminal.show(true);
replTerminal.sendText(replLaunchCommand, true);
return replTerminal;
}
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
function sendCodeToRepl(terminal, code) {
const normalized = code.replace(/\r\n/g, '\n');
for (const line of normalized.split('\n')) {
terminal.sendText(line, true);
}
// Force execution for multiline/pending blocks in the REPL.
terminal.sendText('', true);
terminal.sendText('', true);
}
function dedentMultilineBlock(code) {
const lines = code.replace(/\r\n/g, '\n').split('\n');
let minIndent = Number.MAX_SAFE_INTEGER;
for (const line of lines) {
if (line.trim().length === 0) {
continue;
}
const match = line.match(/^(\s*)/);
const indent = match ? match[1].length : 0;
if (indent < minIndent) {
minIndent = indent;
}
}
if (!Number.isFinite(minIndent) || minIndent === Number.MAX_SAFE_INTEGER || minIndent === 0) {
return lines.join('\n');
}
return lines
.map((line) => {
if (line.trim().length === 0) {
return line;
}
return line.slice(minIndent);
})
.join('\n');
}
function wrapCodeForAtomicReplExecution(code) {
const normalized = dedentMultilineBlock(code).trimEnd();
const runId = `__vscode_run_${Date.now()}`;
const valueId = `__vscode_value_${Date.now()}`;
const lines = normalized.split('\n');
if (lines.length <= 1) {
return `let ${runId} =\n let ${valueId} =\n ${normalized}\n ${valueId}`;
}
const body = lines
.map((line) => (line.length > 0 ? ` ${line}` : line))
.join('\n');
return `let ${runId} =\n let ${valueId} =\n${body}\n ${valueId}`;
}
function getTopLevelLetBindings(code) {
const lines = dedentMultilineBlock(code).split('\n');
const bindings = [];
const seen = new Set();
const pattern = /^\s*let\s+(?:rec\s+)?([A-Za-z_][A-Za-z0-9_]*)\b/;
for (const line of lines) {
const match = line.match(pattern);
if (!match) {
continue;
}
const name = match[1];
if (!seen.has(name)) {
bindings.push(name);
seen.add(name);
}
}
return bindings;
}
function isSingleTopLevelLetBindingSelection(code, expectedName) {
const lines = dedentMultilineBlock(code).split('\n');
const nonEmpty = lines.filter((line) => line.trim().length > 0);
if (nonEmpty.length === 0) {
return false;
}
const first = nonEmpty[0];
const firstMatch = first.match(/^\s*let\s+(?:rec\s+)?([A-Za-z_][A-Za-z0-9_]*)\b/);
if (!firstMatch || firstMatch[1] !== expectedName) {
return false;
}
for (let i = 1; i < nonEmpty.length; i += 1) {
const line = nonEmpty[i];
const indentMatch = line.match(/^(\s*)/);
const indent = indentMatch ? indentMatch[1].length : 0;
// Any extra top-level statement means this is not a pure binding selection.
if (indent === 0) {
return false;
}
}
return true;
}
function wrapSelectionForPersistentBindings(code) {
const normalized = dedentMultilineBlock(code).trimEnd();
const bindings = getTopLevelLetBindings(normalized);
if (bindings.length !== 1) {
return wrapCodeForAtomicReplExecution(normalized);
}
const [name] = bindings;
if (!isSingleTopLevelLetBindingSelection(normalized, name)) {
return wrapCodeForAtomicReplExecution(normalized);
}
const runId = `__vscode_run_${Date.now()}`;
const indentedBody = normalized
.split('\n')
.map((line) => (line.length > 0 ? ` ${line}` : line))
.join('\n');
return `let ${runId} =\n${indentedBody}\n ${name}\nlet ${name} = ${runId}`;
}
async function openJsonInTempFile(prefix, data) {
const nonce = `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
const tempPath = path.join(os.tmpdir(), `${prefix}-${nonce}.json`);
fs.writeFileSync(tempPath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
const doc = await vscode.workspace.openTextDocument(vscode.Uri.file(tempPath));
await vscode.languages.setTextDocumentLanguage(doc, 'json');
await vscode.window.showTextDocument(doc, { preview: false });
}
async function runAstCommand(methodName, tempPrefix) {
if (!client) {
vscode.window.showErrorMessage('FScript extension: language server is not running. Enable fscript.lsp.enabled.');
return;
}
const uri = getActiveFscriptFileUri();
if (!uri) {
return;
}
try {
const result = await client.sendRequest(methodName, {
textDocument: { uri: uri.toString() }
});
if (!result || result.ok !== true) {
const message = result?.error?.message || 'Unknown AST command error.';
vscode.window.showErrorMessage(`FScript extension: ${message}`);
return;
}
await openJsonInTempFile(tempPrefix, result.data);
} catch (err) {
const msg = err && err.message ? err.message : String(err);
vscode.window.showErrorMessage(`FScript extension: failed to execute AST command. ${msg}`);
}
}
function ensureUi(context) {
if (!outputChannel) {
outputChannel = vscode.window.createOutputChannel('FScript Language Server');
context.subscriptions.push(outputChannel);
}
if (!statusItem) {
statusItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 100);
statusItem.name = 'FScript Language Server';
statusItem.command = 'fscript.showLanguageServerOutput';
statusItem.tooltip = 'FScript Language Server status';
statusItem.text = '$(circle-large-outline) FScript';
statusItem.show();
context.subscriptions.push(statusItem);
}
}
function setStatusStarting() {
if (statusItem) {
statusItem.text = '$(sync~spin) FScript: starting...';
statusItem.tooltip = 'FScript Language Server is starting';
statusItem.show();
}
}
function setStatusReady() {
if (statusItem) {
statusItem.text = '$(check) FScript';
statusItem.tooltip = 'FScript Language Server is ready';
statusItem.show();
}
}
function setStatusAnalyzing() {
if (statusItem) {
statusItem.text = '$(sync~spin) FScript: analyzing...';
statusItem.tooltip = 'FScript Language Server is analyzing current script';
statusItem.show();
}
}
function setStatusDisabled() {
if (statusItem) {
statusItem.text = '$(circle-slash) FScript';
statusItem.tooltip = 'FScript Language Server is disabled by settings';
statusItem.show();
}
}
function setStatusError(message) {
if (statusItem) {
statusItem.text = '$(error) FScript';
statusItem.tooltip = `FScript Language Server error: ${message}`;
statusItem.show();
}
}
function queueAnalysis(uri) {
if (!client || !uri) {
return;
}
const key = uri.toString();
const existing = pendingAnalysis.get(key);
if (existing) {
clearTimeout(existing);
}
const timeout = setTimeout(() => {
pendingAnalysis.delete(key);
if (pendingAnalysis.size === 0 && client) {
setStatusReady();
}
}, 5000);
pendingAnalysis.set(key, timeout);
setStatusAnalyzing();
}
function completeAnalysis(uri) {
const key = uri.toString();
const timeout = pendingAnalysis.get(key);
if (!timeout) {
return;
}
clearTimeout(timeout);
pendingAnalysis.delete(key);
if (pendingAnalysis.size === 0 && client) {
setStatusReady();
}
}
function registerStdlibContentProvider(context) {
if (stdlibContentProviderSubscription) {
return;
}
const provider = {
async provideTextDocumentContent(uri) {
if (!client) {
throw new Error('FScript language server is not running.');
}
const response = await client.sendRequest('fscript/stdlibSource', { uri: uri.toString() });
if (!response || response.ok !== true || !response.data || typeof response.data.text !== 'string') {
const message = response?.error?.message || `Unable to load stdlib source for ${uri.toString()}.`;
throw new Error(message);
}
return response.data.text;
}
};
stdlibContentProviderSubscription = vscode.workspace.registerTextDocumentContentProvider('fscript-stdlib', provider);
context.subscriptions.push(stdlibContentProviderSubscription);
}
async function startClient(context) {
ensureUi(context);
try {
if (!languageClientModule) {
languageClientModule = require('vscode-languageclient/node');
}
} catch {
vscode.window.showWarningMessage(
'FScript extension: syntax highlighting is active, but LSP is disabled (missing vscode-languageclient). Run `npm install` in vscode-fscript/.'
);
return;
}
const config = getConfig();
if (!config.lspEnabled) {
setStatusDisabled();
return;
}
try {
setStatusStarting();
const serverOptions = await createServerOptions(context, config);
if (!serverOptions) {
setStatusError('Server build/resolution failed');
return;
}
const clientOptions = {
documentSelector: getDocumentSelector(),
outputChannel,
synchronize: {
fileEvents: vscode.workspace.createFileSystemWatcher('**/*.fss')
},
initializationOptions: {
logLevel: config.logLevel,
inlayHintsEnabled: config.inlayHintsEnabled,
hoverHintsEnabled: config.hoverHintsEnabled
}
};
const LanguageClient = languageClientModule.LanguageClient;
client = new LanguageClient('fscriptLanguageServer', 'FScript Language Server', serverOptions, clientOptions);
const startDisposable = client.start();
context.subscriptions.push(startDisposable);
setStatusReady();
} catch (err) {
const msg = err && err.message ? err.message : String(err);
vscode.window.showErrorMessage(`FScript extension: failed to start language server. ${msg}`);
setStatusError(msg);
}
}
function activate(context) {
ensureUi(context);
registerStdlibContentProvider(context);
showOutputCommandSubscription = vscode.commands.registerCommand('fscript.showLanguageServerOutput', () => {
if (outputChannel) {
outputChannel.show(true);
} else {
vscode.commands.executeCommand('workbench.action.output.toggleOutput');
}
});
context.subscriptions.push(showOutputCommandSubscription);
viewAstCommandSubscription = vscode.commands.registerCommand('fscript.viewAst', async () => {
await runAstCommand('fscript/viewAst', 'fscript-ast');
});
context.subscriptions.push(viewAstCommandSubscription);
viewInferredAstCommandSubscription = vscode.commands.registerCommand('fscript.viewInferredAst', async () => {
await runAstCommand('fscript/viewInferredAst', 'fscript-inferred-ast');
});
context.subscriptions.push(viewInferredAstCommandSubscription);
openReplCommandSubscription = vscode.commands.registerCommand('fscript.openRepl', () => {
ensureReplTerminal();
});
context.subscriptions.push(openReplCommandSubscription);
sendSelectionToReplCommandSubscription = vscode.commands.registerCommand('fscript.sendSelectionToRepl', async () => {
const editor = getActiveFscriptEditor();
if (!editor) {
return;
}
const selectedText = editor.document.getText(editor.selection);
if (!selectedText || selectedText.trim().length === 0) {
vscode.window.showErrorMessage('FScript extension: selection is empty.');
return;
}
const payload = selectedText.includes('\n')
? wrapSelectionForPersistentBindings(selectedText)
: selectedText;
const terminal = ensureReplTerminal();
await sleep(150);
sendCodeToRepl(terminal, payload);
});
context.subscriptions.push(sendSelectionToReplCommandSubscription);
executeCurrentScriptInReplCommandSubscription = vscode.commands.registerCommand('fscript.executeCurrentScriptInRepl', async () => {
const editor = getActiveFscriptEditor();
if (!editor) {
return;
}
const scriptText = editor.document.getText();
if (!scriptText || scriptText.trim().length === 0) {
vscode.window.showErrorMessage('FScript extension: current script is empty.');
return;
}
const payload = wrapCodeForAtomicReplExecution(scriptText);
const terminal = ensureReplTerminal();
await sleep(150);
sendCodeToRepl(terminal, payload);
});
context.subscriptions.push(executeCurrentScriptInReplCommandSubscription);
diagnosticsSubscription = vscode.languages.onDidChangeDiagnostics((event) => {
for (const uri of event.uris) {
completeAnalysis(uri);
}
});
context.subscriptions.push(diagnosticsSubscription);
textChangeSubscription = vscode.workspace.onDidChangeTextDocument((event) => {
if (event.document.languageId === 'fscript') {
queueAnalysis(event.document.uri);
}
});
context.subscriptions.push(textChangeSubscription);
textOpenSubscription = vscode.workspace.onDidOpenTextDocument((doc) => {
if (doc.languageId === 'fscript') {
queueAnalysis(doc.uri);
}
});
context.subscriptions.push(textOpenSubscription);
startClient(context);
configSubscription = vscode.workspace.onDidChangeConfiguration(async (event) => {
if (
event.affectsConfiguration('fscript.lsp.enabled') ||
event.affectsConfiguration('fscript.inlayHints.enabled') ||
event.affectsConfiguration('fscript.hoverHints.enabled') ||
event.affectsConfiguration('fscript.server.path') ||
event.affectsConfiguration('fscript.server.logLevel')
) {
await stopClient();
await startClient(context);
}
});
context.subscriptions.push(configSubscription);
}
async function deactivate() {
if (showOutputCommandSubscription) {
showOutputCommandSubscription.dispose();
showOutputCommandSubscription = undefined;
}
if (viewAstCommandSubscription) {
viewAstCommandSubscription.dispose();
viewAstCommandSubscription = undefined;
}
if (viewInferredAstCommandSubscription) {
viewInferredAstCommandSubscription.dispose();
viewInferredAstCommandSubscription = undefined;
}
if (openReplCommandSubscription) {
openReplCommandSubscription.dispose();
openReplCommandSubscription = undefined;
}
if (sendSelectionToReplCommandSubscription) {
sendSelectionToReplCommandSubscription.dispose();
sendSelectionToReplCommandSubscription = undefined;
}
if (executeCurrentScriptInReplCommandSubscription) {
executeCurrentScriptInReplCommandSubscription.dispose();
executeCurrentScriptInReplCommandSubscription = undefined;
}
if (diagnosticsSubscription) {
diagnosticsSubscription.dispose();
diagnosticsSubscription = undefined;
}
if (textChangeSubscription) {
textChangeSubscription.dispose();
textChangeSubscription = undefined;
}
if (textOpenSubscription) {
textOpenSubscription.dispose();
textOpenSubscription = undefined;
}
if (configSubscription) {
configSubscription.dispose();
configSubscription = undefined;
}
if (stdlibContentProviderSubscription) {
stdlibContentProviderSubscription.dispose();
stdlibContentProviderSubscription = undefined;
}
if (replTerminal) {
replTerminal.dispose();
replTerminal = undefined;
}
await stopClient();
}
module.exports = {
activate,
deactivate
};