Skip to content

Commit 85f70fd

Browse files
committed
Merge branch 'master' into joh/sigusr1
2 parents 0f2cda1 + 5fe0604 commit 85f70fd

122 files changed

Lines changed: 1400 additions & 1039 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extensions/json/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
".swcrc",
2828
".webmanifest",
2929
".js.map",
30-
".css.map"
30+
".css.map",
31+
".har"
3132
],
3233
"filenames": [
3334
"composer.lock",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-oss-dev",
33
"version": "1.40.0",
4-
"distro": "b9bb6392c20ba05a247e41ea75b2825544fd8afd",
4+
"distro": "fd32ba99f225d591cb667f0bdf23dbb481743eab",
55
"author": {
66
"name": "Microsoft Corporation"
77
},
@@ -153,4 +153,4 @@
153153
"windows-mutex": "0.3.0",
154154
"windows-process-tree": "0.2.4"
155155
}
156-
}
156+
}

scripts/code-cli.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if "%1"=="--builtin" goto builtin
2424
node build\lib\builtInExtensions.js
2525

2626
:: Build
27-
if not exist out node .\node_modules\gulp\bin\gulp.js compile
27+
if not exist out yarn compile
2828

2929
:: Configuration
3030
set ELECTRON_RUN_AS_NODE=1

