@theia/plugin-utils 1.77.0-next.99 → 1.78.0-next.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/lib/common/constants.js +12 -15
- package/lib/common/constants.js.map +1 -1
- package/lib/common/constants.spec.js +7 -9
- package/lib/common/constants.spec.js.map +1 -1
- package/lib/common/contribution-types.d.ts +8 -3
- package/lib/common/contribution-types.d.ts.map +1 -1
- package/lib/common/contribution-types.js +5 -7
- package/lib/common/contribution-types.js.map +1 -1
- package/lib/common/manifest-types.d.ts +1 -1
- package/lib/common/manifest-types.d.ts.map +1 -1
- package/lib/common/manifest-types.js +7 -11
- package/lib/common/manifest-types.js.map +1 -1
- package/lib/common/manifest-types.spec.js +7 -9
- package/lib/common/manifest-types.spec.js.map +1 -1
- package/lib/common/package-nls.js +6 -11
- package/lib/common/package-nls.js.map +1 -1
- package/lib/common/package-nls.spec.js +23 -25
- package/lib/common/package-nls.spec.js.map +1 -1
- package/lib/common/plugin-activation-events.d.ts +1 -1
- package/lib/common/plugin-activation-events.d.ts.map +1 -1
- package/lib/common/plugin-activation-events.js +14 -17
- package/lib/common/plugin-activation-events.js.map +1 -1
- package/lib/common/plugin-activation-events.spec.js +14 -16
- package/lib/common/plugin-activation-events.spec.js.map +1 -1
- package/lib/common/plugin-manifest.d.ts +1 -1
- package/lib/common/plugin-manifest.d.ts.map +1 -1
- package/lib/common/plugin-manifest.js +8 -12
- package/lib/common/plugin-manifest.js.map +1 -1
- package/lib/common/plugin-manifest.spec.js +21 -23
- package/lib/common/plugin-manifest.spec.js.map +1 -1
- package/lib/common/plugin-model.d.ts +1 -1
- package/lib/common/plugin-model.d.ts.map +1 -1
- package/lib/common/plugin-model.js +23 -37
- package/lib/common/plugin-model.js.map +1 -1
- package/lib/common/plugin-model.spec.js +66 -69
- package/lib/common/plugin-model.spec.js.map +1 -1
- package/lib/common/protocol-shims.js +3 -6
- package/lib/common/protocol-shims.js.map +1 -1
- package/lib/common/test-helpers.d.ts +2 -2
- package/lib/common/test-helpers.d.ts.map +1 -1
- package/lib/common/test-helpers.js +5 -9
- package/lib/common/test-helpers.js.map +1 -1
- package/lib/common/utils.js +6 -14
- package/lib/common/utils.js.map +1 -1
- package/lib/common/utils.spec.js +25 -27
- package/lib/common/utils.spec.js.map +1 -1
- package/lib/node/normalize-contributions.d.ts +3 -3
- package/lib/node/normalize-contributions.d.ts.map +1 -1
- package/lib/node/normalize-contributions.js +95 -129
- package/lib/node/normalize-contributions.js.map +1 -1
- package/lib/node/normalize-contributions.spec.js +184 -162
- package/lib/node/normalize-contributions.spec.js.map +1 -1
- package/lib/node/package-nls.d.ts +1 -1
- package/lib/node/package-nls.d.ts.map +1 -1
- package/lib/node/package-nls.js +9 -12
- package/lib/node/package-nls.js.map +1 -1
- package/lib/node/plugin-manifest.d.ts +2 -2
- package/lib/node/plugin-manifest.d.ts.map +1 -1
- package/lib/node/plugin-manifest.js +6 -9
- package/lib/node/plugin-manifest.js.map +1 -1
- package/lib/node/plugin-model.d.ts +1 -1
- package/lib/node/plugin-model.d.ts.map +1 -1
- package/lib/node/plugin-model.js +5 -8
- package/lib/node/plugin-model.js.map +1 -1
- package/lib/node/read-grammars.d.ts +2 -2
- package/lib/node/read-grammars.d.ts.map +1 -1
- package/lib/node/read-grammars.js +8 -12
- package/lib/node/read-grammars.js.map +1 -1
- package/lib/node/read-grammars.spec.js +25 -27
- package/lib/node/read-grammars.spec.js.map +1 -1
- package/package.json +11 -3
- package/src/common/constants.spec.ts +1 -1
- package/src/common/contribution-types.ts +9 -3
- package/src/common/manifest-types.spec.ts +1 -1
- package/src/common/manifest-types.ts +2 -2
- package/src/common/package-nls.spec.ts +4 -3
- package/src/common/package-nls.ts +1 -1
- package/src/common/plugin-activation-events.spec.ts +2 -2
- package/src/common/plugin-activation-events.ts +2 -2
- package/src/common/plugin-manifest.spec.ts +6 -5
- package/src/common/plugin-manifest.ts +3 -3
- package/src/common/plugin-model.spec.ts +4 -4
- package/src/common/plugin-model.ts +2 -2
- package/src/common/test-helpers.ts +3 -3
- package/src/common/utils.spec.ts +2 -2
- package/src/node/normalize-contributions.spec.ts +37 -7
- package/src/node/normalize-contributions.ts +15 -7
- package/src/node/package-nls.ts +4 -3
- package/src/node/plugin-manifest.ts +4 -3
- package/src/node/plugin-model.ts +1 -1
- package/src/node/read-grammars.spec.ts +3 -2
- package/src/node/read-grammars.ts +5 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ColorDefinition, type IJSONSchema, type JsonType, type JSONValue, type PreferenceSchema, PreferenceScope, type TaskDefinition } from '../common/protocol-shims';
|
|
2
|
-
import { type IconUrl, type IConfigurationNode, type NormalizeContributionsContext, type NormalizedCommand, type NormalizedCustomEditor, type NormalizedIcon, type NormalizedIconTheme, type NormalizedKeybinding, type NormalizedLanguage, type NormalizedLocalization, type NormalizedSnippet, type NormalizedSubmenu, type NormalizedTerminalProfile, type NormalizedTheme, type NormalizedTranslation, type NormalizedViewContainer, type NormalizedViewWelcome, type RawCommand, type RawCustomEditor, type RawDebugger, type RawKeybinding, type RawLanguage, type RawLocalization, type RawMenu, type RawSubmenu, type RawTaskDefinition, type RawTranslation, type RawView, type RawViewContainer, type RawViewWelcome, type ViewsByLocation, type WalkthroughContribution } from '../common/contribution-types';
|
|
3
|
-
import { type PluginManifest } from '../common/manifest-types';
|
|
1
|
+
import { type ColorDefinition, type IJSONSchema, type JsonType, type JSONValue, type PreferenceSchema, PreferenceScope, type TaskDefinition } from '../common/protocol-shims.js';
|
|
2
|
+
import { type IconUrl, type IConfigurationNode, type NormalizeContributionsContext, type NormalizedCommand, type NormalizedCustomEditor, type NormalizedIcon, type NormalizedIconTheme, type NormalizedKeybinding, type NormalizedLanguage, type NormalizedLocalization, type NormalizedSnippet, type NormalizedSubmenu, type NormalizedTerminalProfile, type NormalizedTheme, type NormalizedTranslation, type NormalizedViewContainer, type NormalizedViewWelcome, type RawCommand, type RawCustomEditor, type RawDebugger, type RawKeybinding, type RawLanguage, type RawLocalization, type RawMenu, type RawSubmenu, type RawTaskDefinition, type RawTranslation, type RawView, type RawViewContainer, type RawViewWelcome, type ViewsByLocation, type WalkthroughContribution } from '../common/contribution-types.js';
|
|
3
|
+
import { type PluginManifest } from '../common/manifest-types.js';
|
|
4
4
|
export declare const colorIdPattern = "^\\w+[.\\w+]*$";
|
|
5
5
|
export declare const iconIdPattern = "^[A-Za-z0-9]+(-[A-Za-z0-9]+)+$";
|
|
6
6
|
/** Maps the view container locations used by VS Code extensions to the Theia shell locations. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-contributions.d.ts","sourceRoot":"","sources":["../../src/node/normalize-contributions.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEH,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,SAAS,EAEd,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,cAAc,EACtB,MAAM,
|
|
1
|
+
{"version":3,"file":"normalize-contributions.d.ts","sourceRoot":"","sources":["../../src/node/normalize-contributions.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEH,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,SAAS,EAEd,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,cAAc,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAQH,KAAK,OAAO,EACZ,KAAK,kBAAkB,EAEvB,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAE1B,KAAK,UAAU,EACf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jE;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAQlD;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,6BAA6B,EAAE,YAAY,EAAE,SAAS,WAAW,EAAE,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAEnK;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,6BAA6B,EAAE,WAAW,EAAE,SAAS,UAAU,EAAE,EAAE,MAAM,EAAE,cAAc,GAAG,iBAAiB,EAAE,CAEhJ;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,6BAA6B,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,iBAAiB,CASjI;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,6BAA6B,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAiChJ;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,EAAE,CAEjF;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAoBlE;AAED,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,MAAM,EAClB,sBAAsB,EAAE,iBAAiB,EACzC,GAAG,CAAC,EAAE,IAAI,CAAC,6BAA6B,EAAE,UAAU,CAAC,GACtD,cAAc,CAchB;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,GAAG,WAAW,CAUnE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// *****************************************************************************
|
|
3
2
|
// Copyright (C) 2015-2021 Red Hat, Inc.
|
|
4
3
|
//
|
|
@@ -14,62 +13,22 @@
|
|
|
14
13
|
//
|
|
15
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
15
|
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.VIEW_CONTAINER_LOCATION_ALIASES = exports.iconIdPattern = exports.colorIdPattern = void 0;
|
|
19
|
-
exports.deriveDefaultForType = deriveDefaultForType;
|
|
20
|
-
exports.getScope = getScope;
|
|
21
|
-
exports.isRawLocalization = isRawLocalization;
|
|
22
|
-
exports.normalizeContributions = normalizeContributions;
|
|
23
|
-
exports.readTerminals = readTerminals;
|
|
24
|
-
exports.readLocalizations = readLocalizations;
|
|
25
|
-
exports.readLocalization = readLocalization;
|
|
26
|
-
exports.readTranslation = readTranslation;
|
|
27
|
-
exports.readWalkthroughs = readWalkthroughs;
|
|
28
|
-
exports.readCommand = readCommand;
|
|
29
|
-
exports.transformIconUrl = transformIconUrl;
|
|
30
|
-
exports.readColors = readColors;
|
|
31
|
-
exports.readThemes = readThemes;
|
|
32
|
-
exports.readIconThemes = readIconThemes;
|
|
33
|
-
exports.readIcons = readIcons;
|
|
34
|
-
exports.readSnippets = readSnippets;
|
|
35
|
-
exports.readConfiguration = readConfiguration;
|
|
36
|
-
exports.readKeybinding = readKeybinding;
|
|
37
|
-
exports.readCustomEditors = readCustomEditors;
|
|
38
|
-
exports.readCustomEditor = readCustomEditor;
|
|
39
|
-
exports.readViewsContainers = readViewsContainers;
|
|
40
|
-
exports.readViewContainer = readViewContainer;
|
|
41
|
-
exports.readViews = readViews;
|
|
42
|
-
exports.readView = readView;
|
|
43
|
-
exports.readViewsWelcome = readViewsWelcome;
|
|
44
|
-
exports.readViewWelcome = readViewWelcome;
|
|
45
|
-
exports.extractPluginViewsIds = extractPluginViewsIds;
|
|
46
|
-
exports.readMenus = readMenus;
|
|
47
|
-
exports.readMenu = readMenu;
|
|
48
|
-
exports.readLanguages = readLanguages;
|
|
49
|
-
exports.readSubmenus = readSubmenus;
|
|
50
|
-
exports.readSubmenu = readSubmenu;
|
|
51
|
-
exports.readLanguage = readLanguage;
|
|
52
|
-
exports.readDebuggers = readDebuggers;
|
|
53
|
-
exports.readDebugger = readDebugger;
|
|
54
|
-
exports.readTaskDefinition = readTaskDefinition;
|
|
55
|
-
exports.toSchema = toSchema;
|
|
56
|
-
const tslib_1 = require("tslib");
|
|
57
16
|
/* eslint-disable @theia/localization-check */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
17
|
+
import { promises as fs } from 'fs';
|
|
18
|
+
import * as path from 'path';
|
|
19
|
+
import * as jsoncparser from 'jsonc-parser';
|
|
20
|
+
import { deepClone, isColorDefaults, isENOENT, isObject, isStringArray } from '../common/utils.js';
|
|
21
|
+
import { ICON_NAME_SEGMENT, PreferenceScope, } from '../common/protocol-shims.js';
|
|
22
|
+
import { CustomEditorPriority, PLUGIN_VIEW_VISIBILITIES, } from '../common/contribution-types.js';
|
|
23
|
+
import { rawContributes } from '../common/manifest-types.js';
|
|
24
|
+
import { UNPUBLISHED } from '../common/constants.js';
|
|
66
25
|
function isPluginUiTheme(value) {
|
|
67
26
|
return value === 'vs' || value === 'vs-dark' || value === 'hc-black' || value === 'hc-light';
|
|
68
27
|
}
|
|
69
|
-
|
|
70
|
-
|
|
28
|
+
export const colorIdPattern = '^\\w+[.\\w+]*$';
|
|
29
|
+
export const iconIdPattern = `^${ICON_NAME_SEGMENT}(-${ICON_NAME_SEGMENT})+$`;
|
|
71
30
|
/** Maps the view container locations used by VS Code extensions to the Theia shell locations. */
|
|
72
|
-
|
|
31
|
+
export const VIEW_CONTAINER_LOCATION_ALIASES = {
|
|
73
32
|
activitybar: 'left',
|
|
74
33
|
panel: 'bottom',
|
|
75
34
|
secondarySidebar: 'right',
|
|
@@ -78,7 +37,7 @@ exports.VIEW_CONTAINER_LOCATION_ALIASES = {
|
|
|
78
37
|
/**
|
|
79
38
|
* Mirrors VS Code's `ConfigurationRegistry.getDefaultValue(type)`: plugins expect typed-but-defaultless properties to read as a type-based default.
|
|
80
39
|
*/
|
|
81
|
-
function deriveDefaultForType(type) {
|
|
40
|
+
export function deriveDefaultForType(type) {
|
|
82
41
|
const t = Array.isArray(type) ? type[0] : type;
|
|
83
42
|
switch (t) {
|
|
84
43
|
case 'boolean': return false;
|
|
@@ -91,17 +50,17 @@ function deriveDefaultForType(type) {
|
|
|
91
50
|
default: return null;
|
|
92
51
|
}
|
|
93
52
|
}
|
|
94
|
-
function getScope(monacoScope) {
|
|
53
|
+
export function getScope(monacoScope) {
|
|
95
54
|
switch (monacoScope) {
|
|
96
55
|
case 'machine-overridable':
|
|
97
56
|
case 'window':
|
|
98
57
|
case 'resource':
|
|
99
|
-
return { scope:
|
|
58
|
+
return { scope: PreferenceScope.Folder, overridable: false };
|
|
100
59
|
case 'language-overridable':
|
|
101
|
-
return { scope:
|
|
60
|
+
return { scope: PreferenceScope.Folder, overridable: true };
|
|
102
61
|
case 'application':
|
|
103
62
|
case 'machine':
|
|
104
|
-
return { scope:
|
|
63
|
+
return { scope: PreferenceScope.User, overridable: false };
|
|
105
64
|
}
|
|
106
65
|
return { scope: undefined, overridable: false };
|
|
107
66
|
}
|
|
@@ -110,36 +69,36 @@ function getFileExtension(filePath) {
|
|
|
110
69
|
return index === -1 ? '' : filePath.substring(index + 1);
|
|
111
70
|
}
|
|
112
71
|
function isCharacterPair(something) {
|
|
113
|
-
return
|
|
72
|
+
return isStringArray(something) && something.length === 2;
|
|
114
73
|
}
|
|
115
|
-
function isRawLocalization(entry) {
|
|
116
|
-
return
|
|
74
|
+
export function isRawLocalization(entry) {
|
|
75
|
+
return isObject(entry) && typeof entry.languageId === 'string';
|
|
117
76
|
}
|
|
118
77
|
function toCustomEditorPriority(priority) {
|
|
119
|
-
if (priority ===
|
|
78
|
+
if (priority === CustomEditorPriority.option || priority === CustomEditorPriority.builtin) {
|
|
120
79
|
return priority;
|
|
121
80
|
}
|
|
122
|
-
return
|
|
81
|
+
return CustomEditorPriority.default;
|
|
123
82
|
}
|
|
124
83
|
async function readJson(ctx, filePath) {
|
|
125
84
|
if (ctx.readJsonFile) {
|
|
126
85
|
return ctx.readJsonFile(filePath);
|
|
127
86
|
}
|
|
128
87
|
try {
|
|
129
|
-
const content = await
|
|
88
|
+
const content = await fs.readFile(filePath, { encoding: 'utf8' });
|
|
130
89
|
return content ? jsoncparser.parse(content, undefined, { disallowComments: false }) : undefined;
|
|
131
90
|
}
|
|
132
91
|
catch (e) {
|
|
133
|
-
if (!
|
|
92
|
+
if (!isENOENT(e)) {
|
|
134
93
|
throw e;
|
|
135
94
|
}
|
|
136
95
|
return undefined;
|
|
137
96
|
}
|
|
138
97
|
}
|
|
139
|
-
async function normalizeContributions(ctx, contributions) {
|
|
98
|
+
export async function normalizeContributions(ctx, contributions) {
|
|
140
99
|
const output = contributions;
|
|
141
100
|
const rawPlugin = ctx.plugin;
|
|
142
|
-
const contributes =
|
|
101
|
+
const contributes = rawContributes(rawPlugin);
|
|
143
102
|
const readConfigurationFn = ctx.readConfiguration ?? readConfiguration;
|
|
144
103
|
const readSubmenusFn = ctx.readSubmenus ?? ((submenus, plugin) => readSubmenus(ctx, submenus, plugin));
|
|
145
104
|
const readCustomEditorsFn = ctx.readCustomEditors ?? readCustomEditors;
|
|
@@ -193,7 +152,7 @@ async function normalizeContributions(ctx, contributions) {
|
|
|
193
152
|
output.notebookRenderer = contributes.notebookRenderer;
|
|
194
153
|
output.notebookPreload = contributes.notebookPreload;
|
|
195
154
|
const configurationDefaults = contributes.configurationDefaults;
|
|
196
|
-
output.configurationDefaults =
|
|
155
|
+
output.configurationDefaults = isObject(configurationDefaults) ? configurationDefaults : undefined;
|
|
197
156
|
try {
|
|
198
157
|
if (contributes.submenus) {
|
|
199
158
|
output.submenus = readSubmenusFn(contributes.submenus, rawPlugin);
|
|
@@ -215,7 +174,7 @@ async function normalizeContributions(ctx, contributions) {
|
|
|
215
174
|
const viewsContainers = {};
|
|
216
175
|
for (const location of Object.keys(contributes.viewsContainers)) {
|
|
217
176
|
const containers = readViewsContainersFn(contributes.viewsContainers[location], rawPlugin);
|
|
218
|
-
const loc =
|
|
177
|
+
const loc = VIEW_CONTAINER_LOCATION_ALIASES[location] ?? location;
|
|
219
178
|
const existing = viewsContainers[loc];
|
|
220
179
|
viewsContainers[loc] = existing ? existing.concat(containers) : containers;
|
|
221
180
|
}
|
|
@@ -228,8 +187,13 @@ async function normalizeContributions(ctx, contributions) {
|
|
|
228
187
|
try {
|
|
229
188
|
if (contributes.views) {
|
|
230
189
|
const views = {};
|
|
190
|
+
// As in VS Code, a view may set its initial size only within a view container of its own plugin.
|
|
191
|
+
const ownViewContainerIds = new Set(Object.values(output.viewsContainers ?? {}).flat().map(container => container.id));
|
|
231
192
|
for (const location of Object.keys(contributes.views)) {
|
|
232
|
-
|
|
193
|
+
const locationViews = readViewsFn(contributes.views[location]);
|
|
194
|
+
views[location] = ownViewContainerIds.has(location)
|
|
195
|
+
? locationViews
|
|
196
|
+
: locationViews.map(view => ({ ...view, initialSize: undefined }));
|
|
233
197
|
}
|
|
234
198
|
output.views = views;
|
|
235
199
|
}
|
|
@@ -370,15 +334,15 @@ async function normalizeContributions(ctx, contributions) {
|
|
|
370
334
|
}
|
|
371
335
|
return output;
|
|
372
336
|
}
|
|
373
|
-
function readTerminals(pck) {
|
|
374
|
-
const terminal =
|
|
337
|
+
export function readTerminals(pck) {
|
|
338
|
+
const terminal = rawContributes(pck).terminal;
|
|
375
339
|
if (!terminal?.profiles) {
|
|
376
340
|
return undefined;
|
|
377
341
|
}
|
|
378
342
|
return terminal.profiles.filter((profile) => !!(profile.id && profile.title));
|
|
379
343
|
}
|
|
380
|
-
function readLocalizations(pck, ctx) {
|
|
381
|
-
const localizations =
|
|
344
|
+
export function readLocalizations(pck, ctx) {
|
|
345
|
+
const localizations = rawContributes(pck).localizations;
|
|
382
346
|
if (!Array.isArray(localizations)) {
|
|
383
347
|
return undefined;
|
|
384
348
|
}
|
|
@@ -387,7 +351,7 @@ function readLocalizations(pck, ctx) {
|
|
|
387
351
|
.filter(isRawLocalization)
|
|
388
352
|
.map(entry => readLocalizationFn(entry, pck.packagePath));
|
|
389
353
|
}
|
|
390
|
-
function readLocalization({ languageId, languageName, localizedLanguageName, translations, minimalTranslations }, pluginPath, ctx) {
|
|
354
|
+
export function readLocalization({ languageId, languageName, localizedLanguageName, translations, minimalTranslations }, pluginPath, ctx) {
|
|
391
355
|
const readTranslationFn = ctx?.readTranslation ?? readTranslation;
|
|
392
356
|
const local = {
|
|
393
357
|
languageId,
|
|
@@ -401,18 +365,18 @@ function readLocalization({ languageId, languageName, localizedLanguageName, tra
|
|
|
401
365
|
}
|
|
402
366
|
return local;
|
|
403
367
|
}
|
|
404
|
-
function readTranslation(packageTranslation, _pluginPath) {
|
|
368
|
+
export function readTranslation(packageTranslation, _pluginPath) {
|
|
405
369
|
return {
|
|
406
370
|
id: packageTranslation.id,
|
|
407
371
|
path: packageTranslation.path
|
|
408
372
|
};
|
|
409
373
|
}
|
|
410
|
-
function readWalkthroughs(pck, ctx) {
|
|
411
|
-
const walkthroughs =
|
|
374
|
+
export function readWalkthroughs(pck, ctx) {
|
|
375
|
+
const walkthroughs = rawContributes(pck).walkthroughs;
|
|
412
376
|
if (!walkthroughs) {
|
|
413
377
|
return undefined;
|
|
414
378
|
}
|
|
415
|
-
const pluginId = `${(pck.publisher ??
|
|
379
|
+
const pluginId = `${(pck.publisher ?? UNPUBLISHED).toLowerCase()}.${pck.name.toLowerCase()}`;
|
|
416
380
|
// `PluginModel` does not carry the extension icon, so it travels with the walkthroughs that show it.
|
|
417
381
|
const pluginIcon = pck.icon ? ctx.resolveUrl(pck.icon) : undefined;
|
|
418
382
|
const result = [];
|
|
@@ -491,7 +455,7 @@ function resolveWalkthroughMedia(ctx, media) {
|
|
|
491
455
|
}
|
|
492
456
|
return undefined;
|
|
493
457
|
}
|
|
494
|
-
function readCommand(ctx, command, pck) {
|
|
458
|
+
export function readCommand(ctx, command, pck) {
|
|
495
459
|
const { themeIcon, iconUrl } = (ctx.transformIconUrl
|
|
496
460
|
? ctx.transformIconUrl(pck, command.icon)
|
|
497
461
|
: transformIconUrl(ctx, pck, command.icon)) ?? {};
|
|
@@ -506,7 +470,7 @@ function readCommand(ctx, command, pck) {
|
|
|
506
470
|
enablement: command.enablement
|
|
507
471
|
};
|
|
508
472
|
}
|
|
509
|
-
function transformIconUrl(ctx, _plugin, original) {
|
|
473
|
+
export function transformIconUrl(ctx, _plugin, original) {
|
|
510
474
|
if (original) {
|
|
511
475
|
if (typeof original === 'string') {
|
|
512
476
|
if (original.startsWith('$(')) {
|
|
@@ -523,21 +487,21 @@ function transformIconUrl(ctx, _plugin, original) {
|
|
|
523
487
|
}
|
|
524
488
|
return undefined;
|
|
525
489
|
}
|
|
526
|
-
function readColors(ctx, pck) {
|
|
527
|
-
const colors =
|
|
490
|
+
export function readColors(ctx, pck) {
|
|
491
|
+
const colors = rawContributes(pck).colors;
|
|
528
492
|
if (!Array.isArray(colors)) {
|
|
529
493
|
return undefined;
|
|
530
494
|
}
|
|
531
495
|
const result = [];
|
|
532
496
|
for (const contribution of colors) {
|
|
533
|
-
if (!
|
|
497
|
+
if (!isObject(contribution)) {
|
|
534
498
|
continue;
|
|
535
499
|
}
|
|
536
500
|
if (typeof contribution.id !== 'string' || contribution.id.length === 0) {
|
|
537
501
|
ctx.onWarn("'configuration.colors.id' must be defined and can not be empty");
|
|
538
502
|
continue;
|
|
539
503
|
}
|
|
540
|
-
if (!contribution.id.match(
|
|
504
|
+
if (!contribution.id.match(colorIdPattern)) {
|
|
541
505
|
ctx.onWarn("'configuration.colors.id' must follow the word[.word]*");
|
|
542
506
|
continue;
|
|
543
507
|
}
|
|
@@ -546,7 +510,7 @@ function readColors(ctx, pck) {
|
|
|
546
510
|
continue;
|
|
547
511
|
}
|
|
548
512
|
const defaults = contribution.defaults;
|
|
549
|
-
if (!
|
|
513
|
+
if (!isColorDefaults(defaults)) {
|
|
550
514
|
ctx.onWarn("'configuration.colors.defaults' must be defined and must contain 'light', 'dark' and 'highContrast'");
|
|
551
515
|
continue;
|
|
552
516
|
}
|
|
@@ -562,14 +526,14 @@ function readColors(ctx, pck) {
|
|
|
562
526
|
}
|
|
563
527
|
return result;
|
|
564
528
|
}
|
|
565
|
-
function readThemes(ctx, pck) {
|
|
566
|
-
const themes =
|
|
529
|
+
export function readThemes(ctx, pck) {
|
|
530
|
+
const themes = rawContributes(pck).themes;
|
|
567
531
|
if (!Array.isArray(themes)) {
|
|
568
532
|
return undefined;
|
|
569
533
|
}
|
|
570
534
|
const result = [];
|
|
571
535
|
for (const contribution of themes) {
|
|
572
|
-
if (!
|
|
536
|
+
if (!isObject(contribution)) {
|
|
573
537
|
continue;
|
|
574
538
|
}
|
|
575
539
|
if (typeof contribution.path === 'string' && contribution.path) {
|
|
@@ -584,14 +548,14 @@ function readThemes(ctx, pck) {
|
|
|
584
548
|
}
|
|
585
549
|
return result;
|
|
586
550
|
}
|
|
587
|
-
function readIconThemes(ctx, pck) {
|
|
588
|
-
const iconThemes =
|
|
551
|
+
export function readIconThemes(ctx, pck) {
|
|
552
|
+
const iconThemes = rawContributes(pck).iconThemes;
|
|
589
553
|
if (!Array.isArray(iconThemes)) {
|
|
590
554
|
return undefined;
|
|
591
555
|
}
|
|
592
556
|
const result = [];
|
|
593
557
|
for (const contribution of iconThemes) {
|
|
594
|
-
if (!
|
|
558
|
+
if (!isObject(contribution)) {
|
|
595
559
|
continue;
|
|
596
560
|
}
|
|
597
561
|
if (typeof contribution.id !== 'string' || !contribution.id) {
|
|
@@ -612,9 +576,9 @@ function readIconThemes(ctx, pck) {
|
|
|
612
576
|
}
|
|
613
577
|
return result;
|
|
614
578
|
}
|
|
615
|
-
function readIcons(ctx, pck) {
|
|
616
|
-
const icons =
|
|
617
|
-
if (!
|
|
579
|
+
export function readIcons(ctx, pck) {
|
|
580
|
+
const icons = rawContributes(pck).icons;
|
|
581
|
+
if (!isObject(icons)) {
|
|
618
582
|
return undefined;
|
|
619
583
|
}
|
|
620
584
|
const result = [];
|
|
@@ -622,14 +586,14 @@ function readIcons(ctx, pck) {
|
|
|
622
586
|
if (!Object.prototype.hasOwnProperty.call(icons, id)) {
|
|
623
587
|
continue;
|
|
624
588
|
}
|
|
625
|
-
if (!id.match(
|
|
589
|
+
if (!id.match(iconIdPattern)) {
|
|
626
590
|
ctx.onWarn('\'configuration.icons\' keys represent the icon id and can only contain letter, digits and minuses. ' +
|
|
627
591
|
'They need to consist of at least two segments in the form `component-iconname`. ' +
|
|
628
592
|
`extension: ${pck.name} icon id: ${id}`);
|
|
629
593
|
return;
|
|
630
594
|
}
|
|
631
595
|
const iconContribution = icons[id];
|
|
632
|
-
if (!
|
|
596
|
+
if (!isObject(iconContribution) || typeof iconContribution.description !== 'string' || iconContribution.description.length === 0) {
|
|
633
597
|
ctx.onWarn(`configuration.icons.description must be defined and can not be empty, extension: ${pck.name} icon id: ${id}`);
|
|
634
598
|
return;
|
|
635
599
|
}
|
|
@@ -642,7 +606,7 @@ function readIcons(ctx, pck) {
|
|
|
642
606
|
defaults: { id: defaultIcon }
|
|
643
607
|
});
|
|
644
608
|
}
|
|
645
|
-
else if (
|
|
609
|
+
else if (isObject(defaultIcon) && typeof defaultIcon.fontPath === 'string' && typeof defaultIcon.fontCharacter === 'string') {
|
|
646
610
|
const format = getFileExtension(defaultIcon.fontPath);
|
|
647
611
|
if (['woff', 'woff2', 'ttf'].indexOf(format) === -1) {
|
|
648
612
|
ctx.onWarn(`Expected \`contributes.icons.default.fontPath\` to have file extension 'woff', woff2' or 'ttf', is '${format}'.`);
|
|
@@ -666,14 +630,14 @@ function readIcons(ctx, pck) {
|
|
|
666
630
|
}
|
|
667
631
|
return result;
|
|
668
632
|
}
|
|
669
|
-
function readSnippets(ctx, pck) {
|
|
670
|
-
const snippets =
|
|
633
|
+
export function readSnippets(ctx, pck) {
|
|
634
|
+
const snippets = rawContributes(pck).snippets;
|
|
671
635
|
if (!Array.isArray(snippets)) {
|
|
672
636
|
return undefined;
|
|
673
637
|
}
|
|
674
638
|
const result = [];
|
|
675
639
|
for (const contribution of snippets) {
|
|
676
|
-
if (!
|
|
640
|
+
if (!isObject(contribution)) {
|
|
677
641
|
continue;
|
|
678
642
|
}
|
|
679
643
|
if (typeof contribution.path === 'string' && contribution.path) {
|
|
@@ -686,7 +650,7 @@ function readSnippets(ctx, pck) {
|
|
|
686
650
|
}
|
|
687
651
|
return result;
|
|
688
652
|
}
|
|
689
|
-
function readConfiguration(rawConfiguration, _pluginPath) {
|
|
653
|
+
export function readConfiguration(rawConfiguration, _pluginPath) {
|
|
690
654
|
const { scope, overridable } = getScope(rawConfiguration.scope);
|
|
691
655
|
const schema = {
|
|
692
656
|
scope,
|
|
@@ -708,7 +672,7 @@ function readConfiguration(rawConfiguration, _pluginPath) {
|
|
|
708
672
|
}
|
|
709
673
|
return schema;
|
|
710
674
|
}
|
|
711
|
-
function readKeybinding(rawKeybinding) {
|
|
675
|
+
export function readKeybinding(rawKeybinding) {
|
|
712
676
|
return {
|
|
713
677
|
keybinding: rawKeybinding.key,
|
|
714
678
|
command: rawKeybinding.command,
|
|
@@ -719,10 +683,10 @@ function readKeybinding(rawKeybinding) {
|
|
|
719
683
|
args: rawKeybinding.args
|
|
720
684
|
};
|
|
721
685
|
}
|
|
722
|
-
function readCustomEditors(rawCustomEditors) {
|
|
686
|
+
export function readCustomEditors(rawCustomEditors) {
|
|
723
687
|
return rawCustomEditors.map(rawCustomEditor => readCustomEditor(rawCustomEditor));
|
|
724
688
|
}
|
|
725
|
-
function readCustomEditor(rawCustomEditor) {
|
|
689
|
+
export function readCustomEditor(rawCustomEditor) {
|
|
726
690
|
return {
|
|
727
691
|
viewType: rawCustomEditor.viewType,
|
|
728
692
|
displayName: rawCustomEditor.displayName,
|
|
@@ -730,12 +694,12 @@ function readCustomEditor(rawCustomEditor) {
|
|
|
730
694
|
priority: toCustomEditorPriority(rawCustomEditor.priority)
|
|
731
695
|
};
|
|
732
696
|
}
|
|
733
|
-
function readViewsContainers(ctx, rawViewsContainers, pck) {
|
|
697
|
+
export function readViewsContainers(ctx, rawViewsContainers, pck) {
|
|
734
698
|
return rawViewsContainers
|
|
735
699
|
.map(rawViewContainer => readViewContainer(ctx, rawViewContainer, pck))
|
|
736
700
|
.filter((container) => container !== undefined);
|
|
737
701
|
}
|
|
738
|
-
function readViewContainer(ctx, rawViewContainer, pck) {
|
|
702
|
+
export function readViewContainer(ctx, rawViewContainer, pck) {
|
|
739
703
|
const icon = rawViewContainer.icon;
|
|
740
704
|
if (typeof icon !== 'string') {
|
|
741
705
|
ctx.onError('viewsContainers', 'view container icon must be defined and must be a string', rawViewContainer);
|
|
@@ -751,21 +715,23 @@ function readViewContainer(ctx, rawViewContainer, pck) {
|
|
|
751
715
|
when: rawViewContainer.when,
|
|
752
716
|
};
|
|
753
717
|
}
|
|
754
|
-
function readViews(rawViews) {
|
|
718
|
+
export function readViews(rawViews) {
|
|
755
719
|
return rawViews.map(rawView => readView(rawView));
|
|
756
720
|
}
|
|
757
|
-
function readView(rawView) {
|
|
721
|
+
export function readView(rawView) {
|
|
758
722
|
return {
|
|
759
723
|
id: rawView.id,
|
|
760
724
|
name: rawView.name,
|
|
761
725
|
when: rawView.when,
|
|
762
|
-
type: rawView.type
|
|
726
|
+
type: rawView.type,
|
|
727
|
+
visibility: PLUGIN_VIEW_VISIBILITIES.find(visibility => visibility === rawView.visibility),
|
|
728
|
+
initialSize: Number.isFinite(rawView.initialSize) && rawView.initialSize > 0 ? rawView.initialSize : undefined
|
|
763
729
|
};
|
|
764
730
|
}
|
|
765
|
-
function readViewsWelcome(rawViewsWelcome, rowViews) {
|
|
731
|
+
export function readViewsWelcome(rawViewsWelcome, rowViews) {
|
|
766
732
|
return rawViewsWelcome.map(rawViewWelcome => readViewWelcome(rawViewWelcome, extractPluginViewsIds(rowViews)));
|
|
767
733
|
}
|
|
768
|
-
function readViewWelcome(rawViewWelcome, pluginViewsIds) {
|
|
734
|
+
export function readViewWelcome(rawViewWelcome, pluginViewsIds) {
|
|
769
735
|
return {
|
|
770
736
|
view: rawViewWelcome.view,
|
|
771
737
|
content: rawViewWelcome.contents,
|
|
@@ -774,12 +740,12 @@ function readViewWelcome(rawViewWelcome, pluginViewsIds) {
|
|
|
774
740
|
order: pluginViewsIds.findIndex(v => v === rawViewWelcome.view) > -1 ? 0 : 1
|
|
775
741
|
};
|
|
776
742
|
}
|
|
777
|
-
function extractPluginViewsIds(views) {
|
|
743
|
+
export function extractPluginViewsIds(views) {
|
|
778
744
|
const pluginViewsIds = [];
|
|
779
745
|
if (views) {
|
|
780
746
|
for (const location of Object.keys(views)) {
|
|
781
747
|
const viewsIds = views[location]
|
|
782
|
-
.filter(
|
|
748
|
+
.filter(isObject)
|
|
783
749
|
.map(view => view.id)
|
|
784
750
|
.filter((id) => typeof id === 'string');
|
|
785
751
|
pluginViewsIds.push(...viewsIds);
|
|
@@ -787,10 +753,10 @@ function extractPluginViewsIds(views) {
|
|
|
787
753
|
}
|
|
788
754
|
return pluginViewsIds;
|
|
789
755
|
}
|
|
790
|
-
function readMenus(rawMenus) {
|
|
756
|
+
export function readMenus(rawMenus) {
|
|
791
757
|
return rawMenus.map(rawMenu => readMenu(rawMenu));
|
|
792
758
|
}
|
|
793
|
-
function readMenu(rawMenu) {
|
|
759
|
+
export function readMenu(rawMenu) {
|
|
794
760
|
return {
|
|
795
761
|
command: rawMenu.command,
|
|
796
762
|
submenu: rawMenu.submenu,
|
|
@@ -799,13 +765,13 @@ function readMenu(rawMenu) {
|
|
|
799
765
|
when: rawMenu.when
|
|
800
766
|
};
|
|
801
767
|
}
|
|
802
|
-
async function readLanguages(ctx, rawLanguages, plugin) {
|
|
768
|
+
export async function readLanguages(ctx, rawLanguages, plugin) {
|
|
803
769
|
return Promise.all(rawLanguages.map(language => readLanguage(ctx, language, plugin)));
|
|
804
770
|
}
|
|
805
|
-
function readSubmenus(ctx, rawSubmenus, plugin) {
|
|
771
|
+
export function readSubmenus(ctx, rawSubmenus, plugin) {
|
|
806
772
|
return rawSubmenus.map(submenu => readSubmenu(ctx, submenu, plugin));
|
|
807
773
|
}
|
|
808
|
-
function readSubmenu(ctx, rawSubmenu, plugin) {
|
|
774
|
+
export function readSubmenu(ctx, rawSubmenu, plugin) {
|
|
809
775
|
const icon = ctx.transformIconUrl
|
|
810
776
|
? ctx.transformIconUrl(plugin, rawSubmenu.icon)
|
|
811
777
|
: transformIconUrl(ctx, plugin, rawSubmenu.icon);
|
|
@@ -815,7 +781,7 @@ function readSubmenu(ctx, rawSubmenu, plugin) {
|
|
|
815
781
|
label: rawSubmenu.label
|
|
816
782
|
};
|
|
817
783
|
}
|
|
818
|
-
async function readLanguage(ctx, rawLang, plugin) {
|
|
784
|
+
export async function readLanguage(ctx, rawLang, plugin) {
|
|
819
785
|
const icon = ctx.transformIconUrl
|
|
820
786
|
? ctx.transformIconUrl(plugin, rawLang.icon)
|
|
821
787
|
: transformIconUrl(ctx, plugin, rawLang.icon);
|
|
@@ -831,7 +797,7 @@ async function readLanguage(ctx, rawLang, plugin) {
|
|
|
831
797
|
};
|
|
832
798
|
if (typeof rawLang.configuration === 'string') {
|
|
833
799
|
const rawConfiguration = await readJson(ctx, path.resolve(plugin.packagePath, rawLang.configuration));
|
|
834
|
-
if (
|
|
800
|
+
if (isObject(rawConfiguration)) {
|
|
835
801
|
const configuration = {
|
|
836
802
|
brackets: Array.isArray(rawConfiguration.brackets)
|
|
837
803
|
? rawConfiguration.brackets.filter(isCharacterPair)
|
|
@@ -849,10 +815,10 @@ async function readLanguage(ctx, rawLang, plugin) {
|
|
|
849
815
|
}
|
|
850
816
|
return result;
|
|
851
817
|
}
|
|
852
|
-
function readDebuggers(rawDebuggers) {
|
|
818
|
+
export function readDebuggers(rawDebuggers) {
|
|
853
819
|
return rawDebuggers.map(rawDebug => readDebugger(rawDebug));
|
|
854
820
|
}
|
|
855
|
-
function readDebugger(rawDebugger) {
|
|
821
|
+
export function readDebugger(rawDebugger) {
|
|
856
822
|
return {
|
|
857
823
|
type: rawDebugger.type,
|
|
858
824
|
label: rawDebugger.label,
|
|
@@ -873,8 +839,8 @@ function readDebugger(rawDebugger) {
|
|
|
873
839
|
configurationAttributes: rawDebugger.configurationAttributes
|
|
874
840
|
};
|
|
875
841
|
}
|
|
876
|
-
function readTaskDefinition(pluginName, definitionContribution, ctx) {
|
|
877
|
-
const propertyKeys = definitionContribution.properties &&
|
|
842
|
+
export function readTaskDefinition(pluginName, definitionContribution, ctx) {
|
|
843
|
+
const propertyKeys = definitionContribution.properties && isObject(definitionContribution.properties)
|
|
878
844
|
? Object.keys(definitionContribution.properties)
|
|
879
845
|
: [];
|
|
880
846
|
const schema = (ctx?.toSchema ?? toSchema)(definitionContribution);
|
|
@@ -888,9 +854,9 @@ function readTaskDefinition(pluginName, definitionContribution, ctx) {
|
|
|
888
854
|
}
|
|
889
855
|
};
|
|
890
856
|
}
|
|
891
|
-
function toSchema(definition) {
|
|
857
|
+
export function toSchema(definition) {
|
|
892
858
|
const reconciliation = { ...definition, type: 'object' };
|
|
893
|
-
const schema =
|
|
859
|
+
const schema = deepClone(reconciliation);
|
|
894
860
|
if (schema.properties === undefined) {
|
|
895
861
|
// eslint-disable-next-line no-null/no-null
|
|
896
862
|
schema.properties = Object.create(null);
|
|
@@ -920,7 +886,7 @@ function extractValidAutoClosingPairs(ctx, langId, configuration) {
|
|
|
920
886
|
result.push({ open: pair[0], close: pair[1] });
|
|
921
887
|
}
|
|
922
888
|
else {
|
|
923
|
-
if (!
|
|
889
|
+
if (!isObject(pair)) {
|
|
924
890
|
ctx.onWarn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}]\` to be an array of two strings or an object.`);
|
|
925
891
|
continue;
|
|
926
892
|
}
|
|
@@ -933,7 +899,7 @@ function extractValidAutoClosingPairs(ctx, langId, configuration) {
|
|
|
933
899
|
continue;
|
|
934
900
|
}
|
|
935
901
|
if (typeof pair.notIn !== 'undefined') {
|
|
936
|
-
if (!
|
|
902
|
+
if (!isStringArray(pair.notIn)) {
|
|
937
903
|
ctx.onWarn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].notIn\` to be a string array.`);
|
|
938
904
|
continue;
|
|
939
905
|
}
|
|
@@ -965,7 +931,7 @@ function extractValidSurroundingPairs(ctx, langId, configuration) {
|
|
|
965
931
|
result.push({ open: pair[0], close: pair[1] });
|
|
966
932
|
}
|
|
967
933
|
else {
|
|
968
|
-
if (!
|
|
934
|
+
if (!isObject(pair)) {
|
|
969
935
|
ctx.onWarn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}]\` to be an array of two strings or an object.`);
|
|
970
936
|
continue;
|
|
971
937
|
}
|