@lvce-editor/extension-host-worker 8.19.0 → 8.24.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.
- package/dist/extension-api/index.js +470 -52
- package/dist/extension-api/parts/Activation/Activation.js +4 -2
- package/dist/extension-api/parts/Diagnostic/Diagnostic.js +10 -0
- package/dist/extension-api/parts/DiagnosticProvider/DiagnosticProvider.js +0 -0
- package/dist/extension-api/parts/DiagnosticProviderRegistry/DiagnosticProviderRegistry.js +66 -0
- package/dist/extension-api/parts/DiagnosticProviderRegistrySnapshot/DiagnosticProviderRegistrySnapshot.js +0 -0
- package/dist/extension-api/parts/DiagnosticResult/DiagnosticResult.js +0 -0
- package/dist/extension-api/parts/DiagnosticTextDocument/DiagnosticTextDocument.js +0 -0
- package/dist/extension-api/parts/ExecuteCommand/ExecuteCommand.js +2 -2
- package/dist/extension-api/parts/ExecuteDiagnosticProvider/ExecuteDiagnosticProvider.js +4 -0
- package/dist/extension-api/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.js +9 -1
- package/dist/extension-api/parts/GetDiagnosticProviderRegistrySnapshot/GetDiagnosticProviderRegistrySnapshot.js +4 -0
- package/dist/extension-api/parts/NotifyStatusBarChange/NotifyStatusBarChange.js +2 -2
- package/dist/extension-api/parts/OutputChannel/OutputChannel.js +71 -0
- package/dist/extension-api/parts/OutputChannelHandle/OutputChannelHandle.js +0 -0
- package/dist/extension-api/parts/OutputChannelRegistrySnapshot/OutputChannelRegistrySnapshot.js +0 -0
- package/dist/extension-api/parts/QuickPick/QuickPick.js +2 -2
- package/dist/extension-api/parts/RegisterDiagnosticProvider/RegisterDiagnosticProvider.js +4 -0
- package/dist/extension-api/parts/RegisteredDiagnosticProvider/RegisteredDiagnosticProvider.js +0 -0
- package/dist/extension-api/parts/RegisteredOutputChannel/RegisteredOutputChannel.js +0 -0
- package/dist/extension-api/parts/ResetDiagnosticProviderRegistry/ResetDiagnosticProviderRegistry.js +4 -0
- package/dist/extension-api/parts/View/View.js +0 -0
- package/dist/extension-api/parts/ViewRegistry/ViewRegistry.js +55 -0
- package/dist/extensionHostWorkerMain.js +142 -45
- package/extension-api/dist/index.d.ts +8 -0
- package/extension-api/dist/index.js +3 -0
- package/extension-api/dist/parts/Activation/Activation.js +4 -2
- package/extension-api/dist/parts/CommandMap/CommandMap.d.ts +5 -0
- package/extension-api/dist/parts/Diagnostic/Diagnostic.d.ts +9 -0
- package/extension-api/dist/parts/Diagnostic/Diagnostic.js +4 -0
- package/extension-api/dist/parts/DiagnosticProvider/DiagnosticProvider.d.ts +7 -0
- package/extension-api/dist/parts/DiagnosticProvider/DiagnosticProvider.js +1 -0
- package/extension-api/dist/parts/DiagnosticProviderRegistry/DiagnosticProviderRegistry.d.ts +12 -0
- package/extension-api/dist/parts/DiagnosticProviderRegistry/DiagnosticProviderRegistry.js +58 -0
- package/extension-api/dist/parts/DiagnosticProviderRegistrySnapshot/DiagnosticProviderRegistrySnapshot.d.ts +4 -0
- package/extension-api/dist/parts/DiagnosticProviderRegistrySnapshot/DiagnosticProviderRegistrySnapshot.js +1 -0
- package/extension-api/dist/parts/DiagnosticResult/DiagnosticResult.d.ts +11 -0
- package/extension-api/dist/parts/DiagnosticResult/DiagnosticResult.js +1 -0
- package/extension-api/dist/parts/DiagnosticTextDocument/DiagnosticTextDocument.d.ts +6 -0
- package/extension-api/dist/parts/DiagnosticTextDocument/DiagnosticTextDocument.js +1 -0
- package/extension-api/dist/parts/ExecuteCommand/ExecuteCommand.js +2 -2
- package/extension-api/dist/parts/ExecuteDiagnosticProvider/ExecuteDiagnosticProvider.d.ts +1 -0
- package/extension-api/dist/parts/ExecuteDiagnosticProvider/ExecuteDiagnosticProvider.js +1 -0
- package/extension-api/dist/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.d.ts +5 -0
- package/extension-api/dist/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.js +8 -0
- package/extension-api/dist/parts/ExtensionApiWorkerCommandMap/ExtensionApiWorkerCommandMap.d.ts +5 -0
- package/extension-api/dist/parts/GetDiagnosticProviderRegistrySnapshot/GetDiagnosticProviderRegistrySnapshot.d.ts +1 -0
- package/extension-api/dist/parts/GetDiagnosticProviderRegistrySnapshot/GetDiagnosticProviderRegistrySnapshot.js +1 -0
- package/extension-api/dist/parts/NotifyStatusBarChange/NotifyStatusBarChange.js +2 -2
- package/extension-api/dist/parts/OutputChannel/OutputChannel.d.ts +9 -0
- package/extension-api/dist/parts/OutputChannel/OutputChannel.js +64 -0
- package/extension-api/dist/parts/OutputChannelHandle/OutputChannelHandle.d.ts +6 -0
- package/extension-api/dist/parts/OutputChannelHandle/OutputChannelHandle.js +1 -0
- package/extension-api/dist/parts/OutputChannelRegistrySnapshot/OutputChannelRegistrySnapshot.d.ts +4 -0
- package/extension-api/dist/parts/OutputChannelRegistrySnapshot/OutputChannelRegistrySnapshot.js +1 -0
- package/extension-api/dist/parts/QuickPick/QuickPick.js +2 -2
- package/extension-api/dist/parts/RegisterDiagnosticProvider/RegisterDiagnosticProvider.d.ts +1 -0
- package/extension-api/dist/parts/RegisterDiagnosticProvider/RegisterDiagnosticProvider.js +1 -0
- package/extension-api/dist/parts/RegisteredDiagnosticProvider/RegisteredDiagnosticProvider.d.ts +7 -0
- package/extension-api/dist/parts/RegisteredDiagnosticProvider/RegisteredDiagnosticProvider.js +1 -0
- package/extension-api/dist/parts/RegisteredOutputChannel/RegisteredOutputChannel.d.ts +3 -0
- package/extension-api/dist/parts/RegisteredOutputChannel/RegisteredOutputChannel.js +1 -0
- package/extension-api/dist/parts/ResetDiagnosticProviderRegistry/ResetDiagnosticProviderRegistry.d.ts +1 -0
- package/extension-api/dist/parts/ResetDiagnosticProviderRegistry/ResetDiagnosticProviderRegistry.js +1 -0
- package/extension-api/dist/parts/View/View.d.ts +14 -0
- package/extension-api/dist/parts/View/View.js +1 -0
- package/extension-api/dist/parts/ViewRegistry/ViewRegistry.d.ts +6 -0
- package/extension-api/dist/parts/ViewRegistry/ViewRegistry.js +49 -0
- package/extension-api/package.json +3 -2
- package/extension-api/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/extension-api/parts/Rpc/Rpc.js +0 -14
- package/extension-api/dist/parts/Rpc/Rpc.d.ts +0 -3
- package/extension-api/dist/parts/Rpc/Rpc.js +0 -10
|
@@ -1407,7 +1407,7 @@ const ensureError = input => {
|
|
|
1407
1407
|
return input;
|
|
1408
1408
|
};
|
|
1409
1409
|
|
|
1410
|
-
const state$
|
|
1410
|
+
const state$c = {
|
|
1411
1411
|
/** @type{any[]} */
|
|
1412
1412
|
onDidChangeTextDocumentListeners: [],
|
|
1413
1413
|
/** @type{any[]} */
|
|
@@ -1417,19 +1417,19 @@ const state$b = {
|
|
|
1417
1417
|
textDocuments: Object.create(null)
|
|
1418
1418
|
};
|
|
1419
1419
|
const setDocument = (textDocumentId, textDocument) => {
|
|
1420
|
-
state$
|
|
1420
|
+
state$c.textDocuments[textDocumentId] = textDocument;
|
|
1421
1421
|
};
|
|
1422
1422
|
const getDidOpenListeners = () => {
|
|
1423
|
-
return state$
|
|
1423
|
+
return state$c.onDidSaveTextDocumentListeners;
|
|
1424
1424
|
};
|
|
1425
1425
|
const getWillChangeListeners = () => {
|
|
1426
|
-
return state$
|
|
1426
|
+
return state$c.onWillChangeEditorListeners;
|
|
1427
1427
|
};
|
|
1428
1428
|
const getDidChangeListeners = () => {
|
|
1429
|
-
return state$
|
|
1429
|
+
return state$c.onDidChangeTextDocumentListeners;
|
|
1430
1430
|
};
|
|
1431
1431
|
const getDocument = textDocumentId => {
|
|
1432
|
-
return state$
|
|
1432
|
+
return state$c.textDocuments[textDocumentId];
|
|
1433
1433
|
};
|
|
1434
1434
|
|
|
1435
1435
|
const getOffset$1 = (textDocument, position) => {
|
|
@@ -1926,7 +1926,7 @@ const executeOrganizeImports = async uid => {
|
|
|
1926
1926
|
return edits;
|
|
1927
1927
|
};
|
|
1928
1928
|
|
|
1929
|
-
const state$
|
|
1929
|
+
const state$b = {
|
|
1930
1930
|
commands: Object.create(null)
|
|
1931
1931
|
};
|
|
1932
1932
|
const getCommandDisplay = command => {
|
|
@@ -1949,10 +1949,10 @@ const registerCommand = command => {
|
|
|
1949
1949
|
if (!command.execute) {
|
|
1950
1950
|
throw new Error('command is missing execute function');
|
|
1951
1951
|
}
|
|
1952
|
-
if (command.id in state$
|
|
1952
|
+
if (command.id in state$b.commands) {
|
|
1953
1953
|
throw new Error(`command cannot be registered multiple times`);
|
|
1954
1954
|
}
|
|
1955
|
-
state$
|
|
1955
|
+
state$b.commands[command.id] = command;
|
|
1956
1956
|
} catch (error) {
|
|
1957
1957
|
const commandDisplayId = getCommandDisplay(command);
|
|
1958
1958
|
throw new VError(error, `Failed to register command${commandDisplayId}`);
|
|
@@ -1960,7 +1960,7 @@ const registerCommand = command => {
|
|
|
1960
1960
|
};
|
|
1961
1961
|
const executeCommand$1 = async (id, ...args) => {
|
|
1962
1962
|
try {
|
|
1963
|
-
const command = state$
|
|
1963
|
+
const command = state$b.commands[id];
|
|
1964
1964
|
if (!command) {
|
|
1965
1965
|
throw new Error(`command ${id} not found`);
|
|
1966
1966
|
}
|
|
@@ -1975,7 +1975,7 @@ const executeCommand$1 = async (id, ...args) => {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
};
|
|
1977
1977
|
const getRegisteredCommandIds$1 = () => {
|
|
1978
|
-
return Object.values(state$
|
|
1978
|
+
return Object.values(state$b.commands).map(command => command.id);
|
|
1979
1979
|
};
|
|
1980
1980
|
|
|
1981
1981
|
const {
|
|
@@ -1991,7 +1991,7 @@ const {
|
|
|
1991
1991
|
const {
|
|
1992
1992
|
executeCompletionProvider,
|
|
1993
1993
|
executeresolveCompletionItemProvider,
|
|
1994
|
-
getProviders: getProviders$
|
|
1994
|
+
getProviders: getProviders$3,
|
|
1995
1995
|
registerCompletionProvider} = create$6({
|
|
1996
1996
|
additionalMethodNames: [
|
|
1997
1997
|
// @ts-ignore
|
|
@@ -2012,28 +2012,28 @@ const {
|
|
|
2012
2012
|
}
|
|
2013
2013
|
});
|
|
2014
2014
|
const getRegisteredCompletionProviderIds$1 = () => {
|
|
2015
|
-
return getProviders$
|
|
2015
|
+
return getProviders$3().map(provider => provider.id);
|
|
2016
2016
|
};
|
|
2017
2017
|
|
|
2018
|
-
const state$
|
|
2018
|
+
const state$a = {
|
|
2019
2019
|
configuration: Object.create(null)
|
|
2020
2020
|
};
|
|
2021
2021
|
const getConfiguration = key => {
|
|
2022
|
-
return state$
|
|
2022
|
+
return state$a.configuration[key] ?? '';
|
|
2023
2023
|
};
|
|
2024
2024
|
const setConfigurations = preferences => {
|
|
2025
|
-
state$
|
|
2025
|
+
state$a.configuration = preferences;
|
|
2026
2026
|
};
|
|
2027
2027
|
|
|
2028
2028
|
const {
|
|
2029
2029
|
invoke: invoke$2
|
|
2030
2030
|
} = DebugWorker;
|
|
2031
2031
|
|
|
2032
|
-
const state$
|
|
2032
|
+
const state$9 = {
|
|
2033
2033
|
debugProviderMap: Object.create(null)
|
|
2034
2034
|
};
|
|
2035
2035
|
const getDebugProvider = id => {
|
|
2036
|
-
const provider = state$
|
|
2036
|
+
const provider = state$9.debugProviderMap[id];
|
|
2037
2037
|
if (!provider) {
|
|
2038
2038
|
// @ts-ignore
|
|
2039
2039
|
throw new VError(`no debug provider "${id}" found`);
|
|
@@ -2044,7 +2044,7 @@ const registerDebugProvider = debugProvider => {
|
|
|
2044
2044
|
if (!debugProvider.id) {
|
|
2045
2045
|
throw new Error('Failed to register debug system provider: missing id');
|
|
2046
2046
|
}
|
|
2047
|
-
state$
|
|
2047
|
+
state$9.debugProviderMap[debugProvider.id] = debugProvider;
|
|
2048
2048
|
};
|
|
2049
2049
|
const handlePaused = async params => {
|
|
2050
2050
|
// @ts-ignore
|
|
@@ -2236,8 +2236,8 @@ const {
|
|
|
2236
2236
|
|
|
2237
2237
|
const {
|
|
2238
2238
|
executeDiagnosticProvider,
|
|
2239
|
-
|
|
2240
|
-
} = create$6({
|
|
2239
|
+
getProviders: getProviders$2,
|
|
2240
|
+
registerDiagnosticProvider} = create$6({
|
|
2241
2241
|
name: 'Diagnostic',
|
|
2242
2242
|
resultShape: {
|
|
2243
2243
|
items: {
|
|
@@ -2246,6 +2246,9 @@ const {
|
|
|
2246
2246
|
type: Array$1
|
|
2247
2247
|
}
|
|
2248
2248
|
});
|
|
2249
|
+
const getRegisteredDiagnosticProviderIds$1 = () => {
|
|
2250
|
+
return getProviders$2().map(provider => provider.id);
|
|
2251
|
+
};
|
|
2249
2252
|
|
|
2250
2253
|
const RendererWorker = 1;
|
|
2251
2254
|
|
|
@@ -3078,23 +3081,25 @@ const getRemoteUrlForWebView = async (uri, options = {}) => {
|
|
|
3078
3081
|
const isFileProtocol = protocol => {
|
|
3079
3082
|
return !protocol || protocol === 'file';
|
|
3080
3083
|
};
|
|
3084
|
+
const getRemotePath = uri => {
|
|
3085
|
+
const withoutPrefix = uri.startsWith('file://') ? uri.slice('file://'.length) : uri;
|
|
3086
|
+
const normalized = withoutPrefix.replaceAll('\\', '/');
|
|
3087
|
+
if (normalized.startsWith('/')) {
|
|
3088
|
+
return normalized;
|
|
3089
|
+
}
|
|
3090
|
+
return `/${normalized}`;
|
|
3091
|
+
};
|
|
3081
3092
|
const getRemoteUrlSync = uri => {
|
|
3082
3093
|
const protocol = getProtocol(uri);
|
|
3083
3094
|
if (protocol === 'http' || protocol === 'https') {
|
|
3084
3095
|
return uri;
|
|
3085
3096
|
}
|
|
3086
|
-
const
|
|
3097
|
+
const remotePath = getRemotePath(uri);
|
|
3087
3098
|
if (platform === Remote && isFileProtocol(protocol)) {
|
|
3088
|
-
|
|
3089
|
-
return `/remote${withoutPrefix}`;
|
|
3090
|
-
}
|
|
3091
|
-
return `/remote/${withoutPrefix}`;
|
|
3099
|
+
return `/remote${remotePath}`;
|
|
3092
3100
|
}
|
|
3093
3101
|
if (platform === Electron && isFileProtocol(protocol)) {
|
|
3094
|
-
|
|
3095
|
-
return `/remote${withoutPrefix}`;
|
|
3096
|
-
}
|
|
3097
|
-
return `/remote/${withoutPrefix}`;
|
|
3102
|
+
return `/remote${remotePath}`;
|
|
3098
3103
|
}
|
|
3099
3104
|
return '';
|
|
3100
3105
|
};
|
|
@@ -3191,14 +3196,14 @@ const getExtensions = () => {
|
|
|
3191
3196
|
return get$6();
|
|
3192
3197
|
};
|
|
3193
3198
|
|
|
3194
|
-
const state$
|
|
3199
|
+
const state$8 = {
|
|
3195
3200
|
providers: Object.create(null)
|
|
3196
3201
|
};
|
|
3197
3202
|
const registerSourceControlProvider = provider => {
|
|
3198
|
-
state$
|
|
3203
|
+
state$8.providers[provider.id] = provider;
|
|
3199
3204
|
};
|
|
3200
3205
|
const getProvider$1 = providerId => {
|
|
3201
|
-
const provider = state$
|
|
3206
|
+
const provider = state$8.providers[providerId];
|
|
3202
3207
|
if (!provider) {
|
|
3203
3208
|
throw new Error('no source control provider found');
|
|
3204
3209
|
}
|
|
@@ -3266,7 +3271,7 @@ const getFeatures = async providerId => {
|
|
|
3266
3271
|
return {};
|
|
3267
3272
|
};
|
|
3268
3273
|
const add = async path => {
|
|
3269
|
-
const provider = Object.values(state$
|
|
3274
|
+
const provider = Object.values(state$8.providers)[0];
|
|
3270
3275
|
if (!provider) {
|
|
3271
3276
|
return;
|
|
3272
3277
|
}
|
|
@@ -3274,7 +3279,7 @@ const add = async path => {
|
|
|
3274
3279
|
await provider.add(path);
|
|
3275
3280
|
};
|
|
3276
3281
|
const discard = async path => {
|
|
3277
|
-
const provider = Object.values(state$
|
|
3282
|
+
const provider = Object.values(state$8.providers)[0];
|
|
3278
3283
|
if (!provider) {
|
|
3279
3284
|
return;
|
|
3280
3285
|
}
|
|
@@ -3284,7 +3289,7 @@ const discard = async path => {
|
|
|
3284
3289
|
const getEnabledProviderIds = async (scheme, root) => {
|
|
3285
3290
|
string(scheme);
|
|
3286
3291
|
string(root);
|
|
3287
|
-
const providers = Object.values(state$
|
|
3292
|
+
const providers = Object.values(state$8.providers);
|
|
3288
3293
|
const enabledIds = [];
|
|
3289
3294
|
for (const provider of providers) {
|
|
3290
3295
|
// @ts-ignore
|
|
@@ -3318,7 +3323,7 @@ const getIconDefinitions = async providerId => {
|
|
|
3318
3323
|
return [];
|
|
3319
3324
|
};
|
|
3320
3325
|
const getFileDecorations = async (providerId, uris) => {
|
|
3321
|
-
const provider = state$
|
|
3326
|
+
const provider = state$8.providers[providerId];
|
|
3322
3327
|
// @ts-ignore
|
|
3323
3328
|
if (!provider || !provider.getFileDecorations) {
|
|
3324
3329
|
return [];
|
|
@@ -3329,7 +3334,7 @@ const getFileDecorations = async (providerId, uris) => {
|
|
|
3329
3334
|
};
|
|
3330
3335
|
|
|
3331
3336
|
const getStatusBarItems = async () => {
|
|
3332
|
-
const providers = Object.values(state$
|
|
3337
|
+
const providers = Object.values(state$8.providers);
|
|
3333
3338
|
const statusBarItems = [];
|
|
3334
3339
|
for (const provider of providers) {
|
|
3335
3340
|
// @ts-ignore
|
|
@@ -3341,7 +3346,7 @@ const getStatusBarItems = async () => {
|
|
|
3341
3346
|
return statusBarItems;
|
|
3342
3347
|
};
|
|
3343
3348
|
const getStatusBarItems2 = async () => {
|
|
3344
|
-
const sourceProviders = Object.values(state$
|
|
3349
|
+
const sourceProviders = Object.values(state$8.providers);
|
|
3345
3350
|
const statusBarItems = [];
|
|
3346
3351
|
for (const provider of sourceProviders) {
|
|
3347
3352
|
// @ts-ignore
|
|
@@ -3455,7 +3460,7 @@ const {
|
|
|
3455
3460
|
}
|
|
3456
3461
|
});
|
|
3457
3462
|
|
|
3458
|
-
const state$
|
|
3463
|
+
const state$7 = {
|
|
3459
3464
|
textSearchProviders: Object.create(null)
|
|
3460
3465
|
};
|
|
3461
3466
|
const registerTextSearchProvider = textSearchProvider => {
|
|
@@ -3466,14 +3471,14 @@ const registerTextSearchProvider = textSearchProvider => {
|
|
|
3466
3471
|
if (!textSearchProvider.scheme) {
|
|
3467
3472
|
throw new Error('textSearchProvider is missing scheme');
|
|
3468
3473
|
}
|
|
3469
|
-
state$
|
|
3474
|
+
state$7.textSearchProviders[textSearchProvider.scheme] = textSearchProvider;
|
|
3470
3475
|
} catch (error) {
|
|
3471
3476
|
throw new VError(error, 'Failed to register text search provider');
|
|
3472
3477
|
}
|
|
3473
3478
|
};
|
|
3474
3479
|
const executeTextSearchProvider = async (scheme, query) => {
|
|
3475
3480
|
try {
|
|
3476
|
-
const textSearchProvider = state$
|
|
3481
|
+
const textSearchProvider = state$7.textSearchProviders[scheme];
|
|
3477
3482
|
if (!textSearchProvider) {
|
|
3478
3483
|
throw new Error(`No text search provider for ${scheme} found`);
|
|
3479
3484
|
}
|
|
@@ -3505,6 +3510,45 @@ const {
|
|
|
3505
3510
|
}
|
|
3506
3511
|
});
|
|
3507
3512
|
|
|
3513
|
+
const state$6 = {
|
|
3514
|
+
views: Object.create(null)
|
|
3515
|
+
};
|
|
3516
|
+
const getViewDisplay = view => {
|
|
3517
|
+
if (view && typeof view.id === 'string') {
|
|
3518
|
+
return ` ${view.id}`;
|
|
3519
|
+
}
|
|
3520
|
+
return '';
|
|
3521
|
+
};
|
|
3522
|
+
const registerView = view => {
|
|
3523
|
+
try {
|
|
3524
|
+
if (!view) {
|
|
3525
|
+
throw new Error('view is not defined');
|
|
3526
|
+
}
|
|
3527
|
+
if (!view.id) {
|
|
3528
|
+
throw new Error('view is missing id');
|
|
3529
|
+
}
|
|
3530
|
+
if (!view.create) {
|
|
3531
|
+
throw new Error('view is missing create function');
|
|
3532
|
+
}
|
|
3533
|
+
if (view.id in state$6.views) {
|
|
3534
|
+
throw new Error('view cannot be registered multiple times');
|
|
3535
|
+
}
|
|
3536
|
+
state$6.views[view.id] = view;
|
|
3537
|
+
} catch (error) {
|
|
3538
|
+
throw new VError(error, `Failed to register view${getViewDisplay(view)}`);
|
|
3539
|
+
}
|
|
3540
|
+
};
|
|
3541
|
+
const executeViewProvider = async id => {
|
|
3542
|
+
const view = state$6.views[id];
|
|
3543
|
+
if (!view) {
|
|
3544
|
+
throw new Error(`view ${id} not found`);
|
|
3545
|
+
}
|
|
3546
|
+
return view.create();
|
|
3547
|
+
};
|
|
3548
|
+
const getRegisteredViewIds$1 = () => {
|
|
3549
|
+
return Object.values(state$6.views).map(view => view.id);
|
|
3550
|
+
};
|
|
3551
|
+
|
|
3508
3552
|
const webViews = Object.create(null);
|
|
3509
3553
|
const webViewProviders = Object.create(null);
|
|
3510
3554
|
const getProvider = providerId => {
|
|
@@ -3663,6 +3707,7 @@ const api = {
|
|
|
3663
3707
|
executeTabCompletionProvider: executeTabCompletionProvider,
|
|
3664
3708
|
executeTextSearchProvider: executeTextSearchProvider,
|
|
3665
3709
|
executeTypeDefinitionProvider: executeTypeDefinitionProvider,
|
|
3710
|
+
executeViewProvider: executeViewProvider,
|
|
3666
3711
|
exists: existsExternal,
|
|
3667
3712
|
// Errors
|
|
3668
3713
|
FormattingError,
|
|
@@ -3727,6 +3772,8 @@ const api = {
|
|
|
3727
3772
|
registerTextSearchProvider: registerTextSearchProvider,
|
|
3728
3773
|
// Type Definition
|
|
3729
3774
|
registerTypeDefinitionProvider: registerTypeDefinitionProvider,
|
|
3775
|
+
// View
|
|
3776
|
+
registerView: registerView,
|
|
3730
3777
|
// Webview
|
|
3731
3778
|
registerWebViewProvider: registerWebViewProvider,
|
|
3732
3779
|
remove: removeExternal,
|
|
@@ -4255,6 +4302,18 @@ const getManifestHoverProviderIds = extension => {
|
|
|
4255
4302
|
}
|
|
4256
4303
|
return extension.hoverProviders.map(provider => provider.id).filter(id => typeof id === 'string');
|
|
4257
4304
|
};
|
|
4305
|
+
const getManifestDiagnosticProviderIds = extension => {
|
|
4306
|
+
if (!Array.isArray(extension.diagnosticProviders)) {
|
|
4307
|
+
return [];
|
|
4308
|
+
}
|
|
4309
|
+
return extension.diagnosticProviders.map(provider => provider.id).filter(id => typeof id === 'string');
|
|
4310
|
+
};
|
|
4311
|
+
const getManifestViewIds = extension => {
|
|
4312
|
+
if (!Array.isArray(extension.views)) {
|
|
4313
|
+
return [];
|
|
4314
|
+
}
|
|
4315
|
+
return extension.views.map(view => view.id).filter(id => typeof id === 'string');
|
|
4316
|
+
};
|
|
4258
4317
|
const assertUniqueIds = (ids, label) => {
|
|
4259
4318
|
const seen = new Set();
|
|
4260
4319
|
for (const id of ids) {
|
|
@@ -4280,6 +4339,14 @@ const getNewRegisteredHoverProviderIds = beforeHoverProviderIds => {
|
|
|
4280
4339
|
const before = new Set(beforeHoverProviderIds);
|
|
4281
4340
|
return getRegisteredHoverProviderIds$1().filter(providerId => !before.has(providerId));
|
|
4282
4341
|
};
|
|
4342
|
+
const getNewRegisteredDiagnosticProviderIds = beforeDiagnosticProviderIds => {
|
|
4343
|
+
const before = new Set(beforeDiagnosticProviderIds);
|
|
4344
|
+
return getRegisteredDiagnosticProviderIds$1().filter(providerId => !before.has(providerId));
|
|
4345
|
+
};
|
|
4346
|
+
const getNewRegisteredViewIds = beforeViewIds => {
|
|
4347
|
+
const before = new Set(beforeViewIds);
|
|
4348
|
+
return getRegisteredViewIds$1().filter(viewId => !before.has(viewId));
|
|
4349
|
+
};
|
|
4283
4350
|
const getRegisteredCommandIds = () => {
|
|
4284
4351
|
return getRegisteredCommandIds$1();
|
|
4285
4352
|
};
|
|
@@ -4292,6 +4359,12 @@ const getRegisteredFormattingProviderIds = () => {
|
|
|
4292
4359
|
const getRegisteredHoverProviderIds = () => {
|
|
4293
4360
|
return getRegisteredHoverProviderIds$1();
|
|
4294
4361
|
};
|
|
4362
|
+
const getRegisteredDiagnosticProviderIds = () => {
|
|
4363
|
+
return getRegisteredDiagnosticProviderIds$1();
|
|
4364
|
+
};
|
|
4365
|
+
const getRegisteredViewIds = () => {
|
|
4366
|
+
return getRegisteredViewIds$1();
|
|
4367
|
+
};
|
|
4295
4368
|
const validateIsolatedExtensionContribution = (label, manifestIds, registeredIds) => {
|
|
4296
4369
|
assertUniqueIds(manifestIds, label);
|
|
4297
4370
|
const manifestIdSet = new Set(manifestIds);
|
|
@@ -4339,6 +4412,22 @@ const validateIsolatedExtensionHoverProviders = (extension, beforeHoverProviderI
|
|
|
4339
4412
|
const registeredHoverProviderIds = getNewRegisteredHoverProviderIds(beforeHoverProviderIds);
|
|
4340
4413
|
validateIsolatedExtensionContribution('hover provider', manifestHoverProviderIds, registeredHoverProviderIds);
|
|
4341
4414
|
};
|
|
4415
|
+
const validateIsolatedExtensionDiagnosticProviders = (extension, beforeDiagnosticProviderIds) => {
|
|
4416
|
+
if (!extension.isolated) {
|
|
4417
|
+
return;
|
|
4418
|
+
}
|
|
4419
|
+
const manifestDiagnosticProviderIds = getManifestDiagnosticProviderIds(extension);
|
|
4420
|
+
const registeredDiagnosticProviderIds = getNewRegisteredDiagnosticProviderIds(beforeDiagnosticProviderIds);
|
|
4421
|
+
validateIsolatedExtensionContribution('diagnostic provider', manifestDiagnosticProviderIds, registeredDiagnosticProviderIds);
|
|
4422
|
+
};
|
|
4423
|
+
const validateIsolatedExtensionViews = (extension, beforeViewIds) => {
|
|
4424
|
+
if (!extension.isolated) {
|
|
4425
|
+
return;
|
|
4426
|
+
}
|
|
4427
|
+
const manifestViewIds = getManifestViewIds(extension);
|
|
4428
|
+
const registeredViewIds = getNewRegisteredViewIds(beforeViewIds);
|
|
4429
|
+
validateIsolatedExtensionContribution('view', manifestViewIds, registeredViewIds);
|
|
4430
|
+
};
|
|
4342
4431
|
|
|
4343
4432
|
// TODO make activation timeout configurable or remove it.
|
|
4344
4433
|
// some extension might do workspace indexing which could take some time
|
|
@@ -4362,13 +4451,17 @@ const activateExtension2 = async (extensionId, extension, absolutePath) => {
|
|
|
4362
4451
|
const activate = module.main || module.activate;
|
|
4363
4452
|
const beforeCommandIds = getRegisteredCommandIds();
|
|
4364
4453
|
const beforeCompletionProviderIds = getRegisteredCompletionProviderIds();
|
|
4454
|
+
const beforeDiagnosticProviderIds = getRegisteredDiagnosticProviderIds();
|
|
4365
4455
|
const beforeFormattingProviderIds = getRegisteredFormattingProviderIds();
|
|
4366
4456
|
const beforeHoverProviderIds = getRegisteredHoverProviderIds();
|
|
4457
|
+
const beforeViewIds = getRegisteredViewIds();
|
|
4367
4458
|
await Promise.race([activate(extension), rejectAfterTimeout$1(activationTimeout$1, token)]);
|
|
4368
4459
|
validateIsolatedExtensionCommands(extension, beforeCommandIds);
|
|
4369
4460
|
validateIsolatedExtensionCompletionProviders(extension, beforeCompletionProviderIds);
|
|
4461
|
+
validateIsolatedExtensionDiagnosticProviders(extension, beforeDiagnosticProviderIds);
|
|
4370
4462
|
validateIsolatedExtensionFormattingProviders(extension, beforeFormattingProviderIds);
|
|
4371
4463
|
validateIsolatedExtensionHoverProviders(extension, beforeHoverProviderIds);
|
|
4464
|
+
validateIsolatedExtensionViews(extension, beforeViewIds);
|
|
4372
4465
|
const endTime = performance.now();
|
|
4373
4466
|
const time = endTime - startTime;
|
|
4374
4467
|
update(extensionId, {
|
|
@@ -5296,6 +5389,7 @@ const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
|
5296
5389
|
const TextDocumentSyncIncremental = 'ExtensionHostTextDocument.syncIncremental';
|
|
5297
5390
|
const TextSearchExecuteTextSearchProvider = 'ExtensionHostTextSearch.executeTextSearchProvider';
|
|
5298
5391
|
const TypeDefinitionExecuteTypeDefinitionProvider = 'ExtensionHostTypeDefinition.executeTypeDefinitionProvider';
|
|
5392
|
+
const ViewExecute = 'ExtensionHostView.execute';
|
|
5299
5393
|
const WorkspaceSetPath = 'Workspace.setWorkspacePath';
|
|
5300
5394
|
|
|
5301
5395
|
class ExecError extends Error {
|
|
@@ -5766,10 +5860,12 @@ const getWebViewInfo2 = providerId => {
|
|
|
5766
5860
|
};
|
|
5767
5861
|
|
|
5768
5862
|
const getRemoteUrl = uri => {
|
|
5769
|
-
|
|
5770
|
-
|
|
5863
|
+
const withoutPrefix = uri.startsWith('file://') ? uri.slice('file://'.length) : uri;
|
|
5864
|
+
const normalized = withoutPrefix.replaceAll('\\', '/');
|
|
5865
|
+
if (normalized.startsWith('/')) {
|
|
5866
|
+
return `/remote${normalized}`;
|
|
5771
5867
|
}
|
|
5772
|
-
return `/remote/${
|
|
5868
|
+
return `/remote/${normalized}`;
|
|
5773
5869
|
};
|
|
5774
5870
|
|
|
5775
5871
|
const getWebViewsFromExtensions = extensions => {
|
|
@@ -6511,6 +6607,7 @@ const commandMap = {
|
|
|
6511
6607
|
[TextDocumentSyncIncremental]: syncIncremental,
|
|
6512
6608
|
[TextSearchExecuteTextSearchProvider]: executeTextSearchProvider,
|
|
6513
6609
|
[TypeDefinitionExecuteTypeDefinitionProvider]: executeTypeDefinitionProvider,
|
|
6610
|
+
[ViewExecute]: executeViewProvider,
|
|
6514
6611
|
[WorkspaceSetPath]: setWorkspacePath,
|
|
6515
6612
|
'ExtensionHostDebug.evaluate': evaluate,
|
|
6516
6613
|
'ExtensionHostDebug.getCallStack': getCallStack,
|
|
@@ -3,18 +3,26 @@ export { executeCommand } from './parts/ExecuteCommand/ExecuteCommand.ts';
|
|
|
3
3
|
export { showQuickPick } from './parts/QuickPick/QuickPick.ts';
|
|
4
4
|
export { registerCommand } from './parts/CommandRegistry/CommandRegistry.ts';
|
|
5
5
|
export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from './parts/Completion/Completion.ts';
|
|
6
|
+
export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from './parts/Diagnostic/Diagnostic.ts';
|
|
6
7
|
export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from './parts/Formatting/Formatting.ts';
|
|
7
8
|
export { executeHoverProvider, getHoverProviderRegistrySnapshot, registerHoverProvider, resetHoverProviderRegistry } from './parts/Hover/Hover.ts';
|
|
9
|
+
export { executeViewProvider, getViewRegistrySnapshot, registerView, resetViewRegistry } from './parts/ViewRegistry/ViewRegistry.ts';
|
|
10
|
+
export { createOutputChannel, getOutputChannelRegistrySnapshot, resetOutputChannelRegistry } from './parts/OutputChannel/OutputChannel.ts';
|
|
8
11
|
export { getStatusBarItemProviderRegistrySnapshot, registerStatusBarItemProvider, resetStatusBarItemProviderRegistry, } from './parts/StatusBar/StatusBar.ts';
|
|
12
|
+
export type { RegisteredView, View, ViewRegistrySnapshot } from './parts/View/View.ts';
|
|
9
13
|
export { handleExtensionManagementMessagePort } from './parts/HandleExtensionManagementMessagePort/HandleExtensionManagementMessagePort.ts';
|
|
10
14
|
export type { Command } from './parts/Command/Command.ts';
|
|
11
15
|
export type { CommandCallback } from './parts/CommandCallback/CommandCallback.ts';
|
|
12
16
|
export type { CommandRegistrySnapshot } from './parts/CommandRegistrySnapshot/CommandRegistrySnapshot.ts';
|
|
13
17
|
export type { CompletionItem, CompletionProvider, CompletionProviderRegistrySnapshot, RegisteredCompletionProvider, } from './parts/Completion/Completion.ts';
|
|
18
|
+
export type { Diagnostic, DiagnosticProvider, DiagnosticProviderRegistrySnapshot, RegisteredDiagnosticProvider, } from './parts/Diagnostic/Diagnostic.ts';
|
|
14
19
|
export type { Disposable } from './parts/Disposable/Disposable.ts';
|
|
15
20
|
export type { FormattingEdit, FormattingProvider, FormattingProviderRegistrySnapshot, RegisteredFormattingProvider, } from './parts/Formatting/Formatting.ts';
|
|
16
21
|
export type { HandleExtensionManagementMessagePortOptions } from './parts/HandleExtensionManagementMessagePort/HandleExtensionManagementMessagePort.ts';
|
|
17
22
|
export type { HoverProvider, HoverProviderRegistrySnapshot, HoverResult, RegisteredHoverProvider } from './parts/Hover/Hover.ts';
|
|
23
|
+
export type { OutputChannel } from './parts/OutputChannelHandle/OutputChannelHandle.ts';
|
|
24
|
+
export type { OutputChannelRegistrySnapshot } from './parts/OutputChannelRegistrySnapshot/OutputChannelRegistrySnapshot.ts';
|
|
25
|
+
export type { RegisteredOutputChannel } from './parts/RegisteredOutputChannel/RegisteredOutputChannel.ts';
|
|
18
26
|
export type { QuickPickItem } from './parts/QuickPickItem/QuickPickItem.ts';
|
|
19
27
|
export type { ShowQuickPickOptions } from './parts/ShowQuickPickOptions/ShowQuickPickOptions.ts';
|
|
20
28
|
export type { StatusBarItem, StatusBarItemProvider, StatusBarItemProviderHandle, StatusBarItemProviderRegistrySnapshot, } from './parts/StatusBar/StatusBar.ts';
|
|
@@ -3,7 +3,10 @@ export { executeCommand } from "./parts/ExecuteCommand/ExecuteCommand.js";
|
|
|
3
3
|
export { showQuickPick } from "./parts/QuickPick/QuickPick.js";
|
|
4
4
|
export { registerCommand } from "./parts/CommandRegistry/CommandRegistry.js";
|
|
5
5
|
export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from "./parts/Completion/Completion.js";
|
|
6
|
+
export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from "./parts/Diagnostic/Diagnostic.js";
|
|
6
7
|
export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from "./parts/Formatting/Formatting.js";
|
|
7
8
|
export { executeHoverProvider, getHoverProviderRegistrySnapshot, registerHoverProvider, resetHoverProviderRegistry } from "./parts/Hover/Hover.js";
|
|
9
|
+
export { executeViewProvider, getViewRegistrySnapshot, registerView, resetViewRegistry } from "./parts/ViewRegistry/ViewRegistry.js";
|
|
10
|
+
export { createOutputChannel, getOutputChannelRegistrySnapshot, resetOutputChannelRegistry } from "./parts/OutputChannel/OutputChannel.js";
|
|
8
11
|
export { getStatusBarItemProviderRegistrySnapshot, registerStatusBarItemProvider, resetStatusBarItemProviderRegistry, } from "./parts/StatusBar/StatusBar.js";
|
|
9
12
|
export { handleExtensionManagementMessagePort } from "./parts/HandleExtensionManagementMessagePort/HandleExtensionManagementMessagePort.js";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { ExtensionManagementWorker } from '@lvce-editor/rpc-registry';
|
|
1
2
|
import { listen } from "../ExtensionApiWorkerListen/ExtensionApiWorkerListen.js";
|
|
2
|
-
import
|
|
3
|
+
import { activateOutputChannels } from "../OutputChannel/OutputChannel.js";
|
|
3
4
|
let rpcPromise;
|
|
4
5
|
export const activate = async () => {
|
|
5
6
|
if (!rpcPromise) {
|
|
6
7
|
rpcPromise = listen();
|
|
7
8
|
}
|
|
8
9
|
const rpc = await rpcPromise;
|
|
9
|
-
|
|
10
|
+
ExtensionManagementWorker.set(rpc);
|
|
11
|
+
activateOutputChannels();
|
|
10
12
|
};
|
|
@@ -2,12 +2,17 @@ export declare const commandMap: {
|
|
|
2
2
|
initialize(type: string, port: MessagePort): Promise<void>;
|
|
3
3
|
'ExtensionApi.executeCommand': (id: string, ...args: readonly unknown[]) => Promise<unknown>;
|
|
4
4
|
'ExtensionApi.executeCompletionProvider': (textDocument: import("../CompletionTextDocument/CompletionTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<readonly import("../CompletionItem/CompletionItem.ts").CompletionItem[]>;
|
|
5
|
+
'ExtensionApi.executeDiagnosticProvider': (textDocument: import("../DiagnosticTextDocument/DiagnosticTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../DiagnosticResult/DiagnosticResult.ts").Diagnostic[]>;
|
|
5
6
|
'ExtensionApi.executeFormattingProvider': (textDocument: import("../FormattingTextDocument/FormattingTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../FormattingEdit/FormattingEdit.ts").FormattingEdit[]>;
|
|
6
7
|
'ExtensionApi.executeHoverProvider': (textDocument: import("../HoverTextDocument/HoverTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<import("../HoverResult/HoverResult.ts").HoverResult | undefined>;
|
|
7
8
|
'ExtensionApi.executeResolveCompletionItemProvider': (textDocument: import("../CompletionTextDocument/CompletionTextDocument.ts").TextDocument, offset: number, name: string, completionItem: import("../CompletionItem/CompletionItem.ts").CompletionItem, ...args: readonly unknown[]) => Promise<import("../CompletionItem/CompletionItem.ts").CompletionItem | undefined>;
|
|
9
|
+
'ExtensionApi.executeViewProvider': (id: string) => unknown;
|
|
8
10
|
'ExtensionApi.getCommandRegistrySnapshot': () => import("../CommandRegistrySnapshot/CommandRegistrySnapshot.ts").CommandRegistrySnapshot;
|
|
9
11
|
'ExtensionApi.getCompletionProviderRegistrySnapshot': () => import("../CompletionProviderRegistrySnapshot/CompletionProviderRegistrySnapshot.ts").CompletionProviderRegistrySnapshot;
|
|
12
|
+
'ExtensionApi.getDiagnosticProviderRegistrySnapshot': () => import("../DiagnosticProviderRegistrySnapshot/DiagnosticProviderRegistrySnapshot.ts").DiagnosticProviderRegistrySnapshot;
|
|
10
13
|
'ExtensionApi.getFormattingProviderRegistrySnapshot': () => import("../FormattingProviderRegistrySnapshot/FormattingProviderRegistrySnapshot.ts").FormattingProviderRegistrySnapshot;
|
|
11
14
|
'ExtensionApi.getHoverProviderRegistrySnapshot': () => import("../HoverProviderRegistrySnapshot/HoverProviderRegistrySnapshot.ts").HoverProviderRegistrySnapshot;
|
|
15
|
+
'ExtensionApi.getOutputChannelRegistrySnapshot': () => import("../OutputChannelRegistrySnapshot/OutputChannelRegistrySnapshot.ts").OutputChannelRegistrySnapshot;
|
|
12
16
|
'ExtensionApi.getStatusBarItems': () => readonly import("../StatusBarItem/StatusBarItem.ts").StatusBarItem[];
|
|
17
|
+
'ExtensionApi.getViewRegistrySnapshot': () => import("../View/View.ts").ViewRegistrySnapshot;
|
|
13
18
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { executeDiagnosticProvider } from '../ExecuteDiagnosticProvider/ExecuteDiagnosticProvider.ts';
|
|
2
|
+
export { getDiagnosticProviderRegistrySnapshot } from '../GetDiagnosticProviderRegistrySnapshot/GetDiagnosticProviderRegistrySnapshot.ts';
|
|
3
|
+
export { registerDiagnosticProvider } from '../RegisterDiagnosticProvider/RegisterDiagnosticProvider.ts';
|
|
4
|
+
export { resetDiagnosticProviderRegistry } from '../ResetDiagnosticProviderRegistry/ResetDiagnosticProviderRegistry.ts';
|
|
5
|
+
export type { Diagnostic } from '../DiagnosticResult/DiagnosticResult.ts';
|
|
6
|
+
export type { DiagnosticProvider } from '../DiagnosticProvider/DiagnosticProvider.ts';
|
|
7
|
+
export type { DiagnosticProviderRegistrySnapshot } from '../DiagnosticProviderRegistrySnapshot/DiagnosticProviderRegistrySnapshot.ts';
|
|
8
|
+
export type { RegisteredDiagnosticProvider } from '../RegisteredDiagnosticProvider/RegisteredDiagnosticProvider.ts';
|
|
9
|
+
export type { TextDocument } from '../DiagnosticTextDocument/DiagnosticTextDocument.ts';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { executeDiagnosticProvider } from "../ExecuteDiagnosticProvider/ExecuteDiagnosticProvider.js";
|
|
2
|
+
export { getDiagnosticProviderRegistrySnapshot } from "../GetDiagnosticProviderRegistrySnapshot/GetDiagnosticProviderRegistrySnapshot.js";
|
|
3
|
+
export { registerDiagnosticProvider } from "../RegisterDiagnosticProvider/RegisterDiagnosticProvider.js";
|
|
4
|
+
export { resetDiagnosticProviderRegistry } from "../ResetDiagnosticProviderRegistry/ResetDiagnosticProviderRegistry.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Diagnostic } from '../DiagnosticResult/DiagnosticResult.ts';
|
|
2
|
+
import type { TextDocument } from '../DiagnosticTextDocument/DiagnosticTextDocument.ts';
|
|
3
|
+
export interface DiagnosticProvider {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly languageId: string;
|
|
6
|
+
readonly provideDiagnostics: (textDocument: TextDocument, ...args: readonly unknown[]) => readonly Diagnostic[] | Promise<readonly Diagnostic[]>;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DiagnosticProvider } from '../DiagnosticProvider/DiagnosticProvider.ts';
|
|
2
|
+
import type { DiagnosticProviderRegistrySnapshot } from '../DiagnosticProviderRegistrySnapshot/DiagnosticProviderRegistrySnapshot.ts';
|
|
3
|
+
import type { Diagnostic } from '../DiagnosticResult/DiagnosticResult.ts';
|
|
4
|
+
import type { TextDocument } from '../DiagnosticTextDocument/DiagnosticTextDocument.ts';
|
|
5
|
+
import type { Disposable } from '../Disposable/Disposable.ts';
|
|
6
|
+
import type { RegisteredDiagnosticProvider } from '../RegisteredDiagnosticProvider/RegisteredDiagnosticProvider.ts';
|
|
7
|
+
export declare const hasDiagnosticProvider: (id: string) => boolean;
|
|
8
|
+
export declare const registerDiagnosticProvider: (provider: DiagnosticProvider) => Disposable;
|
|
9
|
+
export declare const executeDiagnosticProvider: (textDocument: TextDocument, ...args: readonly unknown[]) => Promise<readonly Diagnostic[]>;
|
|
10
|
+
export declare const getDiagnosticProviders: () => RegisteredDiagnosticProvider[];
|
|
11
|
+
export declare const getDiagnosticProviderRegistrySnapshot: () => DiagnosticProviderRegistrySnapshot;
|
|
12
|
+
export declare const resetDiagnosticProviderRegistry: () => void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ExtensionApiError } from "../ExtensionApiError/ExtensionApiError.js";
|
|
2
|
+
import { createProviderRegistry } from "../ProviderRegistry/ProviderRegistry.js";
|
|
3
|
+
const getType = (value) => {
|
|
4
|
+
if (value === null) {
|
|
5
|
+
return 'null';
|
|
6
|
+
}
|
|
7
|
+
if (typeof value === 'string') {
|
|
8
|
+
return JSON.stringify(value);
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
return 'array';
|
|
12
|
+
}
|
|
13
|
+
return typeof value;
|
|
14
|
+
};
|
|
15
|
+
const validateDiagnosticResult = (diagnostics) => {
|
|
16
|
+
if (!Array.isArray(diagnostics)) {
|
|
17
|
+
throw new ExtensionApiError(`invalid diagnostic result: diagnostic must be of type array but is ${getType(diagnostics)}`);
|
|
18
|
+
}
|
|
19
|
+
for (const item of diagnostics) {
|
|
20
|
+
if (!item || typeof item !== 'object' || Array.isArray(item)) {
|
|
21
|
+
throw new ExtensionApiError(`invalid diagnostic result: expected diagnostic item to be of type object but was of type ${getType(item)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return diagnostics;
|
|
25
|
+
};
|
|
26
|
+
const registry = createProviderRegistry({
|
|
27
|
+
mapProvider(provider) {
|
|
28
|
+
return {
|
|
29
|
+
id: provider.id,
|
|
30
|
+
languageId: provider.languageId,
|
|
31
|
+
provideDiagnostics(textDocument, ...args) {
|
|
32
|
+
return provider.provideDiagnostics(textDocument, ...args);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
providerName: 'diagnostic provider',
|
|
37
|
+
requiredMethods: ['provideDiagnostics'],
|
|
38
|
+
requireLanguageId: true,
|
|
39
|
+
});
|
|
40
|
+
export const hasDiagnosticProvider = registry.hasProvider;
|
|
41
|
+
export const registerDiagnosticProvider = (provider) => {
|
|
42
|
+
const registeredProvider = registry.registerProvider(provider);
|
|
43
|
+
return {
|
|
44
|
+
dispose() {
|
|
45
|
+
registry.deleteProvider(registeredProvider.id);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export const executeDiagnosticProvider = async (textDocument, ...args) => {
|
|
50
|
+
return registry.executeProviderByLanguageId(textDocument.languageId, 'provideDiagnostics', [textDocument, ...args], validateDiagnosticResult);
|
|
51
|
+
};
|
|
52
|
+
export const getDiagnosticProviders = registry.getProviders;
|
|
53
|
+
export const getDiagnosticProviderRegistrySnapshot = () => {
|
|
54
|
+
return {
|
|
55
|
+
providers: registry.getProviders(),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export const resetDiagnosticProviderRegistry = registry.reset;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface Diagnostic {
|
|
2
|
+
readonly code?: number | string;
|
|
3
|
+
readonly columnIndex: number;
|
|
4
|
+
readonly endColumnIndex: number;
|
|
5
|
+
readonly endRowIndex: number;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly rowIndex: number;
|
|
8
|
+
readonly source?: string;
|
|
9
|
+
readonly type: string;
|
|
10
|
+
readonly uri?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|