@lvce-editor/extension-host-worker 8.53.0 → 8.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1370,16 +1370,74 @@ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
|
1370
1370
|
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1371
1371
|
};
|
|
1372
1372
|
|
|
1373
|
+
const state$c = {
|
|
1374
|
+
commands: Object.create(null)
|
|
1375
|
+
};
|
|
1376
|
+
const getCommandDisplay = command => {
|
|
1377
|
+
if (command && command.id && typeof command.id === 'string') {
|
|
1378
|
+
return ` ${command.id}`;
|
|
1379
|
+
}
|
|
1380
|
+
return '';
|
|
1381
|
+
};
|
|
1382
|
+
const registerCommand = command => {
|
|
1383
|
+
try {
|
|
1384
|
+
if (!command) {
|
|
1385
|
+
if (command === null) {
|
|
1386
|
+
throw new Error(`command is null`);
|
|
1387
|
+
}
|
|
1388
|
+
throw new Error('command is not defined');
|
|
1389
|
+
}
|
|
1390
|
+
if (!command.id) {
|
|
1391
|
+
throw new Error('command is missing id');
|
|
1392
|
+
}
|
|
1393
|
+
if (!command.execute) {
|
|
1394
|
+
throw new Error('command is missing execute function');
|
|
1395
|
+
}
|
|
1396
|
+
if (command.id in state$c.commands) {
|
|
1397
|
+
throw new Error(`command cannot be registered multiple times`);
|
|
1398
|
+
}
|
|
1399
|
+
state$c.commands[command.id] = command;
|
|
1400
|
+
} catch (error) {
|
|
1401
|
+
const commandDisplayId = getCommandDisplay(command);
|
|
1402
|
+
throw new VError(error, `Failed to register command${commandDisplayId}`);
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
const executeCommand$2 = async (id, ...args) => {
|
|
1406
|
+
try {
|
|
1407
|
+
const command = state$c.commands[id];
|
|
1408
|
+
if (!command) {
|
|
1409
|
+
throw new Error(`command ${id} not found`);
|
|
1410
|
+
}
|
|
1411
|
+
const results = await command.execute(...args);
|
|
1412
|
+
return results;
|
|
1413
|
+
} catch (error) {
|
|
1414
|
+
// @ts-ignore
|
|
1415
|
+
if (error && error.isExpected) {
|
|
1416
|
+
throw error;
|
|
1417
|
+
}
|
|
1418
|
+
throw new VError(error, 'Failed to execute command');
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
const hasCommand = id => {
|
|
1422
|
+
return id in state$c.commands;
|
|
1423
|
+
};
|
|
1424
|
+
const getRegisteredCommandIds$1 = () => {
|
|
1425
|
+
return Object.values(state$c.commands).map(command => command.id);
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1373
1428
|
const isCommandNotFoundError = error => {
|
|
1374
1429
|
return error instanceof Error && error.name === 'CommandNotFoundError';
|
|
1375
1430
|
};
|
|
1376
|
-
const executeCommand$
|
|
1431
|
+
const executeCommand$1 = async (id, ...args) => {
|
|
1377
1432
|
try {
|
|
1378
1433
|
return await invoke$6('Extensions.executeCommand', id, ...args);
|
|
1379
1434
|
} catch (error) {
|
|
1380
1435
|
if (!isCommandNotFoundError(error)) {
|
|
1381
1436
|
throw error;
|
|
1382
1437
|
}
|
|
1438
|
+
if (hasCommand(id)) {
|
|
1439
|
+
return executeCommand$2(id, ...args);
|
|
1440
|
+
}
|
|
1383
1441
|
return invoke$4(id, ...args);
|
|
1384
1442
|
}
|
|
1385
1443
|
};
|
|
@@ -1395,7 +1453,7 @@ const getJson$1 = async url => {
|
|
|
1395
1453
|
throw new DepecratedError(`vscode.getJson is deprecated, use createNodeRpc instead`);
|
|
1396
1454
|
};
|
|
1397
1455
|
|
|
1398
|
-
const state$
|
|
1456
|
+
const state$b = {
|
|
1399
1457
|
/** @type{any[]} */
|
|
1400
1458
|
onDidChangeTextDocumentListeners: [],
|
|
1401
1459
|
/** @type{any[]} */
|
|
@@ -1405,19 +1463,19 @@ const state$c = {
|
|
|
1405
1463
|
textDocuments: Object.create(null)
|
|
1406
1464
|
};
|
|
1407
1465
|
const setDocument = (textDocumentId, textDocument) => {
|
|
1408
|
-
state$
|
|
1466
|
+
state$b.textDocuments[textDocumentId] = textDocument;
|
|
1409
1467
|
};
|
|
1410
1468
|
const getDidOpenListeners = () => {
|
|
1411
|
-
return state$
|
|
1469
|
+
return state$b.onDidSaveTextDocumentListeners;
|
|
1412
1470
|
};
|
|
1413
1471
|
const getWillChangeListeners = () => {
|
|
1414
|
-
return state$
|
|
1472
|
+
return state$b.onWillChangeEditorListeners;
|
|
1415
1473
|
};
|
|
1416
1474
|
const getDidChangeListeners = () => {
|
|
1417
|
-
return state$
|
|
1475
|
+
return state$b.onDidChangeTextDocumentListeners;
|
|
1418
1476
|
};
|
|
1419
1477
|
const getDocument = textDocumentId => {
|
|
1420
|
-
return state$
|
|
1478
|
+
return state$b.textDocuments[textDocumentId];
|
|
1421
1479
|
};
|
|
1422
1480
|
|
|
1423
1481
|
const getOffset$1 = (textDocument, position) => {
|
|
@@ -2019,58 +2077,6 @@ const executeOrganizeImports = async uid => {
|
|
|
2019
2077
|
return edits;
|
|
2020
2078
|
};
|
|
2021
2079
|
|
|
2022
|
-
const state$b = {
|
|
2023
|
-
commands: Object.create(null)
|
|
2024
|
-
};
|
|
2025
|
-
const getCommandDisplay = command => {
|
|
2026
|
-
if (command && command.id && typeof command.id === 'string') {
|
|
2027
|
-
return ` ${command.id}`;
|
|
2028
|
-
}
|
|
2029
|
-
return '';
|
|
2030
|
-
};
|
|
2031
|
-
const registerCommand = command => {
|
|
2032
|
-
try {
|
|
2033
|
-
if (!command) {
|
|
2034
|
-
if (command === null) {
|
|
2035
|
-
throw new Error(`command is null`);
|
|
2036
|
-
}
|
|
2037
|
-
throw new Error('command is not defined');
|
|
2038
|
-
}
|
|
2039
|
-
if (!command.id) {
|
|
2040
|
-
throw new Error('command is missing id');
|
|
2041
|
-
}
|
|
2042
|
-
if (!command.execute) {
|
|
2043
|
-
throw new Error('command is missing execute function');
|
|
2044
|
-
}
|
|
2045
|
-
if (command.id in state$b.commands) {
|
|
2046
|
-
throw new Error(`command cannot be registered multiple times`);
|
|
2047
|
-
}
|
|
2048
|
-
state$b.commands[command.id] = command;
|
|
2049
|
-
} catch (error) {
|
|
2050
|
-
const commandDisplayId = getCommandDisplay(command);
|
|
2051
|
-
throw new VError(error, `Failed to register command${commandDisplayId}`);
|
|
2052
|
-
}
|
|
2053
|
-
};
|
|
2054
|
-
const executeCommand$1 = async (id, ...args) => {
|
|
2055
|
-
try {
|
|
2056
|
-
const command = state$b.commands[id];
|
|
2057
|
-
if (!command) {
|
|
2058
|
-
throw new Error(`command ${id} not found`);
|
|
2059
|
-
}
|
|
2060
|
-
const results = await command.execute(...args);
|
|
2061
|
-
return results;
|
|
2062
|
-
} catch (error) {
|
|
2063
|
-
// @ts-ignore
|
|
2064
|
-
if (error && error.isExpected) {
|
|
2065
|
-
throw error;
|
|
2066
|
-
}
|
|
2067
|
-
throw new VError(error, 'Failed to execute command');
|
|
2068
|
-
}
|
|
2069
|
-
};
|
|
2070
|
-
const getRegisteredCommandIds$1 = () => {
|
|
2071
|
-
return Object.values(state$b.commands).map(command => command.id);
|
|
2072
|
-
};
|
|
2073
|
-
|
|
2074
2080
|
const {
|
|
2075
2081
|
executeCommentProvider: executeLegacyCommentProvider,
|
|
2076
2082
|
getProvider: getProvider$a,
|
|
@@ -4340,7 +4346,7 @@ const api = {
|
|
|
4340
4346
|
// Comment
|
|
4341
4347
|
|
|
4342
4348
|
executeClosingTagProvider: executeClosingTagProvider,
|
|
4343
|
-
executeCommand: executeCommand$
|
|
4349
|
+
executeCommand: executeCommand$1,
|
|
4344
4350
|
executeCommentProvider: executeCommentProvider,
|
|
4345
4351
|
executeCompletionProvider: executeCompletionProvider,
|
|
4346
4352
|
executeDefinitionProvider: executeDefinitionProvider,
|
|
@@ -7233,7 +7239,7 @@ const commandMap = {
|
|
|
7233
7239
|
'ColorTheme.getColorThemeJson': getColorThemeJson,
|
|
7234
7240
|
'ColorTheme.getColorThemeNames': getColorThemeNames,
|
|
7235
7241
|
'ColorTheme.hydrate': hydrate$1,
|
|
7236
|
-
'Commands.executeCommand': executeCommand$
|
|
7242
|
+
'Commands.executeCommand': executeCommand$1,
|
|
7237
7243
|
'ExecuteExternalCommand.executeExternalCommand': executeExternalCommand,
|
|
7238
7244
|
'ExtensionApi.sendMessagePortToFileSystemWorker': sendMessagePortToFileSystemWorker,
|
|
7239
7245
|
'ExtensionHost.activateExtension2': activateExtension2,
|