@lvce-editor/extension-management-worker 4.52.1 → 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,
|
|
@@ -4331,6 +4353,7 @@ const commandMap = {
|
|
|
4331
4353
|
'Extensions.enable': enableExtension,
|
|
4332
4354
|
'Extensions.enable2': enableExtension2,
|
|
4333
4355
|
'Extensions.enableWorkspace': enableWorkspaceExtension,
|
|
4356
|
+
'Extensions.executeCodeActionProviders': wrapCommand(executeCodeActionProviders),
|
|
4334
4357
|
'Extensions.executeCommand': wrapCommand(executeCommand),
|
|
4335
4358
|
'Extensions.executeCompletionProvider': wrapCommand(executeCompletionProvider),
|
|
4336
4359
|
'Extensions.executeDiagnosticProvider': wrapCommand(executeDiagnosticProvider),
|