@lvce-editor/extension-management-worker 4.52.0 → 4.52.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.
|
@@ -64,7 +64,7 @@ const Object$1 = 1;
|
|
|
64
64
|
const Number = 2;
|
|
65
65
|
const Array$1 = 3;
|
|
66
66
|
const String$1 = 4;
|
|
67
|
-
const Boolean = 5;
|
|
67
|
+
const Boolean$1 = 5;
|
|
68
68
|
const Function = 6;
|
|
69
69
|
const Null = 7;
|
|
70
70
|
const Unknown = 8;
|
|
@@ -85,7 +85,7 @@ const getType = value => {
|
|
|
85
85
|
}
|
|
86
86
|
return Object$1;
|
|
87
87
|
case 'boolean':
|
|
88
|
-
return Boolean;
|
|
88
|
+
return Boolean$1;
|
|
89
89
|
default:
|
|
90
90
|
return Unknown;
|
|
91
91
|
}
|
|
@@ -3114,6 +3114,11 @@ const activationEventByKind = {
|
|
|
3114
3114
|
'type definition': 'onTypeDefinition'
|
|
3115
3115
|
};
|
|
3116
3116
|
const contributesLanguageProvider = (extension, kind, languageId) => {
|
|
3117
|
+
if (kind === 'code action') {
|
|
3118
|
+
const hasCodeActionActivation = extension.activation?.includes(`onCodeAction:${languageId}`);
|
|
3119
|
+
const hasLegacyCodeActions = Array.isArray(extension.codeActions) && extension.activation?.includes(`onLanguage:${languageId}`);
|
|
3120
|
+
return Boolean(hasCodeActionActivation || hasLegacyCodeActions);
|
|
3121
|
+
}
|
|
3117
3122
|
const activationEvent = activationEventByKind[kind] || 'onLanguage';
|
|
3118
3123
|
return Array.isArray(extension.activation) && extension.activation.includes(`${activationEvent}:${languageId}`);
|
|
3119
3124
|
};
|
|
@@ -3142,6 +3147,23 @@ const executeLanguageProvider = async (extensionsState, kind, methodName, textDo
|
|
|
3142
3147
|
result
|
|
3143
3148
|
};
|
|
3144
3149
|
};
|
|
3150
|
+
const executeCodeActionProviders = async (extensionsState, textDocument, offset) => {
|
|
3151
|
+
const {
|
|
3152
|
+
assetDir,
|
|
3153
|
+
platform
|
|
3154
|
+
} = await getRuntimeContext('', extensionsState.platform);
|
|
3155
|
+
const extensions = await getMatchingExtensions$2(extensionsState, 'code action', textDocument, assetDir, platform);
|
|
3156
|
+
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
3157
|
+
const results = await Promise.all(rpcs.map(rpc => executeRpcLanguageProvider(rpc, 'code action', 'provideCodeActions', textDocument, [offset])));
|
|
3158
|
+
const actions = [];
|
|
3159
|
+
for (const result of results) {
|
|
3160
|
+
if (!Array.isArray(result)) {
|
|
3161
|
+
throw new TypeError('Code action provider result must be an array');
|
|
3162
|
+
}
|
|
3163
|
+
actions.push(...result);
|
|
3164
|
+
}
|
|
3165
|
+
return actions;
|
|
3166
|
+
};
|
|
3145
3167
|
const executeOrganizeImportsProvider = async (extensionsState, textDocument) => {
|
|
3146
3168
|
const {
|
|
3147
3169
|
assetDir,
|
|
@@ -3254,6 +3276,16 @@ const executeSourceControlProvider = async (extensionsState, providerId, methodN
|
|
|
3254
3276
|
result
|
|
3255
3277
|
};
|
|
3256
3278
|
};
|
|
3279
|
+
const executeRequiredSourceControlProvider = async (extensionsState, providerId, methodName, ...args) => {
|
|
3280
|
+
const {
|
|
3281
|
+
found,
|
|
3282
|
+
result
|
|
3283
|
+
} = await executeSourceControlProvider(extensionsState, providerId, methodName, ...args);
|
|
3284
|
+
if (!found) {
|
|
3285
|
+
throw new Error('No source control provider found');
|
|
3286
|
+
}
|
|
3287
|
+
return result;
|
|
3288
|
+
};
|
|
3257
3289
|
|
|
3258
3290
|
const readFile = uri => {
|
|
3259
3291
|
return readFile$1(uri);
|
|
@@ -4285,9 +4317,27 @@ const wrapCommand = command => {
|
|
|
4285
4317
|
return command(get$5(), ...args);
|
|
4286
4318
|
};
|
|
4287
4319
|
};
|
|
4320
|
+
const wrapSourceControlProviderCommand = methodName => {
|
|
4321
|
+
return wrapCommand((extensionsState, providerId, ...args) => {
|
|
4322
|
+
return executeRequiredSourceControlProvider(extensionsState, providerId, methodName, ...args);
|
|
4323
|
+
});
|
|
4324
|
+
};
|
|
4288
4325
|
const commandMap = {
|
|
4289
4326
|
'ExtensionApi.readFile': readFile,
|
|
4327
|
+
'ExtensionHost.sourceControlGetChangedFiles': wrapSourceControlProviderCommand('executeSourceControlGetChangedFiles'),
|
|
4290
4328
|
'ExtensionHostQuickPick.showQuickPick': showQuickPick,
|
|
4329
|
+
'ExtensionHostSourceControl.acceptInput': wrapSourceControlProviderCommand('executeSourceControlAcceptInput'),
|
|
4330
|
+
'ExtensionHostSourceControl.add': wrapSourceControlProviderCommand('executeSourceControlAdd'),
|
|
4331
|
+
'ExtensionHostSourceControl.discard': wrapSourceControlProviderCommand('executeSourceControlDiscard'),
|
|
4332
|
+
'ExtensionHostSourceControl.generateCommitMessage': wrapSourceControlProviderCommand('executeSourceControlGenerateCommitMessage'),
|
|
4333
|
+
'ExtensionHostSourceControl.getBadgeCount': wrapSourceControlProviderCommand('executeSourceControlGetBadgeCount'),
|
|
4334
|
+
'ExtensionHostSourceControl.getChangedFiles': wrapSourceControlProviderCommand('executeSourceControlGetChangedFiles'),
|
|
4335
|
+
'ExtensionHostSourceControl.getEnabledProviderIds': wrapCommand(getEnabledSourceControlProviderIds),
|
|
4336
|
+
'ExtensionHostSourceControl.getFeatures': wrapSourceControlProviderCommand('executeSourceControlGetFeatures'),
|
|
4337
|
+
'ExtensionHostSourceControl.getFileBefore': wrapSourceControlProviderCommand('executeSourceControlGetFileBefore'),
|
|
4338
|
+
'ExtensionHostSourceControl.getFileDecorations': wrapSourceControlProviderCommand('executeSourceControlGetFileDecorations'),
|
|
4339
|
+
'ExtensionHostSourceControl.getGroups': wrapSourceControlProviderCommand('executeSourceControlGetGroups'),
|
|
4340
|
+
'ExtensionHostSourceControl.getIconDefinitions': async () => [],
|
|
4291
4341
|
'Extensions.activateByEvent': activateByEvent,
|
|
4292
4342
|
'Extensions.addExtension': addExtension,
|
|
4293
4343
|
'Extensions.addWebExtension': addWebExtension,
|
|
@@ -4303,6 +4353,7 @@ const commandMap = {
|
|
|
4303
4353
|
'Extensions.enable': enableExtension,
|
|
4304
4354
|
'Extensions.enable2': enableExtension2,
|
|
4305
4355
|
'Extensions.enableWorkspace': enableWorkspaceExtension,
|
|
4356
|
+
'Extensions.executeCodeActionProviders': wrapCommand(executeCodeActionProviders),
|
|
4306
4357
|
'Extensions.executeCommand': wrapCommand(executeCommand),
|
|
4307
4358
|
'Extensions.executeCompletionProvider': wrapCommand(executeCompletionProvider),
|
|
4308
4359
|
'Extensions.executeDiagnosticProvider': wrapCommand(executeDiagnosticProvider),
|