scripts/code-cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function code() {
3535
node build/lib/builtInExtensions.js
3636

3737
# Build
38-
test -d out || ./node_modules/.bin/gulp compile
38+
test -d out || yarn compile
3939

4040
ELECTRON_RUN_AS_NODE=1 \
4141
NODE_ENV=development \

scripts/code.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if "%1"=="--builtin" goto builtin
2424
node build\lib\builtInExtensions.js
2525

2626
:: Build
27-
if not exist out node .\node_modules\gulp\bin\gulp.js compile
27+
if not exist out yarn compile
2828

2929
:: Configuration
3030
set NODE_ENV=development

scripts/code.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function code() {
3939
node build/lib/builtInExtensions.js
4040

4141
# Build
42-
test -d out || ./node_modules/.bin/gulp compile
42+
test -d out || yarn compile
4343

4444
# Configuration
4545
export NODE_ENV=development

src/vs/base/browser/ui/actionbar/actionbar.ts

Lines changed: 65 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ export interface IBaseActionViewItemOptions {
3333

3434
export class BaseActionViewItem extends Disposable implements IActionViewItem {
3535

36-
element?: HTMLElement;
36+
element: HTMLElement | undefined;
37+
3738
_context: any;
3839
_action: IAction;
3940

40-
private _actionRunner!: IActionRunner;
41+
private _actionRunner: IActionRunner | undefined;
4142

4243
constructor(context: any, action: IAction, protected options?: IBaseActionViewItemOptions) {
4344
super();
@@ -81,14 +82,18 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
8182
}
8283
}
8384

84-
set actionRunner(actionRunner: IActionRunner) {
85-
this._actionRunner = actionRunner;
86-
}
87-
8885
get actionRunner(): IActionRunner {
86+
if (!this._actionRunner) {
87+
this._actionRunner = this._register(new ActionRunner());
88+
}
89+
8990
return this._actionRunner;
9091
}
9192

93+
set actionRunner(actionRunner: IActionRunner) {
94+
this._actionRunner = actionRunner;
95+
}
96+
9297
getAction(): IAction {
9398
return this._action;
9499
}
@@ -102,27 +107,27 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
102107
}
103108

104109
render(container: HTMLElement): void {
105-
this.element = container;
110+
const element = this.element = container;
106111
this._register(Gesture.addTarget(container));
107112

108113
const enableDragging = this.options && this.options.draggable;
109114
if (enableDragging) {
110115
container.draggable = true;
111116
}
112117

113-
this._register(DOM.addDisposableListener(this.element, EventType.Tap, e => this.onClick(e)));
118+
this._register(DOM.addDisposableListener(element, EventType.Tap, e => this.onClick(e)));
114119

115-
this._register(DOM.addDisposableListener(this.element, DOM.EventType.MOUSE_DOWN, e => {
120+
this._register(DOM.addDisposableListener(element, DOM.EventType.MOUSE_DOWN, e => {
116121
if (!enableDragging) {
117122
DOM.EventHelper.stop(e, true); // do not run when dragging is on because that would disable it
118123
}
119124

120-
if (this._action.enabled && e.button === 0 && this.element) {
121-
DOM.addClass(this.element, 'active');
125+
if (this._action.enabled && e.button === 0) {
126+
DOM.addClass(element, 'active');
122127
}
123128
}));
124129

125-
this._register(DOM.addDisposableListener(this.element, DOM.EventType.CLICK, e => {
130+
this._register(DOM.addDisposableListener(element, DOM.EventType.CLICK, e => {
126131
DOM.EventHelper.stop(e, true);
127132
// See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Interact_with_the_clipboard
128133
// > Writing to the clipboard
@@ -139,14 +144,14 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
139144
}
140145
}));
141146

142-
this._register(DOM.addDisposableListener(this.element, DOM.EventType.DBLCLICK, e => {
147+
this._register(DOM.addDisposableListener(element, DOM.EventType.DBLCLICK, e => {
143148
DOM.EventHelper.stop(e, true);
144149
}));
145150

146151
[DOM.EventType.MOUSE_UP, DOM.EventType.MOUSE_OUT].forEach(event => {
147-
this._register(DOM.addDisposableListener(this.element!, event, e => {
152+
this._register(DOM.addDisposableListener(element, event, e => {
148153
DOM.EventHelper.stop(e);
149-
DOM.removeClass(this.element!, 'active');
154+
DOM.removeClass(element, 'active');
150155
}));
151156
});
152157
}
@@ -165,7 +170,7 @@ export class BaseActionViewItem extends Disposable implements IActionViewItem {
165170
}
166171
}
167172

168-
this._actionRunner.run(this._action, context);
173+
this.actionRunner.run(this._action, context);
169174
}
170175

171176
focus(): void {
@@ -232,7 +237,7 @@ export interface IActionViewItemOptions extends IBaseActionViewItemOptions {
232237

233238
export class ActionViewItem extends BaseActionViewItem {
234239

235-
protected label!: HTMLElement;
240+
protected label: HTMLElement | undefined;
236241
protected options: IActionViewItemOptions;
237242

238243
private cssClass?: string;
@@ -252,13 +257,17 @@ export class ActionViewItem extends BaseActionViewItem {
252257
if (this.element) {
253258
this.label = DOM.append(this.element, DOM.$('a.action-label'));
254259
}
255-
if (this._action.id === Separator.ID) {
256-
this.label.setAttribute('role', 'presentation'); // A separator is a presentation item
257-
} else {
258-
if (this.options.isMenu) {
259-
this.label.setAttribute('role', 'menuitem');
260+
261+
262+
if (this.label) {
263+
if (this._action.id === Separator.ID) {
264+
this.label.setAttribute('role', 'presentation'); // A separator is a presentation item
260265
} else {
261-
this.label.setAttribute('role', 'button');
266+
if (this.options.isMenu) {
267+
this.label.setAttribute('role', 'menuitem');
268+
} else {
269+
this.label.setAttribute('role', 'button');
270+
}
262271
}
263272
}
264273

@@ -276,11 +285,13 @@ export class ActionViewItem extends BaseActionViewItem {
276285
focus(): void {
277286
super.focus();
278287

279-
this.label.focus();
288+
if (this.label) {
289+
this.label.focus();
290+
}
280291
}
281292

282293
updateLabel(): void {
283-
if (this.options.label) {
294+
if (this.options.label && this.label) {
284295
this.label.textContent = this.getAction().label;
285296
}
286297
}
@@ -299,52 +310,65 @@ export class ActionViewItem extends BaseActionViewItem {
299310
}
300311
}
301312

302-
if (title) {
313+
if (title && this.label) {
303314
this.label.title = title;
304315
}
305316
}
306317

307318
updateClass(): void {
308-
if (this.cssClass) {
319+
if (this.cssClass && this.label) {
309320
DOM.removeClasses(this.label, this.cssClass);
310321
}
311322

312323
if (this.options.icon) {
313324
this.cssClass = this.getAction().class;
314-
DOM.addClass(this.label, 'codicon');
315-
if (this.cssClass) {
316-
DOM.addClasses(this.label, this.cssClass);
325+
326+
if (this.label) {
327+
DOM.addClass(this.label, 'codicon');
328+
if (this.cssClass) {
329+
DOM.addClasses(this.label, this.cssClass);
330+
}
317331
}
318332

319333
this.updateEnabled();
320334
} else {
321-
DOM.removeClass(this.label, 'codicon');
335+
if (this.label) {
336+
DOM.removeClass(this.label, 'codicon');
337+
}
322338
}
323339
}
324340

325341
updateEnabled(): void {
326342
if (this.getAction().enabled) {
327-
this.label.removeAttribute('aria-disabled');
343+
if (this.label) {
344+
this.label.removeAttribute('aria-disabled');
345+
DOM.removeClass(this.label, 'disabled');
346+
this.label.tabIndex = 0;
347+
}
348+
328349
if (this.element) {
329350
DOM.removeClass(this.element, 'disabled');
330351
}
331-
DOM.removeClass(this.label, 'disabled');
332-
this.label.tabIndex = 0;
333352
} else {
334-
this.label.setAttribute('aria-disabled', 'true');
353+
if (this.label) {
354+
this.label.setAttribute('aria-disabled', 'true');
355+
DOM.addClass(this.label, 'disabled');
356+
DOM.removeTabIndexAndUpdateFocus(this.label);
357+
}
358+
335359
if (this.element) {
336360
DOM.addClass(this.element, 'disabled');
337361
}
338-
DOM.addClass(this.label, 'disabled');
339-
DOM.removeTabIndexAndUpdateFocus(this.label);
340362
}
341363
}
342364

343365
updateChecked(): void {
344-
if (this.getAction().checked) {
345-
DOM.addClass(this.label, 'checked');
346-
} else {
347-
DOM.removeClass(this.label, 'checked');
366+
if (this.label) {
367+
if (this.getAction().checked) {
368+
DOM.addClass(this.label, 'checked');
369+
} else {
370+
DOM.removeClass(this.label, 'checked');
371+
}
348372
}
349373
}
350374
}

src/vs/base/browser/ui/checkbox/checkbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const defaultOpts = {
3838

3939
export class CheckboxActionViewItem extends BaseActionViewItem {
4040

41-
private checkbox!: Checkbox;
41+
private checkbox: Checkbox | undefined;
4242
private readonly disposables = new DisposableStore();
4343

4444
render(container: HTMLElement): void {
@@ -51,7 +51,7 @@ export class CheckboxActionViewItem extends BaseActionViewItem {
5151
title: this._action.label
5252
});
5353
this.disposables.add(this.checkbox);
54-
this.disposables.add(this.checkbox.onChange(() => this._action.checked = this.checkbox!.checked, this));
54+
this.disposables.add(this.checkbox.onChange(() => this._action.checked = !!this.checkbox && this.checkbox.checked, this));
5555
this.element.appendChild(this.checkbox.domNode);
5656
}
5757

src/vs/base/browser/ui/dialog/dialog.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ export class Dialog extends Disposable {
142142
let eventHandled = false;
143143
if (evt.equals(KeyMod.Shift | KeyCode.Tab) || evt.equals(KeyCode.LeftArrow)) {
144144
if (!this.checkboxHasFocus && focusedButton === 0) {
145-
this.checkbox!.domNode.focus();
145+
if (this.checkbox) {
146+
this.checkbox.domNode.focus();
147+
}
146148
this.checkboxHasFocus = true;
147149
} else {
148150
focusedButton = (this.checkboxHasFocus ? 0 : focusedButton) + buttonGroup.buttons.length - 1;
@@ -154,7 +156,9 @@ export class Dialog extends Disposable {
154156
eventHandled = true;
155157
} else if (evt.equals(KeyCode.Tab) || evt.equals(KeyCode.RightArrow)) {
156158
if (!this.checkboxHasFocus && focusedButton === buttonGroup.buttons.length - 1) {
157-
this.checkbox!.domNode.focus();
159+
if (this.checkbox) {
160+
this.checkbox.domNode.focus();
161+
}
158162
this.checkboxHasFocus = true;
159163
} else {
160164
focusedButton = this.checkboxHasFocus ? 0 : focusedButton + 1;

src/vs/base/browser/ui/dropdown/dropdown.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ export interface IDropdownMenuOptions extends IBaseDropdownOptions {
208208

209209
export class DropdownMenu extends BaseDropdown {
210210
private _contextMenuProvider: IContextMenuProvider;
211-
private _menuOptions: IMenuOptions;
212-
private _actions: ReadonlyArray<IAction>;
211+
private _menuOptions: IMenuOptions | undefined;
212+
private _actions: ReadonlyArray<IAction> = [];
213213
private actionProvider?: IActionProvider;
214214
private menuClassName: string;
215215

@@ -222,11 +222,11 @@ export class DropdownMenu extends BaseDropdown {
222222
this.menuClassName = options.menuClassName || '';
223223
}
224224

225-
set menuOptions(options: IMenuOptions) {
225+
set menuOptions(options: IMenuOptions | undefined) {
226226
this._menuOptions = options;
227227
}
228228

229-
get menuOptions(): IMenuOptions {
229+
get menuOptions(): IMenuOptions | undefined {
230230
return this._menuOptions;
231231
}
232232

@@ -256,7 +256,7 @@ export class DropdownMenu extends BaseDropdown {
256256
getMenuClassName: () => this.menuClassName,
257257
onHide: () => this.onHide(),
258258
actionRunner: this.menuOptions ? this.menuOptions.actionRunner : undefined,
259-
anchorAlignment: this.menuOptions.anchorAlignment
259+
anchorAlignment: this.menuOptions ? this.menuOptions.anchorAlignment : AnchorAlignment.LEFT
260260
});
261261
}
262262

@@ -345,7 +345,11 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
345345
super.setActionContext(newContext);
346346

347347
if (this.dropdownMenu) {
348-
this.dropdownMenu.menuOptions.context = newContext;
348+
if (this.dropdownMenu.menuOptions) {
349+
this.dropdownMenu.menuOptions.context = newContext;
350+
} else {
351+
this.dropdownMenu.menuOptions = { context: newContext };
352+
}
349353
}
350354
}
351355

0 commit comments

Comments
 (0)