Skip to content

Commit 033910d

Browse files
committed
Naming: CheckboxList > List (#49340)
1 parent c249ac2 commit 033910d

File tree

3 files changed

+96
-94
lines changed

3 files changed

+96
-94
lines changed

src/vs/workbench/browser/parts/quickinput/quickInput.css

+10-10
Original file line numberDiff line numberDiff line change
@@ -65,35 +65,35 @@
6565
height: 2px;
6666
}
6767

68-
.quick-input-checkbox-list {
68+
.quick-input-list {
6969
line-height: 22px;
7070
}
7171

72-
.quick-input-checkbox-list .monaco-list {
72+
.quick-input-list .monaco-list {
7373
overflow: hidden;
7474
max-height: calc(20 * 22px);
7575
}
7676

77-
.quick-input-checkbox-list .quick-input-checkbox-list-entry {
77+
.quick-input-list .quick-input-list-entry {
7878
overflow: hidden;
7979
display: flex;
8080
height: 100%;
8181
padding: 0 6px;
8282
}
8383

84-
.quick-input-checkbox-list .quick-input-checkbox-list-label {
84+
.quick-input-list .quick-input-list-label {
8585
overflow: hidden;
8686
display: flex;
8787
height: 100%;
8888
flex: 1;
8989
}
9090

91-
.quick-input-checkbox-list .quick-input-checkbox-list-checkbox {
91+
.quick-input-list .quick-input-list-checkbox {
9292
align-self: center;
9393
margin: 0;
9494
}
9595

96-
.quick-input-checkbox-list .quick-input-checkbox-list-rows {
96+
.quick-input-list .quick-input-list-rows {
9797
overflow: hidden;
9898
text-overflow: ellipsis;
9999
display: flex;
@@ -103,20 +103,20 @@
103103
margin-left: 5px;
104104
}
105105

106-
.quick-input-widget[data-type=pickMany] .quick-input-checkbox-list .quick-input-checkbox-list-rows {
106+
.quick-input-widget[data-type=pickMany] .quick-input-list .quick-input-list-rows {
107107
margin-left: 10px;
108108
}
109109

110-
.quick-input-checkbox-list .quick-input-checkbox-list-rows > .quick-input-checkbox-list-row {
110+
.quick-input-list .quick-input-list-rows > .quick-input-list-row {
111111
display: flex;
112112
align-items: center;
113113
}
114114

115-
.quick-input-checkbox-list .quick-input-checkbox-list-rows .monaco-highlighted-label span {
115+
.quick-input-list .quick-input-list-rows .monaco-highlighted-label span {
116116
opacity: 1;
117117
}
118118

119-
.quick-input-checkbox-list .quick-input-checkbox-list-label-meta {
119+
.quick-input-list .quick-input-list-label-meta {
120120
opacity: 0.7;
121121
line-height: normal;
122122
}

src/vs/workbench/browser/parts/quickinput/quickInput.ts

+45-45
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { SIDE_BAR_BACKGROUND, SIDE_BAR_FOREGROUND } from 'vs/workbench/common/th
1717
import { IQuickOpenService, IPickOpenEntry, IPickOptions, IInputOptions } from 'vs/platform/quickOpen/common/quickOpen';
1818
import { TPromise } from 'vs/base/common/winjs.base';
1919
import { CancellationToken } from 'vs/base/common/cancellation';
20-
import { QuickInputCheckboxList } from './quickInputCheckboxList';
20+
import { QuickInputList } from './quickInputList';
2121
import { QuickInputBox } from './quickInputBox';
2222
import { KeyCode } from 'vs/base/common/keyCodes';
2323
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
@@ -77,7 +77,7 @@ interface QuickInputUI {
7777
inputBox: QuickInputBox;
7878
count: CountBadge;
7979
message: HTMLElement;
80-
checkboxList: QuickInputCheckboxList;
80+
list: QuickInputList;
8181
close: (ok?: true | Thenable<never>) => void;
8282
}
8383

@@ -89,7 +89,7 @@ interface InputController<R> {
8989
}
9090

9191
class PickOneController<T extends IPickOpenEntry> implements InputController<T> {
92-
public showUI = { inputBox: true, checkboxList: true };
92+
public showUI = { inputBox: true, list: true };
9393
public result: TPromise<T>;
9494
public ready: TPromise<void>;
9595
public resolve: (ok?: true | Thenable<never>) => void;
@@ -99,43 +99,43 @@ class PickOneController<T extends IPickOpenEntry> implements InputController<T>
9999

100100
constructor(ui: QuickInputUI, parameters: PickOneParameters<T>) {
101101
this.result = new TPromise<T>((resolve, reject, progress) => {
102-
this.resolve = ok => resolve(ok === true ? <T>ui.checkboxList.getFocusedElements()[0] : ok);
102+
this.resolve = ok => resolve(ok === true ? <T>ui.list.getFocusedElements()[0] : ok);
103103
this.progress = progress;
104104
});
105105
this.result.then(() => this.dispose());
106106

107107
ui.inputBox.value = '';
108108
ui.inputBox.setPlaceholder(parameters.placeHolder || '');
109-
ui.checkboxList.matchOnDescription = parameters.matchOnDescription;
110-
ui.checkboxList.matchOnDetail = parameters.matchOnDetail;
111-
ui.checkboxList.setElements([]);
109+
ui.list.matchOnDescription = parameters.matchOnDescription;
110+
ui.list.matchOnDetail = parameters.matchOnDetail;
111+
ui.list.setElements([]);
112112

113113
this.ready = parameters.picks.then(elements => {
114114
if (this.closed) {
115115
return;
116116
}
117117

118-
ui.checkboxList.setElements(elements);
119-
ui.checkboxList.filter(ui.inputBox.value);
120-
ui.checkboxList.focus('First');
118+
ui.list.setElements(elements);
119+
ui.list.filter(ui.inputBox.value);
120+
ui.list.focus('First');
121121

122122
this.disposables.push(
123-
ui.checkboxList.onSelectionChange(elements => {
123+
ui.list.onSelectionChange(elements => {
124124
if (elements[0]) {
125125
ui.close(true);
126126
}
127127
}),
128128
ui.inputBox.onDidChange(value => {
129-
ui.checkboxList.filter(value);
130-
ui.checkboxList.focus('First');
129+
ui.list.filter(value);
130+
ui.list.focus('First');
131131
}),
132132
ui.inputBox.onKeyDown(event => {
133133
switch (event.keyCode) {
134134
case KeyCode.DownArrow:
135-
ui.checkboxList.focus('Next');
135+
ui.list.focus('Next');
136136
break;
137137
case KeyCode.UpArrow:
138-
ui.checkboxList.focus('Previous');
138+
ui.list.focus('Previous');
139139
break;
140140
}
141141
})
@@ -150,7 +150,7 @@ class PickOneController<T extends IPickOpenEntry> implements InputController<T>
150150
}
151151

152152
class PickManyController<T extends IPickOpenEntry> implements InputController<T[]> {
153-
public showUI = { checkAll: true, inputBox: true, count: true, ok: true, checkboxList: true };
153+
public showUI = { checkAll: true, inputBox: true, count: true, ok: true, list: true };
154154
public result: TPromise<T[]>;
155155
public ready: TPromise<void>;
156156
public resolve: (ok?: true | Thenable<never>) => void;
@@ -160,42 +160,42 @@ class PickManyController<T extends IPickOpenEntry> implements InputController<T[
160160

161161
constructor(ui: QuickInputUI, parameters: PickManyParameters<T>) {
162162
this.result = new TPromise<T[]>((resolve, reject, progress) => {
163-
this.resolve = ok => resolve(ok === true ? <T[]>ui.checkboxList.getCheckedElements() : ok);
163+
this.resolve = ok => resolve(ok === true ? <T[]>ui.list.getCheckedElements() : ok);
164164
this.progress = progress;
165165
});
166166
this.result.then(() => this.dispose());
167167

168168
ui.inputBox.value = '';
169169
ui.inputBox.setPlaceholder(parameters.placeHolder || '');
170-
ui.checkboxList.matchOnDescription = parameters.matchOnDescription;
171-
ui.checkboxList.matchOnDetail = parameters.matchOnDetail;
172-
ui.checkboxList.setElements([]);
173-
ui.checkAll.checked = ui.checkboxList.getAllVisibleChecked();
174-
ui.count.setCount(ui.checkboxList.getCheckedCount());
170+
ui.list.matchOnDescription = parameters.matchOnDescription;
171+
ui.list.matchOnDetail = parameters.matchOnDetail;
172+
ui.list.setElements([]);
173+
ui.checkAll.checked = ui.list.getAllVisibleChecked();
174+
ui.count.setCount(ui.list.getCheckedCount());
175175

176176
this.ready = parameters.picks.then(elements => {
177177
if (this.closed) {
178178
return;
179179
}
180180

181-
ui.checkboxList.setElements(elements, true);
182-
ui.checkboxList.filter(ui.inputBox.value);
183-
ui.checkAll.checked = ui.checkboxList.getAllVisibleChecked();
184-
ui.count.setCount(ui.checkboxList.getCheckedCount());
181+
ui.list.setElements(elements, true);
182+
ui.list.filter(ui.inputBox.value);
183+
ui.checkAll.checked = ui.list.getAllVisibleChecked();
184+
ui.count.setCount(ui.list.getCheckedCount());
185185

186186
this.disposables.push(
187187
ui.inputBox.onDidChange(value => {
188-
ui.checkboxList.filter(value);
188+
ui.list.filter(value);
189189
}),
190190
ui.inputBox.onKeyDown(event => {
191191
switch (event.keyCode) {
192192
case KeyCode.DownArrow:
193-
ui.checkboxList.focus('First');
194-
ui.checkboxList.domFocus();
193+
ui.list.focus('First');
194+
ui.list.domFocus();
195195
break;
196196
case KeyCode.UpArrow:
197-
ui.checkboxList.focus('Last');
198-
ui.checkboxList.domFocus();
197+
ui.list.focus('Last');
198+
ui.list.domFocus();
199199
break;
200200
}
201201
})
@@ -363,7 +363,7 @@ export class QuickInputService extends Component implements IQuickInputService {
363363
checkAll.type = 'checkbox';
364364
this.toUnbind.push(dom.addStandardDisposableListener(checkAll, dom.EventType.CHANGE, e => {
365365
const checked = checkAll.checked;
366-
checkboxList.setAllVisibleChecked(checked);
366+
list.setAllVisibleChecked(checked);
367367
}));
368368
this.toUnbind.push(dom.addDisposableListener(checkAll, dom.EventType.CLICK, e => {
369369
if (e.x || e.y) { // Avoid 'click' triggered by 'space'...
@@ -396,23 +396,23 @@ export class QuickInputService extends Component implements IQuickInputService {
396396
dom.addClass(this.progressBar.getContainer(), 'quick-input-progress');
397397
this.toUnbind.push(attachProgressBarStyler(this.progressBar, this.themeService));
398398

399-
const checkboxList = this.instantiationService.createInstance(QuickInputCheckboxList, this.container);
400-
this.toUnbind.push(checkboxList);
401-
this.toUnbind.push(checkboxList.onAllVisibleCheckedChanged(checked => {
399+
const list = this.instantiationService.createInstance(QuickInputList, this.container);
400+
this.toUnbind.push(list);
401+
this.toUnbind.push(list.onAllVisibleCheckedChanged(checked => {
402402
checkAll.checked = checked;
403403
}));
404-
this.toUnbind.push(checkboxList.onCheckedCountChanged(c => {
404+
this.toUnbind.push(list.onCheckedCountChanged(c => {
405405
count.setCount(c);
406406
}));
407-
this.toUnbind.push(checkboxList.onLeave(() => {
407+
this.toUnbind.push(list.onLeave(() => {
408408
// Defer to avoid the input field reacting to the triggering key.
409409
setTimeout(() => {
410410
inputBox.setFocus();
411-
checkboxList.clearFocus();
411+
list.clearFocus();
412412
}, 0);
413413
}));
414414
this.toUnbind.push(
415-
chain(checkboxList.onFocusChange)
415+
chain(list.onFocusChange)
416416
.map(e => e[0])
417417
.filter(e => !!e)
418418
.latch()
@@ -469,7 +469,7 @@ export class QuickInputService extends Component implements IQuickInputService {
469469

470470
this.toUnbind.push(this.quickOpenService.onShow(() => this.close()));
471471

472-
this.ui = { checkAll, inputBox, count, message, checkboxList, close: ok => this.close(ok) };
472+
this.ui = { checkAll, inputBox, count, message, list, close: ok => this.close(ok) };
473473
this.updateStyles();
474474
}
475475

@@ -554,7 +554,7 @@ export class QuickInputService extends Component implements IQuickInputService {
554554
this.countContainer.style.display = this.controller.showUI.count ? '' : 'none';
555555
this.okContainer.style.display = this.controller.showUI.ok ? '' : 'none';
556556
this.ui.message.style.display = this.controller.showUI.message ? '' : 'none';
557-
this.ui.checkboxList.display(this.controller.showUI.checkboxList);
557+
this.ui.list.display(this.controller.showUI.list);
558558

559559
if (this.container.style.display === 'none') {
560560
this.inQuickOpen('quickInput', true);
@@ -604,13 +604,13 @@ export class QuickInputService extends Component implements IQuickInputService {
604604

605605
toggle() {
606606
if (this.isDisplayed() && this.controller instanceof PickManyController) {
607-
this.ui.checkboxList.toggleCheckbox();
607+
this.ui.list.toggleCheckbox();
608608
}
609609
}
610610

611611
navigate(next: boolean) {
612-
if (this.isDisplayed() && this.ui.checkboxList.isDisplayed()) {
613-
this.ui.checkboxList.focus(next ? 'Next' : 'Previous');
612+
if (this.isDisplayed() && this.ui.list.isDisplayed()) {
613+
this.ui.list.focus(next ? 'Next' : 'Previous');
614614
}
615615
}
616616

@@ -638,7 +638,7 @@ export class QuickInputService extends Component implements IQuickInputService {
638638
style.marginLeft = '-' + (width / 2) + 'px';
639639

640640
this.ui.inputBox.layout();
641-
this.ui.checkboxList.layout();
641+
this.ui.list.layout();
642642
}
643643
}
644644

0 commit comments

Comments
 (0)