@lvce-editor/extension-host-worker 8.53.0 → 8.53.2
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) => {
|
|
@@ -1968,28 +2026,32 @@ const {
|
|
|
1968
2026
|
type: Array$1
|
|
1969
2027
|
}
|
|
1970
2028
|
});
|
|
1971
|
-
const executeCodeActionProvider = async uid => {
|
|
2029
|
+
const executeCodeActionProvider = async (uid, ...args) => {
|
|
1972
2030
|
if (!hasLegacyProvider(getProvider$b, uid)) {
|
|
1973
|
-
const isolated = await execute$1('code action', 'provideCodeActions', uid);
|
|
2031
|
+
const isolated = await execute$1('code action', 'provideCodeActions', uid, ...args);
|
|
1974
2032
|
if (isolated.found) {
|
|
1975
2033
|
return isolated.result;
|
|
1976
2034
|
}
|
|
1977
2035
|
}
|
|
1978
|
-
|
|
2036
|
+
const executeProvider = executeRegisteredCodeActionProvider;
|
|
2037
|
+
return executeProvider(uid, ...args);
|
|
1979
2038
|
};
|
|
1980
2039
|
const toSourceAction = (languageId, action) => {
|
|
1981
2040
|
return {
|
|
2041
|
+
...(action.edits && {
|
|
2042
|
+
edits: action.edits
|
|
2043
|
+
}),
|
|
1982
2044
|
kind: action.kind,
|
|
1983
2045
|
languageId,
|
|
1984
2046
|
name: action.name
|
|
1985
2047
|
};
|
|
1986
2048
|
};
|
|
1987
|
-
const getSourceActions = async uid => {
|
|
2049
|
+
const getSourceActions = async (uid, ...args) => {
|
|
1988
2050
|
const textDocument = get$a(uid);
|
|
1989
2051
|
if (!textDocument) {
|
|
1990
2052
|
return [];
|
|
1991
2053
|
}
|
|
1992
|
-
const actions = await executeCodeActionProvider(uid);
|
|
2054
|
+
const actions = await executeCodeActionProvider(uid, ...args);
|
|
1993
2055
|
return actions.map(action => toSourceAction(textDocument.languageId, action));
|
|
1994
2056
|
};
|
|
1995
2057
|
const isOrganizeImports = action => {
|
|
@@ -2019,58 +2081,6 @@ const executeOrganizeImports = async uid => {
|
|
|
2019
2081
|
return edits;
|
|
2020
2082
|
};
|
|
2021
2083
|
|
|
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
2084
|
const {
|
|
2075
2085
|
executeCommentProvider: executeLegacyCommentProvider,
|
|
2076
2086
|
getProvider: getProvider$a,
|
|
@@ -4340,7 +4350,7 @@ const api = {
|
|
|
4340
4350
|
// Comment
|
|
4341
4351
|
|
|
4342
4352
|
executeClosingTagProvider: executeClosingTagProvider,
|
|
4343
|
-
executeCommand: executeCommand$
|
|
4353
|
+
executeCommand: executeCommand$1,
|
|
4344
4354
|
executeCommentProvider: executeCommentProvider,
|
|
4345
4355
|
executeCompletionProvider: executeCompletionProvider,
|
|
4346
4356
|
executeDefinitionProvider: executeDefinitionProvider,
|
|
@@ -7233,7 +7243,7 @@ const commandMap = {
|
|
|
7233
7243
|
'ColorTheme.getColorThemeJson': getColorThemeJson,
|
|
7234
7244
|
'ColorTheme.getColorThemeNames': getColorThemeNames,
|
|
7235
7245
|
'ColorTheme.hydrate': hydrate$1,
|
|
7236
|
-
'Commands.executeCommand': executeCommand$
|
|
7246
|
+
'Commands.executeCommand': executeCommand$1,
|
|
7237
7247
|
'ExecuteExternalCommand.executeExternalCommand': executeExternalCommand,
|
|
7238
7248
|
'ExtensionApi.sendMessagePortToFileSystemWorker': sendMessagePortToFileSystemWorker,
|
|
7239
7249
|
'ExtensionHost.activateExtension2': activateExtension2,
|