Skip to content

Commit fcd9a89

Browse files
committed
Merge branch 'master' of github.com:Microsoft/vscode
2 parents fee4d54 + c9b1c66 commit fcd9a89

11 files changed

Lines changed: 2031 additions & 75 deletions

File tree

src/vs/platform/configuration/common/configuration.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ export class Configuration<T> {
207207

208208
private _globalConfiguration: ConfigurationModel<T>;
209209
private _workspaceConsolidatedConfiguration: ConfigurationModel<T>;
210+
private _legacyWorkspaceConsolidatedConfiguration: ConfigurationModel<T>;
210211
protected _foldersConsolidatedConfigurations: StrictResourceMap<ConfigurationModel<T>>;
211212

212213
constructor(protected _defaults: ConfigurationModel<T>, protected _user: ConfigurationModel<T>, protected _workspaceConfiguration: ConfigurationModel<T> = new ConfigurationModel<T>(), protected folders: StrictResourceMap<ConfigurationModel<T>> = new StrictResourceMap<ConfigurationModel<T>>(), protected _workspace?: Workspace) {
@@ -224,6 +225,7 @@ export class Configuration<T> {
224225
protected merge(): void {
225226
this._globalConfiguration = new ConfigurationModel<T>().merge(this._defaults).merge(this._user);
226227
this._workspaceConsolidatedConfiguration = new ConfigurationModel<T>().merge(this._globalConfiguration).merge(this._workspaceConfiguration);
228+
this._legacyWorkspaceConsolidatedConfiguration = null;
227229
this._foldersConsolidatedConfigurations = new StrictResourceMap<ConfigurationModel<T>>();
228230
for (const folder of this.folders.keys()) {
229231
this.mergeFolder(folder);
@@ -252,6 +254,20 @@ export class Configuration<T> {
252254
};
253255
}
254256

257+
lookupLegacy<C>(key: string): IConfigurationValue<C> {
258+
if (!this._legacyWorkspaceConsolidatedConfiguration) {
259+
this._legacyWorkspaceConsolidatedConfiguration = this._workspace ? new ConfigurationModel<any>().merge(this._workspaceConfiguration).merge(this.folders.get(this._workspace.roots[0])) : null;
260+
}
261+
const consolidateConfigurationModel = this.getConsolidateConfigurationModel({});
262+
return {
263+
default: objects.clone(getConfigurationValue<C>(this._defaults.contents, key)),
264+
user: objects.clone(getConfigurationValue<C>(this._user.contents, key)),
265+
workspace: objects.clone(this._legacyWorkspaceConsolidatedConfiguration ? getConfigurationValue<C>(this._legacyWorkspaceConsolidatedConfiguration.contents, key) : void 0),
266+
folder: void 0,
267+
value: objects.clone(getConfigurationValue<C>(consolidateConfigurationModel.contents, key))
268+
};
269+
}
270+
255271
keys(): IConfigurationKeys {
256272
return {
257273
default: this._defaults.keys,

src/vs/workbench/api/node/extHost.api.impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export function createApiFactory(
430430
return extHostConfiguration.getConfiguration(section);
431431
},
432432
getConfiguration2: proposedApiFunction(extension, (section?: string, resource?: vscode.Uri): vscode.WorkspaceConfiguration => {
433-
return extHostConfiguration.getConfiguration(section, <URI>resource);
433+
return extHostConfiguration.getConfiguration2(section, <URI>resource);
434434
}),
435435
registerTaskProvider: proposedApiFunction(extension, (type: string, provider: vscode.TaskProvider) => {
436436
return extHostTask.registerTaskProvider(extension, provider);

src/vs/workbench/api/node/extHostConfiguration.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { mixin } from 'vs/base/common/objects';
88
import URI from 'vs/base/common/uri';
99
import Event, { Emitter } from 'vs/base/common/event';
10-
import { WorkspaceConfiguration } from 'vscode';
10+
import { WorkspaceConfiguration, WorkspaceConfiguration2 } from 'vscode';
1111
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
1212
import { ExtHostConfigurationShape, MainThreadConfigurationShape } from './extHost.protocol';
1313
import { IConfigurationData, Configuration } from 'vs/platform/configuration/common/configuration';
@@ -24,6 +24,14 @@ function lookUp(tree: any, key: string) {
2424
}
2525
}
2626

27+
type ConfigurationInspect<T> = {
28+
key: string;
29+
defaultValue?: T;
30+
globalValue?: T;
31+
workspaceValue?: T;
32+
folderValue?: T;
33+
};
34+
2735
export class ExtHostConfiguration extends ExtHostConfigurationShape {
2836

2937
private readonly _onDidChangeConfiguration = new Emitter<void>();
@@ -47,7 +55,15 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
4755
this._onDidChangeConfiguration.fire(undefined);
4856
}
4957

50-
getConfiguration(section?: string, resource?: URI): WorkspaceConfiguration {
58+
getConfiguration(section?: string): WorkspaceConfiguration {
59+
return this._getConfiguration(section, null, true);
60+
}
61+
62+
getConfiguration2(section?: string, resource?: URI): WorkspaceConfiguration2 {
63+
return this._getConfiguration(section, resource, false);
64+
}
65+
66+
private _getConfiguration(section: string, resource: URI, legacy: boolean): WorkspaceConfiguration {
5167

5268
const config = section
5369
? lookUp(this._configuration.getValue(null, { resource }), section)
@@ -73,17 +89,20 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
7389
return this._proxy.$removeConfigurationOption(target, key);
7490
}
7591
},
76-
inspect: <T>(key: string): { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, folderValue?: T } => {
92+
inspect: <T>(key: string): ConfigurationInspect<T> => {
7793
key = section ? `${section}.${key}` : key;
78-
const config = this._configuration.values()[key];
94+
const config = legacy ? this._configuration.lookupLegacy<T>(key) : this._configuration.lookup<T>(key, { resource });
7995
if (config) {
80-
return {
96+
const inspect: ConfigurationInspect<T> = {
8197
key,
8298
defaultValue: config.default,
8399
globalValue: config.user,
84100
workspaceValue: config.workspace,
85-
folderValue: config.folder
86101
};
102+
if (!legacy) {
103+
inspect.folderValue = config.folder;
104+
}
105+
return inspect;
87106
}
88107
return undefined;
89108
}

src/vs/workbench/parts/debug/browser/media/debugHover.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
word-break: normal;
2727
text-overflow: ellipsis;
2828
height: 18px;
29-
overflow: auto;
29+
overflow: hidden;
3030
border-bottom: 1px solid rgba(128, 128, 128, 0.35);
3131
}
3232

src/vs/workbench/parts/debug/electron-browser/debugHover.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as nls from 'vs/nls';
77
import * as lifecycle from 'vs/base/common/lifecycle';
88
import { TPromise } from 'vs/base/common/winjs.base';
99
import { KeyCode } from 'vs/base/common/keyCodes';
10+
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
1011
import * as dom from 'vs/base/browser/dom';
1112
import { ITree } from 'vs/base/parts/tree/browser/tree';
1213
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
@@ -62,7 +63,7 @@ export class DebugHoverWidget implements IContentWidget {
6263
this.valueContainer = $('.value');
6364
this.valueContainer.tabIndex = 0;
6465
this.valueContainer.setAttribute('role', 'tooltip');
65-
this.scrollbar = new DomScrollableElement(this.valueContainer, {});
66+
this.scrollbar = new DomScrollableElement(this.valueContainer, { horizontal: ScrollbarVisibility.Hidden });
6667
this.domNode.appendChild(this.scrollbar.getDomNode());
6768
this.toDispose.push(this.scrollbar);
6869

@@ -268,6 +269,7 @@ export class DebugHoverWidget implements IContentWidget {
268269

269270
this.valueContainer.hidden = true;
270271
this.complexValueContainer.hidden = false;
272+
this.scrollbar.scanDomNode();
271273

272274
return this.tree.setInput(expression).then(() => {
273275
this.complexValueTitle.textContent = expression.value;

src/vs/workbench/parts/files/browser/views/explorerView.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -761,17 +761,15 @@ export class ExplorerView extends CollapsibleView {
761761
return this.explorerViewer.refresh();
762762
}
763763

764-
// First time refresh: The stat becomes the input of the viewer
765-
// Display roots only when there is more than 1 root
766-
return this.explorerViewer.setInput(input).then(() => {
767-
768-
// Make sure to expand all folders that where expanded in the previous session
769-
if (targetsToExpand) {
770-
return this.explorerViewer.expandAll(targetsToExpand.map(expand => this.model.findFirst(expand)));
771-
}
764+
// Preserve expanded elements if tree input changed.
765+
// If it is a brand new tree just expand elements from memento
766+
const expanded = this.explorerViewer.getExpandedElements();
767+
const statsToExpand = expanded.length ? [this.model.roots[0]].concat(expanded) :
768+
targetsToExpand.map(expand => this.model.findFirst(expand));
772769

773-
return TPromise.as(null);
774-
});
770+
// Display roots only when there is more than 1 root
771+
// Make sure to expand all folders that where expanded in the previous session
772+
return this.explorerViewer.setInput(input).then(() => this.explorerViewer.expandAll(statsToExpand));
775773
}, (e: any) => TPromise.wrapError(e));
776774

777775
this.progressService.showWhile(promise, this.partService.isCreated() ? 800 : 3200 /* less ugly initial startup */);

src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts

Lines changed: 79 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ class ScanCodeCombo {
198198
);
199199
}
200200

201-
private getProducedCharCode(mapping: IScanCodeMapping): number {
201+
private getProducedCharCode(mapping: IMacLinuxKeyMapping): string {
202202
if (!mapping) {
203-
return 0;
203+
return '';
204204
}
205205
if (this.ctrlKey && this.shiftKey && this.altKey) {
206206
return mapping.withShiftAltGr;
@@ -214,8 +214,8 @@ class ScanCodeCombo {
214214
return mapping.value;
215215
}
216216

217-
public getProducedChar(mapping: IScanCodeMapping): string {
218-
const charCode = this.getProducedCharCode(mapping);
217+
public getProducedChar(mapping: IMacLinuxKeyMapping): string {
218+
const charCode = MacLinuxKeyboardMapper.getCharCode(this.getProducedCharCode(mapping));
219219
if (charCode === 0) {
220220
return ' --- ';
221221
}
@@ -444,7 +444,7 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
444444
/**
445445
* used only for debug purposes.
446446
*/
447-
private readonly _codeInfo: IScanCodeMapping[];
447+
private readonly _codeInfo: IMacLinuxKeyMapping[];
448448
/**
449449
* Maps ScanCode combos <-> KeyCode combos.
450450
*/
@@ -490,15 +490,6 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
490490
}
491491
};
492492

493-
let producesLetter: boolean[] = [];
494-
const _registerLetterIfMissing = (charCode: CharCode, scanCode: ScanCode, keyCode: KeyCode): void => {
495-
if (!producesLetter[charCode]) {
496-
_registerAllCombos(0, 0, 0, scanCode, keyCode);
497-
this._scanCodeToLabel[scanCode] = String.fromCharCode(charCode);
498-
}
499-
};
500-
501-
502493
// Initialize `_scanCodeToLabel`
503494
for (let scanCode = ScanCode.None; scanCode < ScanCode.MAX_VALUE; scanCode++) {
504495
this._scanCodeToLabel[scanCode] = null;
@@ -524,6 +515,72 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
524515
}
525516
}
526517

518+
// Try to identify keyboard layouts where characters A-Z are missing
519+
// and forcefully map them to their corresponding scan codes if that is the case
520+
const missingLatinLettersOverride: { [scanCode: string]: IMacLinuxKeyMapping; } = {};
521+
522+
{
523+
let producesLatinLetter: boolean[] = [];
524+
for (let strScanCode in rawMappings) {
525+
if (rawMappings.hasOwnProperty(strScanCode)) {
526+
const scanCode = ScanCodeUtils.toEnum(strScanCode);
527+
if (scanCode === ScanCode.None) {
528+
continue;
529+
}
530+
if (IMMUTABLE_CODE_TO_KEY_CODE[scanCode] !== -1) {
531+
continue;
532+
}
533+
534+
const rawMapping = rawMappings[strScanCode];
535+
const value = MacLinuxKeyboardMapper.getCharCode(rawMapping.value);
536+
537+
if (value >= CharCode.a && value <= CharCode.z) {
538+
const upperCaseValue = CharCode.A + (value - CharCode.a);
539+
producesLatinLetter[upperCaseValue] = true;
540+
}
541+
}
542+
}
543+
544+
const _registerLetterIfMissing = (charCode: CharCode, scanCode: ScanCode, value: string, withShift: string): void => {
545+
if (!producesLatinLetter[charCode]) {
546+
missingLatinLettersOverride[ScanCodeUtils.toString(scanCode)] = {
547+
value: value,
548+
withShift: withShift,
549+
withAltGr: '',
550+
withShiftAltGr: ''
551+
};
552+
}
553+
};
554+
555+
// Ensure letters are mapped
556+
_registerLetterIfMissing(CharCode.A, ScanCode.KeyA, 'a', 'A');
557+
_registerLetterIfMissing(CharCode.B, ScanCode.KeyB, 'b', 'B');
558+
_registerLetterIfMissing(CharCode.C, ScanCode.KeyC, 'c', 'C');
559+
_registerLetterIfMissing(CharCode.D, ScanCode.KeyD, 'd', 'D');
560+
_registerLetterIfMissing(CharCode.E, ScanCode.KeyE, 'e', 'E');
561+
_registerLetterIfMissing(CharCode.F, ScanCode.KeyF, 'f', 'F');
562+
_registerLetterIfMissing(CharCode.G, ScanCode.KeyG, 'g', 'G');
563+
_registerLetterIfMissing(CharCode.H, ScanCode.KeyH, 'h', 'H');
564+
_registerLetterIfMissing(CharCode.I, ScanCode.KeyI, 'i', 'I');
565+
_registerLetterIfMissing(CharCode.J, ScanCode.KeyJ, 'j', 'J');
566+
_registerLetterIfMissing(CharCode.K, ScanCode.KeyK, 'k', 'K');
567+
_registerLetterIfMissing(CharCode.L, ScanCode.KeyL, 'l', 'L');
568+
_registerLetterIfMissing(CharCode.M, ScanCode.KeyM, 'm', 'M');
569+
_registerLetterIfMissing(CharCode.N, ScanCode.KeyN, 'n', 'N');
570+
_registerLetterIfMissing(CharCode.O, ScanCode.KeyO, 'o', 'O');
571+
_registerLetterIfMissing(CharCode.P, ScanCode.KeyP, 'p', 'P');
572+
_registerLetterIfMissing(CharCode.Q, ScanCode.KeyQ, 'q', 'Q');
573+
_registerLetterIfMissing(CharCode.R, ScanCode.KeyR, 'r', 'R');
574+
_registerLetterIfMissing(CharCode.S, ScanCode.KeyS, 's', 'S');
575+
_registerLetterIfMissing(CharCode.T, ScanCode.KeyT, 't', 'T');
576+
_registerLetterIfMissing(CharCode.U, ScanCode.KeyU, 'u', 'U');
577+
_registerLetterIfMissing(CharCode.V, ScanCode.KeyV, 'v', 'V');
578+
_registerLetterIfMissing(CharCode.W, ScanCode.KeyW, 'w', 'W');
579+
_registerLetterIfMissing(CharCode.X, ScanCode.KeyX, 'x', 'X');
580+
_registerLetterIfMissing(CharCode.Y, ScanCode.KeyY, 'y', 'Y');
581+
_registerLetterIfMissing(CharCode.Z, ScanCode.KeyZ, 'z', 'Z');
582+
}
583+
527584
let mappings: IScanCodeMapping[] = [], mappingsLen = 0;
528585
for (let strScanCode in rawMappings) {
529586
if (rawMappings.hasOwnProperty(strScanCode)) {
@@ -535,11 +592,13 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
535592
continue;
536593
}
537594

538-
const rawMapping = rawMappings[strScanCode];
539-
const value = MacLinuxKeyboardMapper._getCharCode(rawMapping.value);
540-
const withShift = MacLinuxKeyboardMapper._getCharCode(rawMapping.withShift);
541-
const withAltGr = MacLinuxKeyboardMapper._getCharCode(rawMapping.withAltGr);
542-
const withShiftAltGr = MacLinuxKeyboardMapper._getCharCode(rawMapping.withShiftAltGr);
595+
this._codeInfo[scanCode] = rawMappings[strScanCode];
596+
597+
const rawMapping = missingLatinLettersOverride[strScanCode] || rawMappings[strScanCode];
598+
const value = MacLinuxKeyboardMapper.getCharCode(rawMapping.value);
599+
const withShift = MacLinuxKeyboardMapper.getCharCode(rawMapping.withShift);
600+
const withAltGr = MacLinuxKeyboardMapper.getCharCode(rawMapping.withAltGr);
601+
const withShiftAltGr = MacLinuxKeyboardMapper.getCharCode(rawMapping.withShiftAltGr);
543602

544603
const mapping: IScanCodeMapping = {
545604
scanCode: scanCode,
@@ -549,16 +608,13 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
549608
withShiftAltGr: withShiftAltGr,
550609
};
551610
mappings[mappingsLen++] = mapping;
552-
this._codeInfo[scanCode] = mapping;
553611

554612
this._scanCodeToDispatch[scanCode] = `[${ScanCodeUtils.toString(scanCode)}]`;
555613

556614
if (value >= CharCode.a && value <= CharCode.z) {
557615
const upperCaseValue = CharCode.A + (value - CharCode.a);
558-
producesLetter[upperCaseValue] = true;
559616
this._scanCodeToLabel[scanCode] = String.fromCharCode(upperCaseValue);
560617
} else if (value >= CharCode.A && value <= CharCode.Z) {
561-
producesLetter[value] = true;
562618
this._scanCodeToLabel[scanCode] = String.fromCharCode(value);
563619
} else if (value) {
564620
this._scanCodeToLabel[scanCode] = String.fromCharCode(value);
@@ -691,34 +747,6 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
691747
_registerAllCombos(0, 0, 0, ScanCode.Digit9, KeyCode.KEY_9);
692748
_registerAllCombos(0, 0, 0, ScanCode.Digit0, KeyCode.KEY_0);
693749

694-
// Ensure letters are mapped
695-
_registerLetterIfMissing(CharCode.A, ScanCode.KeyA, KeyCode.KEY_A);
696-
_registerLetterIfMissing(CharCode.B, ScanCode.KeyB, KeyCode.KEY_B);
697-
_registerLetterIfMissing(CharCode.C, ScanCode.KeyC, KeyCode.KEY_C);
698-
_registerLetterIfMissing(CharCode.D, ScanCode.KeyD, KeyCode.KEY_D);
699-
_registerLetterIfMissing(CharCode.E, ScanCode.KeyE, KeyCode.KEY_E);
700-
_registerLetterIfMissing(CharCode.F, ScanCode.KeyF, KeyCode.KEY_F);
701-
_registerLetterIfMissing(CharCode.G, ScanCode.KeyG, KeyCode.KEY_G);
702-
_registerLetterIfMissing(CharCode.H, ScanCode.KeyH, KeyCode.KEY_H);
703-
_registerLetterIfMissing(CharCode.I, ScanCode.KeyI, KeyCode.KEY_I);
704-
_registerLetterIfMissing(CharCode.J, ScanCode.KeyJ, KeyCode.KEY_J);
705-
_registerLetterIfMissing(CharCode.K, ScanCode.KeyK, KeyCode.KEY_K);
706-
_registerLetterIfMissing(CharCode.L, ScanCode.KeyL, KeyCode.KEY_L);
707-
_registerLetterIfMissing(CharCode.M, ScanCode.KeyM, KeyCode.KEY_M);
708-
_registerLetterIfMissing(CharCode.N, ScanCode.KeyN, KeyCode.KEY_N);
709-
_registerLetterIfMissing(CharCode.O, ScanCode.KeyO, KeyCode.KEY_O);
710-
_registerLetterIfMissing(CharCode.P, ScanCode.KeyP, KeyCode.KEY_P);
711-
_registerLetterIfMissing(CharCode.Q, ScanCode.KeyQ, KeyCode.KEY_Q);
712-
_registerLetterIfMissing(CharCode.R, ScanCode.KeyR, KeyCode.KEY_R);
713-
_registerLetterIfMissing(CharCode.S, ScanCode.KeyS, KeyCode.KEY_S);
714-
_registerLetterIfMissing(CharCode.T, ScanCode.KeyT, KeyCode.KEY_T);
715-
_registerLetterIfMissing(CharCode.U, ScanCode.KeyU, KeyCode.KEY_U);
716-
_registerLetterIfMissing(CharCode.V, ScanCode.KeyV, KeyCode.KEY_V);
717-
_registerLetterIfMissing(CharCode.W, ScanCode.KeyW, KeyCode.KEY_W);
718-
_registerLetterIfMissing(CharCode.X, ScanCode.KeyX, KeyCode.KEY_X);
719-
_registerLetterIfMissing(CharCode.Y, ScanCode.KeyY, KeyCode.KEY_Y);
720-
_registerLetterIfMissing(CharCode.Z, ScanCode.KeyZ, KeyCode.KEY_Z);
721-
722750
this._scanCodeKeyCodeMapper.registrationComplete();
723751
}
724752

@@ -1135,7 +1163,7 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
11351163
* To the brave person following me: Good Luck!
11361164
* https://www.compart.com/en/unicode/bidiclass/NSM
11371165
*/
1138-
private static _getCharCode(char: string): number {
1166+
public static getCharCode(char: string): number {
11391167
if (char.length === 0) {
11401168
return 0;
11411169
}

0 commit comments

Comments
 (0)