@theia/core 1.38.0-next.7 → 1.39.0-next.1
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/README.md +7 -7
- package/i18n/nls.cs.json +1 -4
- package/i18n/nls.de.json +1 -4
- package/i18n/nls.es.json +1 -4
- package/i18n/nls.fr.json +1 -4
- package/i18n/nls.hu.json +1 -4
- package/i18n/nls.it.json +1 -4
- package/i18n/nls.ja.json +1 -4
- package/i18n/nls.json +1 -4
- package/i18n/nls.pl.json +1 -4
- package/i18n/nls.pt-br.json +1 -4
- package/i18n/nls.pt-pt.json +1 -4
- package/i18n/nls.ru.json +1 -4
- package/i18n/nls.zh-cn.json +1 -4
- package/lib/browser/about-dialog.d.ts +2 -1
- package/lib/browser/about-dialog.d.ts.map +1 -1
- package/lib/browser/about-dialog.js +5 -2
- package/lib/browser/about-dialog.js.map +1 -1
- package/lib/browser/common-frontend-contribution.js +3 -3
- package/lib/browser/common-frontend-contribution.js.map +1 -1
- package/lib/browser/common-styling-participants.d.ts.map +1 -1
- package/lib/browser/common-styling-participants.js +20 -0
- package/lib/browser/common-styling-participants.js.map +1 -1
- package/lib/browser/core-preferences.js +1 -1
- package/lib/browser/core-preferences.js.map +1 -1
- package/lib/browser/endpoint.js +3 -3
- package/lib/browser/endpoint.js.map +1 -1
- package/lib/browser/frontend-application-bindings.js +1 -1
- package/lib/browser/frontend-application-bindings.js.map +1 -1
- package/lib/browser/frontend-application-module.js +1 -1
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/keybinding.js +1 -1
- package/lib/browser/keybinding.js.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts +2 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.js +6 -3
- package/lib/browser/keyboard/browser-keyboard-layout-provider.js.map +1 -1
- package/lib/browser/label-provider.js +1 -1
- package/lib/browser/label-provider.js.map +1 -1
- package/lib/browser/preferences/injectable-preference-proxy.d.ts +1 -1
- package/lib/browser/preferences/injectable-preference-proxy.d.ts.map +1 -1
- package/lib/browser/preferences/injectable-preference-proxy.js +5 -4
- package/lib/browser/preferences/injectable-preference-proxy.js.map +1 -1
- package/lib/browser/preferences/preference-proxy.js +2 -2
- package/lib/browser/preferences/preference-proxy.js.map +1 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.js +25 -1
- package/lib/browser/quick-input/quick-command-frontend-contribution.js.map +1 -1
- package/lib/browser/quick-input/quick-command-service.d.ts +1 -0
- package/lib/browser/quick-input/quick-command-service.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-command-service.js +4 -1
- package/lib/browser/quick-input/quick-command-service.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts +2 -0
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.d.ts.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js +23 -8
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js.map +1 -1
- package/lib/browser/tree/search-box-debounce.js +1 -1
- package/lib/browser/tree/search-box-debounce.js.map +1 -1
- package/lib/browser/view-container.d.ts +10 -0
- package/lib/browser/view-container.d.ts.map +1 -1
- package/lib/browser/view-container.js +15 -1
- package/lib/browser/view-container.js.map +1 -1
- package/lib/browser/widget-decoration.js +1 -1
- package/lib/browser/widget-decoration.js.map +1 -1
- package/lib/common/command.d.ts +1 -0
- package/lib/common/command.d.ts.map +1 -1
- package/lib/common/command.js.map +1 -1
- package/lib/common/glob.js +5 -5
- package/lib/common/glob.js.map +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -0
- package/lib/common/index.js.map +1 -1
- package/lib/common/logger.d.ts +3 -6
- package/lib/common/logger.d.ts.map +1 -1
- package/lib/common/logger.js +29 -22
- package/lib/common/logger.js.map +1 -1
- package/lib/common/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/common/messaging/proxy-factory.js +4 -0
- package/lib/common/messaging/proxy-factory.js.map +1 -1
- package/lib/common/objects.d.ts +1 -0
- package/lib/common/objects.d.ts.map +1 -1
- package/lib/common/objects.js +43 -1
- package/lib/common/objects.js.map +1 -1
- package/lib/common/path.js +9 -9
- package/lib/common/path.js.map +1 -1
- package/lib/common/paths.js +1 -1
- package/lib/common/paths.js.map +1 -1
- package/lib/common/performance/stopwatch.d.ts +1 -1
- package/lib/common/performance/stopwatch.d.ts.map +1 -1
- package/lib/common/performance/stopwatch.js.map +1 -1
- package/lib/common/severity.js +1 -1
- package/lib/common/severity.js.map +1 -1
- package/lib/common/telemetry.d.ts +20 -0
- package/lib/common/telemetry.d.ts.map +1 -0
- package/lib/common/telemetry.js +25 -0
- package/lib/common/telemetry.js.map +1 -0
- package/lib/electron-browser/keyboard/electron-keyboard-layout-change-notifier.d.ts +1 -1
- package/lib/electron-browser/keyboard/electron-keyboard-layout-change-notifier.d.ts.map +1 -1
- package/lib/electron-browser/keyboard/electron-keyboard-layout-change-notifier.js +2 -2
- package/lib/electron-browser/keyboard/electron-keyboard-layout-change-notifier.js.map +1 -1
- package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts +2 -1
- package/lib/electron-browser/menu/electron-context-menu-renderer.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-context-menu-renderer.js +5 -2
- package/lib/electron-browser/menu/electron-context-menu-renderer.js.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts +5 -0
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.js +4 -3
- package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
- package/lib/electron-browser/preload.js +1 -1
- package/lib/electron-browser/preload.js.map +1 -1
- package/lib/electron-common/electron-api.d.ts +1 -1
- package/lib/electron-common/electron-api.d.ts.map +1 -1
- package/lib/electron-main/electron-api-main.d.ts.map +1 -1
- package/lib/electron-main/electron-api-main.js +3 -1
- package/lib/electron-main/electron-api-main.js.map +1 -1
- package/lib/electron-node/token/electron-token-validator.d.ts +1 -1
- package/lib/electron-node/token/electron-token-validator.d.ts.map +1 -1
- package/lib/electron-node/token/electron-token-validator.js +2 -2
- package/lib/electron-node/token/electron-token-validator.js.map +1 -1
- package/lib/node/backend-application-module.d.ts.map +1 -1
- package/lib/node/backend-application-module.js +2 -0
- package/lib/node/backend-application-module.js.map +1 -1
- package/lib/node/backend-application.d.ts +1 -0
- package/lib/node/backend-application.d.ts.map +1 -1
- package/lib/node/backend-application.js +5 -2
- package/lib/node/backend-application.js.map +1 -1
- package/lib/node/filesystem-locking.d.ts +24 -0
- package/lib/node/filesystem-locking.d.ts.map +1 -0
- package/lib/node/filesystem-locking.js +71 -0
- package/lib/node/filesystem-locking.js.map +1 -0
- package/lib/node/hosting/backend-application-hosts.d.ts +1 -1
- package/lib/node/hosting/backend-application-hosts.d.ts.map +1 -1
- package/lib/node/hosting/backend-application-hosts.js +2 -2
- package/lib/node/hosting/backend-application-hosts.js.map +1 -1
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +3 -0
- package/lib/node/index.js.map +1 -1
- package/lib/node/messaging/ipc-connection-provider.js +1 -1
- package/lib/node/messaging/ipc-connection-provider.js.map +1 -1
- package/package.json +8 -7
- package/src/browser/about-dialog.tsx +5 -1
- package/src/browser/common-frontend-contribution.ts +3 -3
- package/src/browser/common-styling-participants.ts +20 -0
- package/src/browser/core-preferences.ts +1 -1
- package/src/browser/endpoint.ts +3 -3
- package/src/browser/frontend-application-bindings.ts +1 -1
- package/src/browser/frontend-application-module.ts +2 -2
- package/src/browser/keybinding.ts +1 -1
- package/src/browser/keyboard/browser-keyboard-layout-provider.ts +5 -1
- package/src/browser/label-provider.ts +1 -1
- package/src/browser/preferences/injectable-preference-proxy.ts +5 -4
- package/src/browser/preferences/preference-proxy.ts +2 -2
- package/src/browser/quick-input/quick-command-frontend-contribution.ts +26 -2
- package/src/browser/quick-input/quick-command-service.ts +4 -0
- package/src/browser/shell/tab-bar-toolbar/tab-bar-toolbar.tsx +23 -6
- package/src/browser/tree/search-box-debounce.ts +1 -1
- package/src/browser/view-container.ts +21 -0
- package/src/browser/widget-decoration.ts +1 -1
- package/src/common/command.ts +1 -0
- package/src/common/glob.ts +5 -5
- package/src/common/i18n/nls.metadata.json +16592 -14032
- package/src/common/index.ts +1 -0
- package/src/common/logger.ts +12 -14
- package/src/common/messaging/proxy-factory.ts +4 -0
- package/src/common/objects.ts +48 -1
- package/src/common/path.ts +9 -9
- package/src/common/paths.ts +1 -1
- package/src/common/performance/stopwatch.ts +1 -1
- package/src/common/severity.ts +1 -1
- package/src/common/telemetry.ts +45 -0
- package/src/electron-browser/keyboard/electron-keyboard-layout-change-notifier.ts +1 -1
- package/src/electron-browser/menu/electron-context-menu-renderer.ts +5 -1
- package/src/electron-browser/menu/electron-main-menu-factory.ts +10 -3
- package/src/electron-browser/preload.ts +1 -1
- package/src/electron-common/electron-api.ts +1 -1
- package/src/electron-main/electron-api-main.ts +3 -1
- package/src/electron-node/token/electron-token-validator.ts +1 -1
- package/src/node/backend-application-module.ts +3 -0
- package/src/node/backend-application.ts +4 -0
- package/src/node/filesystem-locking.ts +77 -0
- package/src/node/hosting/backend-application-hosts.ts +1 -1
- package/src/node/index.ts +1 -0
- package/src/node/messaging/ipc-connection-provider.ts +1 -1
|
@@ -228,12 +228,12 @@ export function createPreferenceProxy<T>(preferences: PreferenceService, promise
|
|
|
228
228
|
if (p.startsWith(prefix)) {
|
|
229
229
|
const idx = p.indexOf('.', prefix.length);
|
|
230
230
|
if (idx !== -1 && isDeep) {
|
|
231
|
-
const pre = p.
|
|
231
|
+
const pre = p.substring(prefix.length, idx);
|
|
232
232
|
if (properties.indexOf(pre) === -1) {
|
|
233
233
|
properties.push(pre);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
const prop = p.
|
|
236
|
+
const prop = p.substring(prefix.length);
|
|
237
237
|
if (isFlat || prop.indexOf('.') === -1) {
|
|
238
238
|
properties.push(prop);
|
|
239
239
|
}
|
|
@@ -17,8 +17,9 @@ import { injectable, inject, optional } from 'inversify';
|
|
|
17
17
|
import { CommandRegistry, CommandContribution, MenuContribution, MenuModelRegistry, nls } from '../../common';
|
|
18
18
|
import { KeybindingRegistry, KeybindingContribution } from '../keybinding';
|
|
19
19
|
import { CommonMenus } from '../common-frontend-contribution';
|
|
20
|
-
import { CLEAR_COMMAND_HISTORY, quickCommand, QuickCommandService } from './quick-command-service';
|
|
20
|
+
import { CLOSE_QUICK_OPEN, CLEAR_COMMAND_HISTORY, quickCommand, QuickCommandService } from './quick-command-service';
|
|
21
21
|
import { QuickInputService } from './quick-input-service';
|
|
22
|
+
import { ConfirmDialog, Dialog } from '../dialogs';
|
|
22
23
|
|
|
23
24
|
@injectable()
|
|
24
25
|
export class QuickCommandFrontendContribution implements CommandContribution, KeybindingContribution, MenuContribution {
|
|
@@ -36,7 +37,20 @@ export class QuickCommandFrontendContribution implements CommandContribution, Ke
|
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
commands.registerCommand(CLEAR_COMMAND_HISTORY, {
|
|
39
|
-
execute: () =>
|
|
40
|
+
execute: async () => {
|
|
41
|
+
const shouldClear = await new ConfirmDialog({
|
|
42
|
+
title: nls.localizeByDefault('Clear Command History'),
|
|
43
|
+
msg: nls.localizeByDefault('Do you want to clear the history of recently used commands?'),
|
|
44
|
+
ok: nls.localizeByDefault('Clear'),
|
|
45
|
+
cancel: Dialog.CANCEL,
|
|
46
|
+
}).open();
|
|
47
|
+
if (shouldClear) {
|
|
48
|
+
commands.clearCommandHistory();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
commands.registerCommand(CLOSE_QUICK_OPEN, {
|
|
53
|
+
execute: () => this.quickInputService?.hide()
|
|
40
54
|
});
|
|
41
55
|
}
|
|
42
56
|
|
|
@@ -56,5 +70,15 @@ export class QuickCommandFrontendContribution implements CommandContribution, Ke
|
|
|
56
70
|
command: quickCommand.id,
|
|
57
71
|
keybinding: 'ctrlcmd+shift+p'
|
|
58
72
|
});
|
|
73
|
+
keybindings.registerKeybinding({
|
|
74
|
+
command: CLOSE_QUICK_OPEN.id,
|
|
75
|
+
keybinding: 'esc',
|
|
76
|
+
when: 'inQuickOpen'
|
|
77
|
+
});
|
|
78
|
+
keybindings.registerKeybinding({
|
|
79
|
+
command: CLOSE_QUICK_OPEN.id,
|
|
80
|
+
keybinding: 'shift+esc',
|
|
81
|
+
when: 'inQuickOpen'
|
|
82
|
+
});
|
|
59
83
|
}
|
|
60
84
|
}
|
|
@@ -33,6 +33,10 @@ export const CLEAR_COMMAND_HISTORY = Command.toDefaultLocalizedCommand({
|
|
|
33
33
|
label: 'Clear Command History'
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
export const CLOSE_QUICK_OPEN: Command = {
|
|
37
|
+
id: 'workbench.action.closeQuickOpen'
|
|
38
|
+
};
|
|
39
|
+
|
|
36
40
|
@injectable()
|
|
37
41
|
export class QuickCommandService implements QuickAccessContribution, QuickAccessProvider {
|
|
38
42
|
static PREFIX = '>';
|
|
@@ -43,6 +43,7 @@ export class TabBarToolbar extends ReactWidget {
|
|
|
43
43
|
protected more = new Map<string, TabBarToolbarItem>();
|
|
44
44
|
|
|
45
45
|
protected contextKeyListener: Disposable | undefined;
|
|
46
|
+
protected toDisposeOnUpdateItems: DisposableCollection = new DisposableCollection();
|
|
46
47
|
|
|
47
48
|
@inject(CommandRegistry) protected readonly commands: CommandRegistry;
|
|
48
49
|
@inject(LabelParser) protected readonly labelParser: LabelParser;
|
|
@@ -59,11 +60,20 @@ export class TabBarToolbar extends ReactWidget {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
updateItems(items: Array<TabBarToolbarItem | ReactTabBarToolbarItem>, current: Widget | undefined): void {
|
|
63
|
+
this.toDisposeOnUpdateItems.dispose();
|
|
64
|
+
this.toDisposeOnUpdateItems = new DisposableCollection();
|
|
62
65
|
this.inline.clear();
|
|
63
66
|
this.more.clear();
|
|
64
67
|
|
|
65
68
|
const contextKeys = new Set<string>();
|
|
66
69
|
for (const item of items.sort(TabBarToolbarItem.PRIORITY_COMPARATOR).reverse()) {
|
|
70
|
+
if ('command' in item) {
|
|
71
|
+
this.commands.getAllHandlers(item.command).forEach(handler => {
|
|
72
|
+
if (handler.onDidChangeEnabled) {
|
|
73
|
+
this.toDisposeOnUpdateItems.push(handler.onDidChangeEnabled(() => this.update()));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
67
77
|
if ('render' in item || item.group === undefined || item.group === 'navigation') {
|
|
68
78
|
this.inline.set(item.id, item);
|
|
69
79
|
} else {
|
|
@@ -149,7 +159,6 @@ export class TabBarToolbar extends ReactWidget {
|
|
|
149
159
|
const tooltip = item.tooltip || (command && command.label);
|
|
150
160
|
|
|
151
161
|
const toolbarItemClassNames = this.getToolbarItemClassNames(item);
|
|
152
|
-
if (item.menuPath && !item.command) { toolbarItemClassNames.push('enabled'); }
|
|
153
162
|
return <div key={item.id}
|
|
154
163
|
className={toolbarItemClassNames.join(' ')}
|
|
155
164
|
onMouseDown={this.onMouseDownEvent}
|
|
@@ -162,10 +171,18 @@ export class TabBarToolbar extends ReactWidget {
|
|
|
162
171
|
</div>;
|
|
163
172
|
}
|
|
164
173
|
|
|
174
|
+
protected isEnabled(item: AnyToolbarItem): boolean {
|
|
175
|
+
if (!!item.command) {
|
|
176
|
+
return this.commandIsEnabled(item.command) && this.evaluateWhenClause(item.when);
|
|
177
|
+
} else {
|
|
178
|
+
return !!item.menuPath;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
165
182
|
protected getToolbarItemClassNames(item: AnyToolbarItem): string[] {
|
|
166
183
|
const classNames = [TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM];
|
|
167
184
|
if (item.command) {
|
|
168
|
-
if (this.
|
|
185
|
+
if (this.isEnabled(item)) {
|
|
169
186
|
classNames.push('enabled');
|
|
170
187
|
}
|
|
171
188
|
if (this.commandIsToggled(item.command)) {
|
|
@@ -254,15 +271,15 @@ export class TabBarToolbar extends ReactWidget {
|
|
|
254
271
|
|
|
255
272
|
const item: AnyToolbarItem | undefined = this.inline.get(e.currentTarget.id);
|
|
256
273
|
|
|
257
|
-
if (!this.
|
|
274
|
+
if (!item || !this.isEnabled(item)) {
|
|
258
275
|
return;
|
|
259
276
|
}
|
|
260
277
|
|
|
261
|
-
if (item
|
|
278
|
+
if (item.command && item.menuPath) {
|
|
262
279
|
this.menuCommandExecutor.executeCommand(item.menuPath, item.command, this.current);
|
|
263
|
-
} else if (item
|
|
280
|
+
} else if (item.command) {
|
|
264
281
|
this.commands.executeCommand(item.command, this.current);
|
|
265
|
-
} else if (item
|
|
282
|
+
} else if (item.menuPath) {
|
|
266
283
|
this.renderMoreContextMenu(this.toAnchor(e), item.menuPath);
|
|
267
284
|
}
|
|
268
285
|
this.update();
|
|
@@ -67,7 +67,7 @@ export class SearchBoxDebounce implements Disposable {
|
|
|
67
67
|
this.state = input;
|
|
68
68
|
} else {
|
|
69
69
|
if (input === '\b') {
|
|
70
|
-
this.state = this.state.length === 1 ? '' : this.state.
|
|
70
|
+
this.state = this.state.length === 1 ? '' : this.state.substring(0, this.state.length - 1);
|
|
71
71
|
} else {
|
|
72
72
|
this.state += input;
|
|
73
73
|
}
|
|
@@ -76,6 +76,20 @@ export namespace BadgeWidget {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* A widget that may change it's internal structure dynamically.
|
|
81
|
+
* Current use is to update the toolbar when a contributed view is constructed "lazily".
|
|
82
|
+
*/
|
|
83
|
+
export interface DynamicToolbarWidget {
|
|
84
|
+
onDidChangeToolbarItems: CommonEvent<void>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export namespace DynamicToolbarWidget {
|
|
88
|
+
export function is(arg: unknown): arg is DynamicToolbarWidget {
|
|
89
|
+
return isObject(arg) && 'onDidChangeToolbarItems' in arg;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
79
93
|
/**
|
|
80
94
|
* A view container holds an arbitrary number of widgets inside a split panel.
|
|
81
95
|
* Each widget is wrapped in a _part_ that displays the widget title and toolbar
|
|
@@ -970,6 +984,13 @@ export class ViewContainerPart extends BaseWidget {
|
|
|
970
984
|
this.wrapped.onDidChangeBadgeTooltip(() => this.onDidChangeBadgeTooltipEmitter.fire(), undefined, this.toDispose);
|
|
971
985
|
}
|
|
972
986
|
|
|
987
|
+
if (DynamicToolbarWidget.is(this.wrapped)) {
|
|
988
|
+
this.wrapped.onDidChangeToolbarItems(() => {
|
|
989
|
+
this.toolbar.updateTarget(this.wrapped);
|
|
990
|
+
this.viewContainer?.update();
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
|
|
973
994
|
const { header, body, disposable } = this.createContent();
|
|
974
995
|
this.header = header;
|
|
975
996
|
this.body = body;
|
|
@@ -284,7 +284,7 @@ export namespace WidgetDecoration {
|
|
|
284
284
|
result.push({ data });
|
|
285
285
|
}
|
|
286
286
|
const { length } = ranges.splice(containerIndex, 1).shift()!;
|
|
287
|
-
result.push({ data: caption.
|
|
287
|
+
result.push({ data: caption.substring(i, i + length), highlight: true });
|
|
288
288
|
data = '';
|
|
289
289
|
i = i + length - 1;
|
|
290
290
|
}
|
package/src/common/command.ts
CHANGED
|
@@ -122,6 +122,7 @@ export interface CommandHandler {
|
|
|
122
122
|
*/
|
|
123
123
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
124
|
isEnabled?(...args: any[]): boolean;
|
|
125
|
+
onDidChangeEnabled?: Event<void>;
|
|
125
126
|
/**
|
|
126
127
|
* Test whether menu items for this handler should be visible.
|
|
127
128
|
*/
|
package/src/common/glob.ts
CHANGED
|
@@ -329,7 +329,7 @@ function parsePattern(arg1: string | IRelativePattern, options: IGlobOptions): P
|
|
|
329
329
|
// Check for Trivias
|
|
330
330
|
let match: RegExpExecArray;
|
|
331
331
|
if (T1.test(pattern)) { // common pattern: **/*.txt just need endsWith check
|
|
332
|
-
const base = pattern.
|
|
332
|
+
const base = pattern.substring(4); // '**/*'.length === 4
|
|
333
333
|
parsedPattern = function (path, basename): string {
|
|
334
334
|
return path && strings.endsWith(path, base) ? pattern : null!;
|
|
335
335
|
};
|
|
@@ -338,7 +338,7 @@ function parsePattern(arg1: string | IRelativePattern, options: IGlobOptions): P
|
|
|
338
338
|
} else if ((options.trimForExclusions ? T3_2 : T3).test(pattern)) { // repetition of common patterns (see above) {**/*.txt,**/*.png}
|
|
339
339
|
parsedPattern = trivia3(pattern, options);
|
|
340
340
|
} else if (match = T4.exec(trimForExclusions(pattern, options))!) { // common pattern: **/something/else just need endsWith check
|
|
341
|
-
parsedPattern = trivia4and5(match[1].
|
|
341
|
+
parsedPattern = trivia4and5(match[1].substring(1), pattern, true);
|
|
342
342
|
} else if (match = T5.exec(trimForExclusions(pattern, options))!) { // common pattern: something/else just need equals check
|
|
343
343
|
parsedPattern = trivia4and5(match[1], pattern, false);
|
|
344
344
|
}
|
|
@@ -370,7 +370,7 @@ function wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string |
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
function trimForExclusions(pattern: string, options: IGlobOptions): string {
|
|
373
|
-
return options.trimForExclusions && strings.endsWith(pattern, '/**') ? pattern.
|
|
373
|
+
return options.trimForExclusions && strings.endsWith(pattern, '/**') ? pattern.substring(0, pattern.length - 2) : pattern; // dropping **, tailing / is dropped later
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
// common pattern: **/some.txt just need basename check
|
|
@@ -632,7 +632,7 @@ function parsedExpression(expression: IExpression, options: IGlobOptions): Parse
|
|
|
632
632
|
basename = paths.basename(path);
|
|
633
633
|
}
|
|
634
634
|
if (!name) {
|
|
635
|
-
name = basename.
|
|
635
|
+
name = basename.substring(0, basename.length - paths.extname(path).length);
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
const result = parsedPattern(path, basename, name, hasSibling!);
|
|
@@ -726,7 +726,7 @@ function aggregateBasenameMatches(parsedPatterns: (ParsedStringPattern | ParsedE
|
|
|
726
726
|
break;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
basename = path.
|
|
729
|
+
basename = path.substring(i);
|
|
730
730
|
}
|
|
731
731
|
const index = basenames.indexOf(basename);
|
|
732
732
|
return index !== -1 ? patterns[index] : null!;
|