@lvce-editor/extension-management-worker 4.3.0 → 4.5.0
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.
|
@@ -1448,7 +1448,7 @@ const baseName = path => {
|
|
|
1448
1448
|
const slashIndex = path.lastIndexOf('/');
|
|
1449
1449
|
return path.slice(slashIndex + 1);
|
|
1450
1450
|
};
|
|
1451
|
-
const getExtensionId$
|
|
1451
|
+
const getExtensionId$3 = extension => {
|
|
1452
1452
|
if (extension && extension.id) {
|
|
1453
1453
|
return extension.id;
|
|
1454
1454
|
}
|
|
@@ -1536,7 +1536,7 @@ const activateExtension2 = async (extensionId, extension, absolutePath, extensio
|
|
|
1536
1536
|
status: Activated
|
|
1537
1537
|
});
|
|
1538
1538
|
} catch (error) {
|
|
1539
|
-
const id = getExtensionId$
|
|
1539
|
+
const id = getExtensionId$3(extension);
|
|
1540
1540
|
if (isImportError(error)) {
|
|
1541
1541
|
const actualErrorMessage = await tryToGetActualImportErrorMessage(absolutePath, error);
|
|
1542
1542
|
throw new Error(`Failed to activate extension ${id}: ${actualErrorMessage}`, {
|
|
@@ -1720,10 +1720,6 @@ const getExtensionAbsolutePath = (id, isWeb, isBuiltin, path, relativePath, orig
|
|
|
1720
1720
|
return new URL('/remote' + path + '/' + relativePath, origin).toString();
|
|
1721
1721
|
};
|
|
1722
1722
|
|
|
1723
|
-
const getDynamicWebExtensions = () => {
|
|
1724
|
-
return get$3().webExtensions;
|
|
1725
|
-
};
|
|
1726
|
-
|
|
1727
1723
|
const getJson$1 = async url => {
|
|
1728
1724
|
try {
|
|
1729
1725
|
const response = await fetch(url);
|
|
@@ -1749,7 +1745,9 @@ const getWebExtensions = async assetDir => {
|
|
|
1749
1745
|
}
|
|
1750
1746
|
};
|
|
1751
1747
|
|
|
1752
|
-
|
|
1748
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
1749
|
+
|
|
1750
|
+
const getAllExtensionsWithState = async (extensionsState, assetDir, platform) => {
|
|
1753
1751
|
if (typeof assetDir !== 'string') {
|
|
1754
1752
|
assetDir = await invoke$3('Layout.getAssetDir');
|
|
1755
1753
|
}
|
|
@@ -1758,7 +1756,7 @@ const getAllExtensions = async (assetDir, platform) => {
|
|
|
1758
1756
|
}
|
|
1759
1757
|
string(assetDir);
|
|
1760
1758
|
number(platform);
|
|
1761
|
-
const meta =
|
|
1759
|
+
const meta = extensionsState.webExtensions;
|
|
1762
1760
|
if (platform === Web) {
|
|
1763
1761
|
const webExtensions = await getWebExtensions(assetDir);
|
|
1764
1762
|
return [...webExtensions, ...meta];
|
|
@@ -1767,24 +1765,28 @@ const getAllExtensions = async (assetDir, platform) => {
|
|
|
1767
1765
|
return [...local, ...meta];
|
|
1768
1766
|
};
|
|
1769
1767
|
|
|
1768
|
+
const getAllExtensions = async (assetDir, platform) => {
|
|
1769
|
+
return getAllExtensionsWithState(get$3(), assetDir, platform);
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1770
1772
|
const activatingExtensions = Object.create(null);
|
|
1771
1773
|
const runningExtensions = Object.create(null);
|
|
1772
1774
|
const matchesEvent = (extension, event) => {
|
|
1773
1775
|
return isExtensionIsolated(extension) && Array.isArray(extension.activation) && extension.activation.includes(event);
|
|
1774
1776
|
};
|
|
1775
|
-
const getExtensionId$
|
|
1777
|
+
const getExtensionId$2 = extension => {
|
|
1776
1778
|
return extension.id;
|
|
1777
1779
|
};
|
|
1778
|
-
const getAbsolutePath$
|
|
1779
|
-
return getExtensionAbsolutePath(extension.id, extension.isWeb, extension.builtin, extension.
|
|
1780
|
+
const getAbsolutePath$1 = (extension, assetDir, platform) => {
|
|
1781
|
+
return getExtensionAbsolutePath(extension.id, extension.isWeb, extension.builtin, extension.path || extension.uri, extension.browser, globalThis.location.origin, platform, assetDir);
|
|
1780
1782
|
};
|
|
1781
1783
|
const activateExtension = async (extension, event, assetDir, platform) => {
|
|
1782
|
-
const extensionId = getExtensionId$
|
|
1784
|
+
const extensionId = getExtensionId$2(extension);
|
|
1783
1785
|
if (runningExtensions[extensionId]) {
|
|
1784
1786
|
return;
|
|
1785
1787
|
}
|
|
1786
1788
|
if (!Object.hasOwn(activatingExtensions, extensionId)) {
|
|
1787
|
-
const absolutePath = getAbsolutePath$
|
|
1789
|
+
const absolutePath = getAbsolutePath$1(extension, assetDir, platform);
|
|
1788
1790
|
activatingExtensions[extensionId] = activateExtension3(extension, absolutePath, event, platform).then(() => {
|
|
1789
1791
|
runningExtensions[extensionId] = true;
|
|
1790
1792
|
}).finally(() => {
|
|
@@ -2035,22 +2037,24 @@ const enableExtension = async (id, isTest) => {
|
|
|
2035
2037
|
return enableExtension2(id, oldState.platform);
|
|
2036
2038
|
};
|
|
2037
2039
|
|
|
2038
|
-
|
|
2040
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2041
|
+
|
|
2042
|
+
const getExtensionId$1 = extension => {
|
|
2039
2043
|
return extension.id || interExtensionId(extension.uri || extension.path || '');
|
|
2040
2044
|
};
|
|
2041
2045
|
const contributesCommand = (extension, id) => {
|
|
2042
2046
|
return Array.isArray(extension.commands) && extension.commands.some(command => command.id === id);
|
|
2043
2047
|
};
|
|
2044
|
-
const getContributingExtension = async (id, platform) => {
|
|
2045
|
-
const extensions = await
|
|
2048
|
+
const getContributingExtension = async (extensionsState, id, platform) => {
|
|
2049
|
+
const extensions = await getAllExtensionsWithState(extensionsState, '', platform);
|
|
2046
2050
|
return extensions.find(extension => isExtensionIsolated(extension) && contributesCommand(extension, id));
|
|
2047
2051
|
};
|
|
2048
|
-
const getRpcForCommand = async (id, platform) => {
|
|
2049
|
-
const extension = await getContributingExtension(id, platform);
|
|
2052
|
+
const getRpcForCommand = async (extensionsState, id, platform) => {
|
|
2053
|
+
const extension = await getContributingExtension(extensionsState, id, platform);
|
|
2050
2054
|
if (!extension) {
|
|
2051
2055
|
return undefined;
|
|
2052
2056
|
}
|
|
2053
|
-
const extensionId = getExtensionId$
|
|
2057
|
+
const extensionId = getExtensionId$1(extension);
|
|
2054
2058
|
const existingRpc = get$2(extensionId);
|
|
2055
2059
|
if (existingRpc) {
|
|
2056
2060
|
return existingRpc;
|
|
@@ -2061,108 +2065,142 @@ const getRpcForCommand = async (id, platform) => {
|
|
|
2061
2065
|
const executeRendererCommand = (id, args) => {
|
|
2062
2066
|
return invoke$3(id, ...args);
|
|
2063
2067
|
};
|
|
2064
|
-
const executeCommand = async (id, ...args) => {
|
|
2068
|
+
const executeCommand = async (extensionsState, id, ...args) => {
|
|
2065
2069
|
const {
|
|
2066
2070
|
platform
|
|
2067
|
-
} =
|
|
2068
|
-
const rpc = await getRpcForCommand(id, platform);
|
|
2071
|
+
} = extensionsState;
|
|
2072
|
+
const rpc = await getRpcForCommand(extensionsState, id, platform);
|
|
2069
2073
|
if (rpc) {
|
|
2070
2074
|
return rpc.invoke('ExtensionApi.executeCommand', id, ...args);
|
|
2071
2075
|
}
|
|
2072
2076
|
return executeRendererCommand(id, args);
|
|
2073
2077
|
};
|
|
2074
2078
|
|
|
2075
|
-
const
|
|
2076
|
-
return extension.id || interExtensionId(extension.uri || extension.path || '');
|
|
2077
|
-
};
|
|
2078
|
-
const contributesCompletionProvider = (extension, languageId) => {
|
|
2079
|
-
return Array.isArray(extension.completionProviders) && extension.completionProviders.some(provider => provider.languageId === languageId);
|
|
2080
|
-
};
|
|
2081
|
-
const getOrigin$1 = () => {
|
|
2079
|
+
const getOrigin = () => {
|
|
2082
2080
|
return globalThis.location?.origin || 'http://localhost';
|
|
2083
2081
|
};
|
|
2084
|
-
|
|
2085
|
-
|
|
2082
|
+
|
|
2083
|
+
const getExtensionId = extension => {
|
|
2084
|
+
return extension.id || interExtensionId(extension.uri || extension.path || '');
|
|
2086
2085
|
};
|
|
2087
|
-
const
|
|
2088
|
-
|
|
2089
|
-
return extensions.filter(extension => isExtensionIsolated(extension) && contributesCompletionProvider(extension, textDocument.languageId));
|
|
2086
|
+
const getAbsolutePath = (extension, assetDir, platform) => {
|
|
2087
|
+
return getExtensionAbsolutePath(getExtensionId(extension), extension.isWeb === true, extension.builtin === true, extension.path || extension.uri || '', extension.browser || '', getOrigin(), platform, assetDir);
|
|
2090
2088
|
};
|
|
2091
|
-
const getRpc$
|
|
2092
|
-
const extensionId = getExtensionId
|
|
2089
|
+
const getRpc$1 = async (extension, assetDir, platform) => {
|
|
2090
|
+
const extensionId = getExtensionId(extension);
|
|
2093
2091
|
const existingRpc = get$2(extensionId);
|
|
2094
2092
|
if (existingRpc) {
|
|
2095
2093
|
return existingRpc;
|
|
2096
2094
|
}
|
|
2097
|
-
const absolutePath = getAbsolutePath
|
|
2095
|
+
const absolutePath = getAbsolutePath(extension, assetDir, platform);
|
|
2098
2096
|
return getOrCreateIsolatedExtensionHostWorker(extensionId, absolutePath);
|
|
2099
2097
|
};
|
|
2098
|
+
|
|
2099
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2100
|
+
|
|
2101
|
+
const contributesCompletionProvider = (extension, languageId) => {
|
|
2102
|
+
return Array.isArray(extension.completionProviders) && extension.completionProviders.some(provider => provider.languageId === languageId);
|
|
2103
|
+
};
|
|
2104
|
+
const getMatchingExtensions$3 = async (extensionsState, textDocument, assetDir, platform) => {
|
|
2105
|
+
const extensions = await getAllExtensionsWithState(extensionsState, assetDir, platform);
|
|
2106
|
+
return extensions.filter(extension => isExtensionIsolated(extension) && contributesCompletionProvider(extension, textDocument.languageId));
|
|
2107
|
+
};
|
|
2100
2108
|
const executeRpcCompletionProvider = async (rpc, textDocument, args) => {
|
|
2101
2109
|
return rpc.invoke('ExtensionApi.executeCompletionProvider', textDocument, ...args);
|
|
2102
2110
|
};
|
|
2103
2111
|
const executeRpcResolveCompletionItemProvider = async (rpc, textDocument, args) => {
|
|
2104
2112
|
return rpc.invoke('ExtensionApi.executeResolveCompletionItemProvider', textDocument, ...args);
|
|
2105
2113
|
};
|
|
2106
|
-
const executeCompletionProvider = async (textDocument, ...args) => {
|
|
2114
|
+
const executeCompletionProvider = async (extensionsState, textDocument, ...args) => {
|
|
2107
2115
|
const {
|
|
2108
2116
|
platform
|
|
2109
|
-
} =
|
|
2117
|
+
} = extensionsState;
|
|
2110
2118
|
const assetDir = '';
|
|
2111
|
-
const extensions = await getMatchingExtensions$
|
|
2112
|
-
const rpcs = await Promise.all(extensions.map(extension => getRpc$
|
|
2119
|
+
const extensions = await getMatchingExtensions$3(extensionsState, textDocument, assetDir, platform);
|
|
2120
|
+
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
2113
2121
|
const results = await Promise.all(rpcs.map(rpc => executeRpcCompletionProvider(rpc, textDocument, args)));
|
|
2114
2122
|
return results[0] || [];
|
|
2115
2123
|
};
|
|
2116
|
-
const executeResolveCompletionItemProvider = async (textDocument, ...args) => {
|
|
2124
|
+
const executeResolveCompletionItemProvider = async (extensionsState, textDocument, ...args) => {
|
|
2117
2125
|
const {
|
|
2118
2126
|
platform
|
|
2119
|
-
} =
|
|
2127
|
+
} = extensionsState;
|
|
2120
2128
|
const assetDir = '';
|
|
2121
|
-
const extensions = await getMatchingExtensions$
|
|
2122
|
-
const rpcs = await Promise.all(extensions.map(extension => getRpc$
|
|
2129
|
+
const extensions = await getMatchingExtensions$3(extensionsState, textDocument, assetDir, platform);
|
|
2130
|
+
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
2123
2131
|
const results = await Promise.all(rpcs.map(rpc => executeRpcResolveCompletionItemProvider(rpc, textDocument, args)));
|
|
2124
2132
|
return results[0];
|
|
2125
2133
|
};
|
|
2126
2134
|
|
|
2127
|
-
|
|
2128
|
-
|
|
2135
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2136
|
+
|
|
2137
|
+
const contributesDiagnosticProvider = (extension, languageId) => {
|
|
2138
|
+
return Array.isArray(extension.diagnosticProviders) && extension.diagnosticProviders.some(provider => provider.languageId === languageId);
|
|
2129
2139
|
};
|
|
2130
|
-
const
|
|
2131
|
-
|
|
2140
|
+
const getMatchingExtensions$2 = async (extensionsState, textDocument, assetDir, platform) => {
|
|
2141
|
+
const extensions = await getAllExtensionsWithState(extensionsState, assetDir, platform);
|
|
2142
|
+
return extensions.filter(extension => isExtensionIsolated(extension) && contributesDiagnosticProvider(extension, textDocument.languageId));
|
|
2132
2143
|
};
|
|
2133
|
-
const
|
|
2134
|
-
return
|
|
2144
|
+
const executeRpcDiagnosticProvider = async (rpc, textDocument, args) => {
|
|
2145
|
+
return rpc.invoke('ExtensionApi.executeDiagnosticProvider', textDocument, ...args);
|
|
2135
2146
|
};
|
|
2136
|
-
const
|
|
2137
|
-
|
|
2147
|
+
const executeDiagnosticProvider = async (extensionsState, textDocument, ...args) => {
|
|
2148
|
+
const {
|
|
2149
|
+
platform
|
|
2150
|
+
} = extensionsState;
|
|
2151
|
+
const assetDir = '';
|
|
2152
|
+
const extensions = await getMatchingExtensions$2(extensionsState, textDocument, assetDir, platform);
|
|
2153
|
+
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
2154
|
+
const results = await Promise.all(rpcs.map(rpc => executeRpcDiagnosticProvider(rpc, textDocument, args)));
|
|
2155
|
+
return results[0] || [];
|
|
2138
2156
|
};
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2157
|
+
|
|
2158
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2159
|
+
|
|
2160
|
+
const contributesFormattingProvider = (extension, languageId) => {
|
|
2161
|
+
return Array.isArray(extension.formattingProviders) && extension.formattingProviders.some(provider => provider.languageId === languageId);
|
|
2142
2162
|
};
|
|
2143
|
-
const
|
|
2144
|
-
const
|
|
2145
|
-
|
|
2146
|
-
if (existingRpc) {
|
|
2147
|
-
return existingRpc;
|
|
2148
|
-
}
|
|
2149
|
-
const absolutePath = getAbsolutePath(extension, assetDir, platform);
|
|
2150
|
-
return getOrCreateIsolatedExtensionHostWorker(extensionId, absolutePath);
|
|
2163
|
+
const getMatchingExtensions$1 = async (extensionsState, textDocument, assetDir, platform) => {
|
|
2164
|
+
const extensions = await getAllExtensionsWithState(extensionsState, assetDir, platform);
|
|
2165
|
+
return extensions.filter(extension => isExtensionIsolated(extension) && contributesFormattingProvider(extension, textDocument.languageId));
|
|
2151
2166
|
};
|
|
2152
2167
|
const executeRpcFormattingProvider = async (rpc, textDocument, args) => {
|
|
2153
2168
|
return rpc.invoke('ExtensionApi.executeFormattingProvider', textDocument, ...args);
|
|
2154
2169
|
};
|
|
2155
|
-
const executeFormattingProvider = async (textDocument, ...args) => {
|
|
2170
|
+
const executeFormattingProvider = async (extensionsState, textDocument, ...args) => {
|
|
2156
2171
|
const {
|
|
2157
2172
|
platform
|
|
2158
|
-
} =
|
|
2173
|
+
} = extensionsState;
|
|
2159
2174
|
const assetDir = '';
|
|
2160
|
-
const extensions = await getMatchingExtensions(textDocument, assetDir, platform);
|
|
2175
|
+
const extensions = await getMatchingExtensions$1(extensionsState, textDocument, assetDir, platform);
|
|
2161
2176
|
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
2162
2177
|
const results = await Promise.all(rpcs.map(rpc => executeRpcFormattingProvider(rpc, textDocument, args)));
|
|
2163
2178
|
return results[0] || [];
|
|
2164
2179
|
};
|
|
2165
2180
|
|
|
2181
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2182
|
+
|
|
2183
|
+
const contributesHoverProvider = (extension, languageId) => {
|
|
2184
|
+
return Array.isArray(extension.hoverProviders) && extension.hoverProviders.some(provider => provider.languageId === languageId);
|
|
2185
|
+
};
|
|
2186
|
+
const getMatchingExtensions = async (extensionsState, textDocument, assetDir, platform) => {
|
|
2187
|
+
const extensions = await getAllExtensionsWithState(extensionsState, assetDir, platform);
|
|
2188
|
+
return extensions.filter(extension => isExtensionIsolated(extension) && contributesHoverProvider(extension, textDocument.languageId));
|
|
2189
|
+
};
|
|
2190
|
+
const executeRpcHoverProvider = async (rpc, textDocument, args) => {
|
|
2191
|
+
return rpc.invoke('ExtensionApi.executeHoverProvider', textDocument, ...args);
|
|
2192
|
+
};
|
|
2193
|
+
const executeHoverProvider = async (extensionsState, textDocument, ...args) => {
|
|
2194
|
+
const {
|
|
2195
|
+
platform
|
|
2196
|
+
} = extensionsState;
|
|
2197
|
+
const assetDir = '';
|
|
2198
|
+
const extensions = await getMatchingExtensions(extensionsState, textDocument, assetDir, platform);
|
|
2199
|
+
const rpcs = await Promise.all(extensions.map(extension => getRpc$1(extension, assetDir, platform)));
|
|
2200
|
+
const results = await Promise.all(rpcs.map(rpc => executeRpcHoverProvider(rpc, textDocument, args)));
|
|
2201
|
+
return results[0];
|
|
2202
|
+
};
|
|
2203
|
+
|
|
2166
2204
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2167
2205
|
const warn = (...args) => {
|
|
2168
2206
|
console.warn(...args);
|
|
@@ -2389,6 +2427,10 @@ const getColorThemeNames = async (assetDir, platform) => {
|
|
|
2389
2427
|
return colorThemeNames;
|
|
2390
2428
|
};
|
|
2391
2429
|
|
|
2430
|
+
const getDynamicWebExtensions = () => {
|
|
2431
|
+
return get$3().webExtensions;
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2392
2434
|
const getExtension = async (id, assetDir, platform) => {
|
|
2393
2435
|
const allExtensions = await getAllExtensions(assetDir, platform);
|
|
2394
2436
|
for (const extension of allExtensions) {
|
|
@@ -2487,6 +2529,59 @@ const getStatusBarItems = async () => {
|
|
|
2487
2529
|
return results.flat();
|
|
2488
2530
|
};
|
|
2489
2531
|
|
|
2532
|
+
const contributesViews = extension => {
|
|
2533
|
+
return Array.isArray(extension.views) && extension.views.length > 0;
|
|
2534
|
+
};
|
|
2535
|
+
const getManifestView = (extension, id) => {
|
|
2536
|
+
return extension.views?.find(view => view.id === id);
|
|
2537
|
+
};
|
|
2538
|
+
const getIframe = (extension, manifestView, assetDir, platform) => {
|
|
2539
|
+
const iframe = manifestView?.iframe;
|
|
2540
|
+
if (!iframe || typeof iframe.path !== 'string' || iframe.path.length === 0) {
|
|
2541
|
+
return undefined;
|
|
2542
|
+
}
|
|
2543
|
+
return {
|
|
2544
|
+
credentialless: iframe.credentialless !== false,
|
|
2545
|
+
csp: iframe.csp || '',
|
|
2546
|
+
sandbox: Array.isArray(iframe.sandbox) ? iframe.sandbox.filter(item => typeof item === 'string') : ['allow-scripts'],
|
|
2547
|
+
src: getAbsolutePath({
|
|
2548
|
+
...extension,
|
|
2549
|
+
browser: iframe.path
|
|
2550
|
+
}, assetDir, platform)
|
|
2551
|
+
};
|
|
2552
|
+
};
|
|
2553
|
+
const toView = (extension, registeredView, assetDir, platform) => {
|
|
2554
|
+
const id = registeredView.id || '';
|
|
2555
|
+
const manifestView = getManifestView(extension, id);
|
|
2556
|
+
return {
|
|
2557
|
+
extensionId: getExtensionId(extension),
|
|
2558
|
+
icon: registeredView.icon || manifestView?.icon || '',
|
|
2559
|
+
id,
|
|
2560
|
+
iframe: getIframe(extension, manifestView, assetDir, platform),
|
|
2561
|
+
title: registeredView.title || manifestView?.title || id
|
|
2562
|
+
};
|
|
2563
|
+
};
|
|
2564
|
+
const getRpcViewRegistrySnapshot = async rpc => {
|
|
2565
|
+
return rpc.invoke('ExtensionApi.getViewRegistrySnapshot');
|
|
2566
|
+
};
|
|
2567
|
+
const getExtensionViews = async (extension, assetDir, platform) => {
|
|
2568
|
+
const rpc = await getRpc$1(extension, assetDir, platform);
|
|
2569
|
+
const snapshot = await getRpcViewRegistrySnapshot(rpc);
|
|
2570
|
+
if (!Array.isArray(snapshot.views)) {
|
|
2571
|
+
return [];
|
|
2572
|
+
}
|
|
2573
|
+
return snapshot.views.filter(view => view && typeof view.id === 'string').map(view => toView(extension, view, assetDir, platform));
|
|
2574
|
+
};
|
|
2575
|
+
const getViewsFromExtensionWorkers = async (extensions, assetDir, platform) => {
|
|
2576
|
+
const matchingExtensions = extensions.filter(extension => isExtensionIsolated(extension) && contributesViews(extension));
|
|
2577
|
+
const results = await Promise.all(matchingExtensions.map(extension => getExtensionViews(extension, assetDir, platform)));
|
|
2578
|
+
return results.flat();
|
|
2579
|
+
};
|
|
2580
|
+
const getViews = async (assetDir, platform) => {
|
|
2581
|
+
const extensions = await getAllExtensions(assetDir, platform);
|
|
2582
|
+
return getViewsFromExtensionWorkers(extensions, assetDir, platform);
|
|
2583
|
+
};
|
|
2584
|
+
|
|
2490
2585
|
const StatusBarWorker = 200;
|
|
2491
2586
|
|
|
2492
2587
|
const handleMessagePort = async (port, rpcId) => {
|
|
@@ -2542,6 +2637,9 @@ const installExtension = async () => {
|
|
|
2542
2637
|
};
|
|
2543
2638
|
|
|
2544
2639
|
const getRemoteUrl = uri => {
|
|
2640
|
+
if (uri.startsWith('http://') || uri.startsWith('https://')) {
|
|
2641
|
+
return uri;
|
|
2642
|
+
}
|
|
2545
2643
|
if (uri.startsWith('/')) {
|
|
2546
2644
|
return `/remote${uri}`;
|
|
2547
2645
|
}
|
|
@@ -2598,6 +2696,13 @@ const uninstallExtension = async () => {
|
|
|
2598
2696
|
// TODO
|
|
2599
2697
|
};
|
|
2600
2698
|
|
|
2699
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
2700
|
+
|
|
2701
|
+
const wrapCommand = command => {
|
|
2702
|
+
return (...args) => {
|
|
2703
|
+
return command(get$3(), ...args);
|
|
2704
|
+
};
|
|
2705
|
+
};
|
|
2601
2706
|
const commandMap = {
|
|
2602
2707
|
'Extensions.activate2': activateExtension2,
|
|
2603
2708
|
'Extensions.activate3': activateExtension3,
|
|
@@ -2609,10 +2714,12 @@ const commandMap = {
|
|
|
2609
2714
|
'Extensions.disable2': disableExtension2,
|
|
2610
2715
|
'Extensions.enable': enableExtension,
|
|
2611
2716
|
'Extensions.enable2': enableExtension2,
|
|
2612
|
-
'Extensions.executeCommand': executeCommand,
|
|
2613
|
-
'Extensions.executeCompletionProvider': executeCompletionProvider,
|
|
2614
|
-
'Extensions.
|
|
2615
|
-
'Extensions.
|
|
2717
|
+
'Extensions.executeCommand': wrapCommand(executeCommand),
|
|
2718
|
+
'Extensions.executeCompletionProvider': wrapCommand(executeCompletionProvider),
|
|
2719
|
+
'Extensions.executeDiagnosticProvider': wrapCommand(executeDiagnosticProvider),
|
|
2720
|
+
'Extensions.executeFormattingProvider': wrapCommand(executeFormattingProvider),
|
|
2721
|
+
'Extensions.executeHoverProvider': wrapCommand(executeHoverProvider),
|
|
2722
|
+
'Extensions.executeResolveCompletionItemProvider': wrapCommand(executeResolveCompletionItemProvider),
|
|
2616
2723
|
'Extensions.getAllExtensions': getAllExtensions,
|
|
2617
2724
|
'Extensions.getColorThemeCss': getColorThemeCss,
|
|
2618
2725
|
'Extensions.getColorThemeCssFromJson': getColorThemeCssFromJson,
|
|
@@ -2625,6 +2732,7 @@ const commandMap = {
|
|
|
2625
2732
|
'Extensions.getRpcInfo': getRpcInfo,
|
|
2626
2733
|
'Extensions.getRuntimeStatus': getRuntimeStatus,
|
|
2627
2734
|
'Extensions.getStatusBarItems': getStatusBarItems,
|
|
2735
|
+
'Extensions.getViews': getViews,
|
|
2628
2736
|
'Extensions.handleMessagePort': handleMessagePort,
|
|
2629
2737
|
'Extensions.importExtension': importExtension,
|
|
2630
2738
|
'Extensions.initialize': initialize,
|