@lvce-editor/extension-management-worker 4.52.1 → 4.52.3

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
  }
@@ -2558,7 +2558,8 @@ const createWebViewWorkerRpc2 = async (rpcInfo, port) => {
2558
2558
  // host sub-worker doesn't need to import the other file
2559
2559
  if (rpcInfo.contentSecurityPolicy) {
2560
2560
  const pathName = new URL(rpcInfo.url, 'http://localhost').pathname;
2561
- await invoke('ExtensionHostWorkerContentSecurityPolicy.set', pathName, rpcInfo.contentSecurityPolicy);
2561
+ const contentSecurityPolicy = getContentSecurityPolicy(rpcInfo.contentSecurityPolicy, rpcInfo.url);
2562
+ await invoke('ExtensionHostWorkerContentSecurityPolicy.set', pathName, contentSecurityPolicy);
2562
2563
  }
2563
2564
  await invokeAndTransfer('IpcParent.create', {
2564
2565
  method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
@@ -3114,6 +3115,11 @@ const activationEventByKind = {
3114
3115
  'type definition': 'onTypeDefinition'
3115
3116
  };
3116
3117
  const contributesLanguageProvider = (extension, kind, languageId) => {
3118
+ if (kind === 'code action') {
3119
+ const hasCodeActionActivation = extension.activation?.includes(`onCodeAction:${languageId}`);
3120
+ const hasLegacyCodeActions = Array.isArray(extension.codeActions) && extension.activation?.includes(`onLanguage:${languageId}`);
3121
+ return Boolean(hasCodeActionActivation || hasLegacyCodeActions);
3122
+ }
3117
3123
  const activationEvent = activationEventByKind[kind] || 'onLanguage';
3118
3124
  return Array.isArray(extension.activation) && extension.activation.includes(`${activationEvent}:${languageId}`);
3119
3125
  };
@@ -3142,6 +3148,23 @@ const executeLanguageProvider = async (extensionsState, kind, methodName, textDo
3142
3148
  result
3143
3149
  };
3144
3150
  };
3151
+ const executeCodeActionProviders = async (extensionsState, textDocument, offset) => {
3152
+ const {
3153
+ assetDir,
3154
+ platform
3155
+ } = await getRuntimeContext('', extensionsState.platform);
3156
+ const extensions = await getMatchingExtensions$2(extensionsState, 'code action', textDocument, assetDir, platform);
3157
+ const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
3158
+ const results = await Promise.all(rpcs.map(rpc => executeRpcLanguageProvider(rpc, 'code action', 'provideCodeActions', textDocument, [offset])));
3159
+ const actions = [];
3160
+ for (const result of results) {
3161
+ if (!Array.isArray(result)) {
3162
+ throw new TypeError('Code action provider result must be an array');
3163
+ }
3164
+ actions.push(...result);
3165
+ }
3166
+ return actions;
3167
+ };
3145
3168
  const executeOrganizeImportsProvider = async (extensionsState, textDocument) => {
3146
3169
  const {
3147
3170
  assetDir,
@@ -4331,6 +4354,7 @@ const commandMap = {
4331
4354
  'Extensions.enable': enableExtension,
4332
4355
  'Extensions.enable2': enableExtension2,
4333
4356
  'Extensions.enableWorkspace': enableWorkspaceExtension,
4357
+ 'Extensions.executeCodeActionProviders': wrapCommand(executeCodeActionProviders),
4334
4358
  'Extensions.executeCommand': wrapCommand(executeCommand),
4335
4359
  'Extensions.executeCompletionProvider': wrapCommand(executeCompletionProvider),
4336
4360
  'Extensions.executeDiagnosticProvider': wrapCommand(executeDiagnosticProvider),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-management-worker",
3
- "version": "4.52.1",
3
+ "version": "4.52.3",
4
4
  "description": "Webworker for the Extension Management functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"