@theia/plugin-utils 1.77.0-next.1 → 1.77.0-next.101
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 +3 -3
- package/lib/common/contribution-types.d.ts.map +1 -1
- package/lib/common/contribution-types.js +4 -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 -24
- 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 -22
- 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 -68
- 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 +86 -126
- package/lib/node/normalize-contributions.js.map +1 -1
- package/lib/node/normalize-contributions.spec.js +158 -160
- 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 -11
- 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 -8
- 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 -11
- package/lib/node/read-grammars.js.map +1 -1
- package/lib/node/read-grammars.spec.js +25 -26
- package/lib/node/read-grammars.spec.js.map +1 -1
- package/package.json +10 -2
- package/src/common/constants.spec.ts +1 -1
- package/src/common/contribution-types.ts +3 -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 +5 -5
- package/src/node/normalize-contributions.ts +5 -5
- 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,EAOH,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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EjE;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,61 +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
16
|
/* eslint-disable @theia/localization-check */
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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, } from '../common/contribution-types.js';
|
|
23
|
+
import { rawContributes } from '../common/manifest-types.js';
|
|
24
|
+
import { UNPUBLISHED } from '../common/constants.js';
|
|
65
25
|
function isPluginUiTheme(value) {
|
|
66
26
|
return value === 'vs' || value === 'vs-dark' || value === 'hc-black' || value === 'hc-light';
|
|
67
27
|
}
|
|
68
|
-
|
|
69
|
-
|
|
28
|
+
export const colorIdPattern = '^\\w+[.\\w+]*$';
|
|
29
|
+
export const iconIdPattern = `^${ICON_NAME_SEGMENT}(-${ICON_NAME_SEGMENT})+$`;
|
|
70
30
|
/** Maps the view container locations used by VS Code extensions to the Theia shell locations. */
|
|
71
|
-
|
|
31
|
+
export const VIEW_CONTAINER_LOCATION_ALIASES = {
|
|
72
32
|
activitybar: 'left',
|
|
73
33
|
panel: 'bottom',
|
|
74
34
|
secondarySidebar: 'right',
|
|
@@ -77,7 +37,7 @@ exports.VIEW_CONTAINER_LOCATION_ALIASES = {
|
|
|
77
37
|
/**
|
|
78
38
|
* Mirrors VS Code's `ConfigurationRegistry.getDefaultValue(type)`: plugins expect typed-but-defaultless properties to read as a type-based default.
|
|
79
39
|
*/
|
|
80
|
-
function deriveDefaultForType(type) {
|
|
40
|
+
export function deriveDefaultForType(type) {
|
|
81
41
|
const t = Array.isArray(type) ? type[0] : type;
|
|
82
42
|
switch (t) {
|
|
83
43
|
case 'boolean': return false;
|
|
@@ -90,17 +50,17 @@ function deriveDefaultForType(type) {
|
|
|
90
50
|
default: return null;
|
|
91
51
|
}
|
|
92
52
|
}
|
|
93
|
-
function getScope(monacoScope) {
|
|
53
|
+
export function getScope(monacoScope) {
|
|
94
54
|
switch (monacoScope) {
|
|
95
55
|
case 'machine-overridable':
|
|
96
56
|
case 'window':
|
|
97
57
|
case 'resource':
|
|
98
|
-
return { scope:
|
|
58
|
+
return { scope: PreferenceScope.Folder, overridable: false };
|
|
99
59
|
case 'language-overridable':
|
|
100
|
-
return { scope:
|
|
60
|
+
return { scope: PreferenceScope.Folder, overridable: true };
|
|
101
61
|
case 'application':
|
|
102
62
|
case 'machine':
|
|
103
|
-
return { scope:
|
|
63
|
+
return { scope: PreferenceScope.User, overridable: false };
|
|
104
64
|
}
|
|
105
65
|
return { scope: undefined, overridable: false };
|
|
106
66
|
}
|
|
@@ -109,36 +69,36 @@ function getFileExtension(filePath) {
|
|
|
109
69
|
return index === -1 ? '' : filePath.substring(index + 1);
|
|
110
70
|
}
|
|
111
71
|
function isCharacterPair(something) {
|
|
112
|
-
return
|
|
72
|
+
return isStringArray(something) && something.length === 2;
|
|
113
73
|
}
|
|
114
|
-
function isRawLocalization(entry) {
|
|
115
|
-
return
|
|
74
|
+
export function isRawLocalization(entry) {
|
|
75
|
+
return isObject(entry) && typeof entry.languageId === 'string';
|
|
116
76
|
}
|
|
117
77
|
function toCustomEditorPriority(priority) {
|
|
118
|
-
if (priority ===
|
|
78
|
+
if (priority === CustomEditorPriority.option || priority === CustomEditorPriority.builtin) {
|
|
119
79
|
return priority;
|
|
120
80
|
}
|
|
121
|
-
return
|
|
81
|
+
return CustomEditorPriority.default;
|
|
122
82
|
}
|
|
123
83
|
async function readJson(ctx, filePath) {
|
|
124
84
|
if (ctx.readJsonFile) {
|
|
125
85
|
return ctx.readJsonFile(filePath);
|
|
126
86
|
}
|
|
127
87
|
try {
|
|
128
|
-
const content = await
|
|
88
|
+
const content = await fs.readFile(filePath, { encoding: 'utf8' });
|
|
129
89
|
return content ? jsoncparser.parse(content, undefined, { disallowComments: false }) : undefined;
|
|
130
90
|
}
|
|
131
91
|
catch (e) {
|
|
132
|
-
if (!
|
|
92
|
+
if (!isENOENT(e)) {
|
|
133
93
|
throw e;
|
|
134
94
|
}
|
|
135
95
|
return undefined;
|
|
136
96
|
}
|
|
137
97
|
}
|
|
138
|
-
async function normalizeContributions(ctx, contributions) {
|
|
98
|
+
export async function normalizeContributions(ctx, contributions) {
|
|
139
99
|
const output = contributions;
|
|
140
100
|
const rawPlugin = ctx.plugin;
|
|
141
|
-
const contributes =
|
|
101
|
+
const contributes = rawContributes(rawPlugin);
|
|
142
102
|
const readConfigurationFn = ctx.readConfiguration ?? readConfiguration;
|
|
143
103
|
const readSubmenusFn = ctx.readSubmenus ?? ((submenus, plugin) => readSubmenus(ctx, submenus, plugin));
|
|
144
104
|
const readCustomEditorsFn = ctx.readCustomEditors ?? readCustomEditors;
|
|
@@ -192,7 +152,7 @@ async function normalizeContributions(ctx, contributions) {
|
|
|
192
152
|
output.notebookRenderer = contributes.notebookRenderer;
|
|
193
153
|
output.notebookPreload = contributes.notebookPreload;
|
|
194
154
|
const configurationDefaults = contributes.configurationDefaults;
|
|
195
|
-
output.configurationDefaults =
|
|
155
|
+
output.configurationDefaults = isObject(configurationDefaults) ? configurationDefaults : undefined;
|
|
196
156
|
try {
|
|
197
157
|
if (contributes.submenus) {
|
|
198
158
|
output.submenus = readSubmenusFn(contributes.submenus, rawPlugin);
|
|
@@ -214,7 +174,7 @@ async function normalizeContributions(ctx, contributions) {
|
|
|
214
174
|
const viewsContainers = {};
|
|
215
175
|
for (const location of Object.keys(contributes.viewsContainers)) {
|
|
216
176
|
const containers = readViewsContainersFn(contributes.viewsContainers[location], rawPlugin);
|
|
217
|
-
const loc =
|
|
177
|
+
const loc = VIEW_CONTAINER_LOCATION_ALIASES[location] ?? location;
|
|
218
178
|
const existing = viewsContainers[loc];
|
|
219
179
|
viewsContainers[loc] = existing ? existing.concat(containers) : containers;
|
|
220
180
|
}
|
|
@@ -369,15 +329,15 @@ async function normalizeContributions(ctx, contributions) {
|
|
|
369
329
|
}
|
|
370
330
|
return output;
|
|
371
331
|
}
|
|
372
|
-
function readTerminals(pck) {
|
|
373
|
-
const terminal =
|
|
332
|
+
export function readTerminals(pck) {
|
|
333
|
+
const terminal = rawContributes(pck).terminal;
|
|
374
334
|
if (!terminal?.profiles) {
|
|
375
335
|
return undefined;
|
|
376
336
|
}
|
|
377
337
|
return terminal.profiles.filter((profile) => !!(profile.id && profile.title));
|
|
378
338
|
}
|
|
379
|
-
function readLocalizations(pck, ctx) {
|
|
380
|
-
const localizations =
|
|
339
|
+
export function readLocalizations(pck, ctx) {
|
|
340
|
+
const localizations = rawContributes(pck).localizations;
|
|
381
341
|
if (!Array.isArray(localizations)) {
|
|
382
342
|
return undefined;
|
|
383
343
|
}
|
|
@@ -386,7 +346,7 @@ function readLocalizations(pck, ctx) {
|
|
|
386
346
|
.filter(isRawLocalization)
|
|
387
347
|
.map(entry => readLocalizationFn(entry, pck.packagePath));
|
|
388
348
|
}
|
|
389
|
-
function readLocalization({ languageId, languageName, localizedLanguageName, translations, minimalTranslations }, pluginPath, ctx) {
|
|
349
|
+
export function readLocalization({ languageId, languageName, localizedLanguageName, translations, minimalTranslations }, pluginPath, ctx) {
|
|
390
350
|
const readTranslationFn = ctx?.readTranslation ?? readTranslation;
|
|
391
351
|
const local = {
|
|
392
352
|
languageId,
|
|
@@ -400,18 +360,18 @@ function readLocalization({ languageId, languageName, localizedLanguageName, tra
|
|
|
400
360
|
}
|
|
401
361
|
return local;
|
|
402
362
|
}
|
|
403
|
-
function readTranslation(packageTranslation, _pluginPath) {
|
|
363
|
+
export function readTranslation(packageTranslation, _pluginPath) {
|
|
404
364
|
return {
|
|
405
365
|
id: packageTranslation.id,
|
|
406
366
|
path: packageTranslation.path
|
|
407
367
|
};
|
|
408
368
|
}
|
|
409
|
-
function readWalkthroughs(pck, ctx) {
|
|
410
|
-
const walkthroughs =
|
|
369
|
+
export function readWalkthroughs(pck, ctx) {
|
|
370
|
+
const walkthroughs = rawContributes(pck).walkthroughs;
|
|
411
371
|
if (!walkthroughs) {
|
|
412
372
|
return undefined;
|
|
413
373
|
}
|
|
414
|
-
const pluginId = `${(pck.publisher ??
|
|
374
|
+
const pluginId = `${(pck.publisher ?? UNPUBLISHED).toLowerCase()}.${pck.name.toLowerCase()}`;
|
|
415
375
|
// `PluginModel` does not carry the extension icon, so it travels with the walkthroughs that show it.
|
|
416
376
|
const pluginIcon = pck.icon ? ctx.resolveUrl(pck.icon) : undefined;
|
|
417
377
|
const result = [];
|
|
@@ -490,7 +450,7 @@ function resolveWalkthroughMedia(ctx, media) {
|
|
|
490
450
|
}
|
|
491
451
|
return undefined;
|
|
492
452
|
}
|
|
493
|
-
function readCommand(ctx, command, pck) {
|
|
453
|
+
export function readCommand(ctx, command, pck) {
|
|
494
454
|
const { themeIcon, iconUrl } = (ctx.transformIconUrl
|
|
495
455
|
? ctx.transformIconUrl(pck, command.icon)
|
|
496
456
|
: transformIconUrl(ctx, pck, command.icon)) ?? {};
|
|
@@ -505,7 +465,7 @@ function readCommand(ctx, command, pck) {
|
|
|
505
465
|
enablement: command.enablement
|
|
506
466
|
};
|
|
507
467
|
}
|
|
508
|
-
function transformIconUrl(ctx, _plugin, original) {
|
|
468
|
+
export function transformIconUrl(ctx, _plugin, original) {
|
|
509
469
|
if (original) {
|
|
510
470
|
if (typeof original === 'string') {
|
|
511
471
|
if (original.startsWith('$(')) {
|
|
@@ -522,21 +482,21 @@ function transformIconUrl(ctx, _plugin, original) {
|
|
|
522
482
|
}
|
|
523
483
|
return undefined;
|
|
524
484
|
}
|
|
525
|
-
function readColors(ctx, pck) {
|
|
526
|
-
const colors =
|
|
485
|
+
export function readColors(ctx, pck) {
|
|
486
|
+
const colors = rawContributes(pck).colors;
|
|
527
487
|
if (!Array.isArray(colors)) {
|
|
528
488
|
return undefined;
|
|
529
489
|
}
|
|
530
490
|
const result = [];
|
|
531
491
|
for (const contribution of colors) {
|
|
532
|
-
if (!
|
|
492
|
+
if (!isObject(contribution)) {
|
|
533
493
|
continue;
|
|
534
494
|
}
|
|
535
495
|
if (typeof contribution.id !== 'string' || contribution.id.length === 0) {
|
|
536
496
|
ctx.onWarn("'configuration.colors.id' must be defined and can not be empty");
|
|
537
497
|
continue;
|
|
538
498
|
}
|
|
539
|
-
if (!contribution.id.match(
|
|
499
|
+
if (!contribution.id.match(colorIdPattern)) {
|
|
540
500
|
ctx.onWarn("'configuration.colors.id' must follow the word[.word]*");
|
|
541
501
|
continue;
|
|
542
502
|
}
|
|
@@ -545,7 +505,7 @@ function readColors(ctx, pck) {
|
|
|
545
505
|
continue;
|
|
546
506
|
}
|
|
547
507
|
const defaults = contribution.defaults;
|
|
548
|
-
if (!
|
|
508
|
+
if (!isColorDefaults(defaults)) {
|
|
549
509
|
ctx.onWarn("'configuration.colors.defaults' must be defined and must contain 'light', 'dark' and 'highContrast'");
|
|
550
510
|
continue;
|
|
551
511
|
}
|
|
@@ -561,14 +521,14 @@ function readColors(ctx, pck) {
|
|
|
561
521
|
}
|
|
562
522
|
return result;
|
|
563
523
|
}
|
|
564
|
-
function readThemes(ctx, pck) {
|
|
565
|
-
const themes =
|
|
524
|
+
export function readThemes(ctx, pck) {
|
|
525
|
+
const themes = rawContributes(pck).themes;
|
|
566
526
|
if (!Array.isArray(themes)) {
|
|
567
527
|
return undefined;
|
|
568
528
|
}
|
|
569
529
|
const result = [];
|
|
570
530
|
for (const contribution of themes) {
|
|
571
|
-
if (!
|
|
531
|
+
if (!isObject(contribution)) {
|
|
572
532
|
continue;
|
|
573
533
|
}
|
|
574
534
|
if (typeof contribution.path === 'string' && contribution.path) {
|
|
@@ -583,14 +543,14 @@ function readThemes(ctx, pck) {
|
|
|
583
543
|
}
|
|
584
544
|
return result;
|
|
585
545
|
}
|
|
586
|
-
function readIconThemes(ctx, pck) {
|
|
587
|
-
const iconThemes =
|
|
546
|
+
export function readIconThemes(ctx, pck) {
|
|
547
|
+
const iconThemes = rawContributes(pck).iconThemes;
|
|
588
548
|
if (!Array.isArray(iconThemes)) {
|
|
589
549
|
return undefined;
|
|
590
550
|
}
|
|
591
551
|
const result = [];
|
|
592
552
|
for (const contribution of iconThemes) {
|
|
593
|
-
if (!
|
|
553
|
+
if (!isObject(contribution)) {
|
|
594
554
|
continue;
|
|
595
555
|
}
|
|
596
556
|
if (typeof contribution.id !== 'string' || !contribution.id) {
|
|
@@ -611,9 +571,9 @@ function readIconThemes(ctx, pck) {
|
|
|
611
571
|
}
|
|
612
572
|
return result;
|
|
613
573
|
}
|
|
614
|
-
function readIcons(ctx, pck) {
|
|
615
|
-
const icons =
|
|
616
|
-
if (!
|
|
574
|
+
export function readIcons(ctx, pck) {
|
|
575
|
+
const icons = rawContributes(pck).icons;
|
|
576
|
+
if (!isObject(icons)) {
|
|
617
577
|
return undefined;
|
|
618
578
|
}
|
|
619
579
|
const result = [];
|
|
@@ -621,14 +581,14 @@ function readIcons(ctx, pck) {
|
|
|
621
581
|
if (!Object.prototype.hasOwnProperty.call(icons, id)) {
|
|
622
582
|
continue;
|
|
623
583
|
}
|
|
624
|
-
if (!id.match(
|
|
584
|
+
if (!id.match(iconIdPattern)) {
|
|
625
585
|
ctx.onWarn('\'configuration.icons\' keys represent the icon id and can only contain letter, digits and minuses. ' +
|
|
626
586
|
'They need to consist of at least two segments in the form `component-iconname`. ' +
|
|
627
587
|
`extension: ${pck.name} icon id: ${id}`);
|
|
628
588
|
return;
|
|
629
589
|
}
|
|
630
590
|
const iconContribution = icons[id];
|
|
631
|
-
if (!
|
|
591
|
+
if (!isObject(iconContribution) || typeof iconContribution.description !== 'string' || iconContribution.description.length === 0) {
|
|
632
592
|
ctx.onWarn(`configuration.icons.description must be defined and can not be empty, extension: ${pck.name} icon id: ${id}`);
|
|
633
593
|
return;
|
|
634
594
|
}
|
|
@@ -641,7 +601,7 @@ function readIcons(ctx, pck) {
|
|
|
641
601
|
defaults: { id: defaultIcon }
|
|
642
602
|
});
|
|
643
603
|
}
|
|
644
|
-
else if (
|
|
604
|
+
else if (isObject(defaultIcon) && typeof defaultIcon.fontPath === 'string' && typeof defaultIcon.fontCharacter === 'string') {
|
|
645
605
|
const format = getFileExtension(defaultIcon.fontPath);
|
|
646
606
|
if (['woff', 'woff2', 'ttf'].indexOf(format) === -1) {
|
|
647
607
|
ctx.onWarn(`Expected \`contributes.icons.default.fontPath\` to have file extension 'woff', woff2' or 'ttf', is '${format}'.`);
|
|
@@ -665,14 +625,14 @@ function readIcons(ctx, pck) {
|
|
|
665
625
|
}
|
|
666
626
|
return result;
|
|
667
627
|
}
|
|
668
|
-
function readSnippets(ctx, pck) {
|
|
669
|
-
const snippets =
|
|
628
|
+
export function readSnippets(ctx, pck) {
|
|
629
|
+
const snippets = rawContributes(pck).snippets;
|
|
670
630
|
if (!Array.isArray(snippets)) {
|
|
671
631
|
return undefined;
|
|
672
632
|
}
|
|
673
633
|
const result = [];
|
|
674
634
|
for (const contribution of snippets) {
|
|
675
|
-
if (!
|
|
635
|
+
if (!isObject(contribution)) {
|
|
676
636
|
continue;
|
|
677
637
|
}
|
|
678
638
|
if (typeof contribution.path === 'string' && contribution.path) {
|
|
@@ -685,7 +645,7 @@ function readSnippets(ctx, pck) {
|
|
|
685
645
|
}
|
|
686
646
|
return result;
|
|
687
647
|
}
|
|
688
|
-
function readConfiguration(rawConfiguration, _pluginPath) {
|
|
648
|
+
export function readConfiguration(rawConfiguration, _pluginPath) {
|
|
689
649
|
const { scope, overridable } = getScope(rawConfiguration.scope);
|
|
690
650
|
const schema = {
|
|
691
651
|
scope,
|
|
@@ -707,7 +667,7 @@ function readConfiguration(rawConfiguration, _pluginPath) {
|
|
|
707
667
|
}
|
|
708
668
|
return schema;
|
|
709
669
|
}
|
|
710
|
-
function readKeybinding(rawKeybinding) {
|
|
670
|
+
export function readKeybinding(rawKeybinding) {
|
|
711
671
|
return {
|
|
712
672
|
keybinding: rawKeybinding.key,
|
|
713
673
|
command: rawKeybinding.command,
|
|
@@ -718,10 +678,10 @@ function readKeybinding(rawKeybinding) {
|
|
|
718
678
|
args: rawKeybinding.args
|
|
719
679
|
};
|
|
720
680
|
}
|
|
721
|
-
function readCustomEditors(rawCustomEditors) {
|
|
681
|
+
export function readCustomEditors(rawCustomEditors) {
|
|
722
682
|
return rawCustomEditors.map(rawCustomEditor => readCustomEditor(rawCustomEditor));
|
|
723
683
|
}
|
|
724
|
-
function readCustomEditor(rawCustomEditor) {
|
|
684
|
+
export function readCustomEditor(rawCustomEditor) {
|
|
725
685
|
return {
|
|
726
686
|
viewType: rawCustomEditor.viewType,
|
|
727
687
|
displayName: rawCustomEditor.displayName,
|
|
@@ -729,12 +689,12 @@ function readCustomEditor(rawCustomEditor) {
|
|
|
729
689
|
priority: toCustomEditorPriority(rawCustomEditor.priority)
|
|
730
690
|
};
|
|
731
691
|
}
|
|
732
|
-
function readViewsContainers(ctx, rawViewsContainers, pck) {
|
|
692
|
+
export function readViewsContainers(ctx, rawViewsContainers, pck) {
|
|
733
693
|
return rawViewsContainers
|
|
734
694
|
.map(rawViewContainer => readViewContainer(ctx, rawViewContainer, pck))
|
|
735
695
|
.filter((container) => container !== undefined);
|
|
736
696
|
}
|
|
737
|
-
function readViewContainer(ctx, rawViewContainer, pck) {
|
|
697
|
+
export function readViewContainer(ctx, rawViewContainer, pck) {
|
|
738
698
|
const icon = rawViewContainer.icon;
|
|
739
699
|
if (typeof icon !== 'string') {
|
|
740
700
|
ctx.onError('viewsContainers', 'view container icon must be defined and must be a string', rawViewContainer);
|
|
@@ -750,10 +710,10 @@ function readViewContainer(ctx, rawViewContainer, pck) {
|
|
|
750
710
|
when: rawViewContainer.when,
|
|
751
711
|
};
|
|
752
712
|
}
|
|
753
|
-
function readViews(rawViews) {
|
|
713
|
+
export function readViews(rawViews) {
|
|
754
714
|
return rawViews.map(rawView => readView(rawView));
|
|
755
715
|
}
|
|
756
|
-
function readView(rawView) {
|
|
716
|
+
export function readView(rawView) {
|
|
757
717
|
return {
|
|
758
718
|
id: rawView.id,
|
|
759
719
|
name: rawView.name,
|
|
@@ -761,10 +721,10 @@ function readView(rawView) {
|
|
|
761
721
|
type: rawView.type
|
|
762
722
|
};
|
|
763
723
|
}
|
|
764
|
-
function readViewsWelcome(rawViewsWelcome, rowViews) {
|
|
724
|
+
export function readViewsWelcome(rawViewsWelcome, rowViews) {
|
|
765
725
|
return rawViewsWelcome.map(rawViewWelcome => readViewWelcome(rawViewWelcome, extractPluginViewsIds(rowViews)));
|
|
766
726
|
}
|
|
767
|
-
function readViewWelcome(rawViewWelcome, pluginViewsIds) {
|
|
727
|
+
export function readViewWelcome(rawViewWelcome, pluginViewsIds) {
|
|
768
728
|
return {
|
|
769
729
|
view: rawViewWelcome.view,
|
|
770
730
|
content: rawViewWelcome.contents,
|
|
@@ -773,12 +733,12 @@ function readViewWelcome(rawViewWelcome, pluginViewsIds) {
|
|
|
773
733
|
order: pluginViewsIds.findIndex(v => v === rawViewWelcome.view) > -1 ? 0 : 1
|
|
774
734
|
};
|
|
775
735
|
}
|
|
776
|
-
function extractPluginViewsIds(views) {
|
|
736
|
+
export function extractPluginViewsIds(views) {
|
|
777
737
|
const pluginViewsIds = [];
|
|
778
738
|
if (views) {
|
|
779
739
|
for (const location of Object.keys(views)) {
|
|
780
740
|
const viewsIds = views[location]
|
|
781
|
-
.filter(
|
|
741
|
+
.filter(isObject)
|
|
782
742
|
.map(view => view.id)
|
|
783
743
|
.filter((id) => typeof id === 'string');
|
|
784
744
|
pluginViewsIds.push(...viewsIds);
|
|
@@ -786,10 +746,10 @@ function extractPluginViewsIds(views) {
|
|
|
786
746
|
}
|
|
787
747
|
return pluginViewsIds;
|
|
788
748
|
}
|
|
789
|
-
function readMenus(rawMenus) {
|
|
749
|
+
export function readMenus(rawMenus) {
|
|
790
750
|
return rawMenus.map(rawMenu => readMenu(rawMenu));
|
|
791
751
|
}
|
|
792
|
-
function readMenu(rawMenu) {
|
|
752
|
+
export function readMenu(rawMenu) {
|
|
793
753
|
return {
|
|
794
754
|
command: rawMenu.command,
|
|
795
755
|
submenu: rawMenu.submenu,
|
|
@@ -798,13 +758,13 @@ function readMenu(rawMenu) {
|
|
|
798
758
|
when: rawMenu.when
|
|
799
759
|
};
|
|
800
760
|
}
|
|
801
|
-
async function readLanguages(ctx, rawLanguages, plugin) {
|
|
761
|
+
export async function readLanguages(ctx, rawLanguages, plugin) {
|
|
802
762
|
return Promise.all(rawLanguages.map(language => readLanguage(ctx, language, plugin)));
|
|
803
763
|
}
|
|
804
|
-
function readSubmenus(ctx, rawSubmenus, plugin) {
|
|
764
|
+
export function readSubmenus(ctx, rawSubmenus, plugin) {
|
|
805
765
|
return rawSubmenus.map(submenu => readSubmenu(ctx, submenu, plugin));
|
|
806
766
|
}
|
|
807
|
-
function readSubmenu(ctx, rawSubmenu, plugin) {
|
|
767
|
+
export function readSubmenu(ctx, rawSubmenu, plugin) {
|
|
808
768
|
const icon = ctx.transformIconUrl
|
|
809
769
|
? ctx.transformIconUrl(plugin, rawSubmenu.icon)
|
|
810
770
|
: transformIconUrl(ctx, plugin, rawSubmenu.icon);
|
|
@@ -814,7 +774,7 @@ function readSubmenu(ctx, rawSubmenu, plugin) {
|
|
|
814
774
|
label: rawSubmenu.label
|
|
815
775
|
};
|
|
816
776
|
}
|
|
817
|
-
async function readLanguage(ctx, rawLang, plugin) {
|
|
777
|
+
export async function readLanguage(ctx, rawLang, plugin) {
|
|
818
778
|
const icon = ctx.transformIconUrl
|
|
819
779
|
? ctx.transformIconUrl(plugin, rawLang.icon)
|
|
820
780
|
: transformIconUrl(ctx, plugin, rawLang.icon);
|
|
@@ -830,7 +790,7 @@ async function readLanguage(ctx, rawLang, plugin) {
|
|
|
830
790
|
};
|
|
831
791
|
if (typeof rawLang.configuration === 'string') {
|
|
832
792
|
const rawConfiguration = await readJson(ctx, path.resolve(plugin.packagePath, rawLang.configuration));
|
|
833
|
-
if (
|
|
793
|
+
if (isObject(rawConfiguration)) {
|
|
834
794
|
const configuration = {
|
|
835
795
|
brackets: Array.isArray(rawConfiguration.brackets)
|
|
836
796
|
? rawConfiguration.brackets.filter(isCharacterPair)
|
|
@@ -848,10 +808,10 @@ async function readLanguage(ctx, rawLang, plugin) {
|
|
|
848
808
|
}
|
|
849
809
|
return result;
|
|
850
810
|
}
|
|
851
|
-
function readDebuggers(rawDebuggers) {
|
|
811
|
+
export function readDebuggers(rawDebuggers) {
|
|
852
812
|
return rawDebuggers.map(rawDebug => readDebugger(rawDebug));
|
|
853
813
|
}
|
|
854
|
-
function readDebugger(rawDebugger) {
|
|
814
|
+
export function readDebugger(rawDebugger) {
|
|
855
815
|
return {
|
|
856
816
|
type: rawDebugger.type,
|
|
857
817
|
label: rawDebugger.label,
|
|
@@ -872,8 +832,8 @@ function readDebugger(rawDebugger) {
|
|
|
872
832
|
configurationAttributes: rawDebugger.configurationAttributes
|
|
873
833
|
};
|
|
874
834
|
}
|
|
875
|
-
function readTaskDefinition(pluginName, definitionContribution, ctx) {
|
|
876
|
-
const propertyKeys = definitionContribution.properties &&
|
|
835
|
+
export function readTaskDefinition(pluginName, definitionContribution, ctx) {
|
|
836
|
+
const propertyKeys = definitionContribution.properties && isObject(definitionContribution.properties)
|
|
877
837
|
? Object.keys(definitionContribution.properties)
|
|
878
838
|
: [];
|
|
879
839
|
const schema = (ctx?.toSchema ?? toSchema)(definitionContribution);
|
|
@@ -887,9 +847,9 @@ function readTaskDefinition(pluginName, definitionContribution, ctx) {
|
|
|
887
847
|
}
|
|
888
848
|
};
|
|
889
849
|
}
|
|
890
|
-
function toSchema(definition) {
|
|
850
|
+
export function toSchema(definition) {
|
|
891
851
|
const reconciliation = { ...definition, type: 'object' };
|
|
892
|
-
const schema =
|
|
852
|
+
const schema = deepClone(reconciliation);
|
|
893
853
|
if (schema.properties === undefined) {
|
|
894
854
|
// eslint-disable-next-line no-null/no-null
|
|
895
855
|
schema.properties = Object.create(null);
|
|
@@ -919,7 +879,7 @@ function extractValidAutoClosingPairs(ctx, langId, configuration) {
|
|
|
919
879
|
result.push({ open: pair[0], close: pair[1] });
|
|
920
880
|
}
|
|
921
881
|
else {
|
|
922
|
-
if (!
|
|
882
|
+
if (!isObject(pair)) {
|
|
923
883
|
ctx.onWarn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}]\` to be an array of two strings or an object.`);
|
|
924
884
|
continue;
|
|
925
885
|
}
|
|
@@ -932,7 +892,7 @@ function extractValidAutoClosingPairs(ctx, langId, configuration) {
|
|
|
932
892
|
continue;
|
|
933
893
|
}
|
|
934
894
|
if (typeof pair.notIn !== 'undefined') {
|
|
935
|
-
if (!
|
|
895
|
+
if (!isStringArray(pair.notIn)) {
|
|
936
896
|
ctx.onWarn(`[${langId}]: language configuration: expected \`autoClosingPairs[${i}].notIn\` to be a string array.`);
|
|
937
897
|
continue;
|
|
938
898
|
}
|
|
@@ -964,7 +924,7 @@ function extractValidSurroundingPairs(ctx, langId, configuration) {
|
|
|
964
924
|
result.push({ open: pair[0], close: pair[1] });
|
|
965
925
|
}
|
|
966
926
|
else {
|
|
967
|
-
if (!
|
|
927
|
+
if (!isObject(pair)) {
|
|
968
928
|
ctx.onWarn(`[${langId}]: language configuration: expected \`surroundingPairs[${i}]\` to be an array of two strings or an object.`);
|
|
969
929
|
continue;
|
|
970
930
|
}
|