diff --git a/src/vs/editor/common/model/textModel.ts b/src/vs/editor/common/model/textModel.ts index d6b6b58eb21..13546518ffe 100644 --- a/src/vs/editor/common/model/textModel.ts +++ b/src/vs/editor/common/model/textModel.ts @@ -785,9 +785,7 @@ export class TextModel extends OrderGuaranteeEventEmitter implements editorCommo let searchRange:Range; if (Range.isIRange(rawSearchScope)) { - // @alex TS(2.0.2) - isIRange tests for IRange but all our code assumes Range which now fails. - // Kept sematic using cast. But you should check. - searchRange = rawSearchScope as Range; + searchRange = this.validateRange(rawSearchScope); } else { searchRange = this.getFullModelRange(); } diff --git a/src/vs/workbench/api/node/extHostEditors.ts b/src/vs/workbench/api/node/extHostEditors.ts index 5b71bf5b5ee..37591f36ae7 100644 --- a/src/vs/workbench/api/node/extHostEditors.ts +++ b/src/vs/workbench/api/node/extHostEditors.ts @@ -214,15 +214,11 @@ export class TextEditorEdit { replace(location: Position | Range | Selection, value: string): void { let range: Range = null; - // @alex TS(2.0.2) - Selection is subclass of Range so the else if (location instanceof Selection) isn't reachable. - // Deleted it to keep sematic. You need to check if creating a new Range from a Selection is intended. if (location instanceof Position) { range = new Range(location, location); } else if (location instanceof Range) { range = location; - } /* else if (location instanceof Selection) { - range = new Range(location.start, location.end); - } */ else { + } else { throw new Error('Unrecognized location'); } @@ -244,13 +240,9 @@ export class TextEditorEdit { delete(location: Range | Selection): void { let range: Range = null; - // @alex TS(2.0.2) - Selection is subclass of Range so the else if (location instanceof Selection) isn't reachable. - // Deleted it to keep sematic. You need to check if creating a new Range from a Selection is intended. if (location instanceof Range) { range = location; - } /* else if (location instanceof Selection) { - range = new Range(location.start, location.end); - } */ else { + } else { throw new Error('Unrecognized location'); } @@ -397,9 +389,7 @@ class ExtHostTextEditor implements vscode.TextEditor { () => this._proxy.$tryRevealRange( this._id, TypeConverters.fromRange(range), - // @alex TS(2.0.2) - we still don't hack duck typing on enums. I added a cast since the - // values are the same. May be you want to write nicer code for this. - (revealType || TextEditorRevealType.Default) as any + (revealType || TextEditorRevealType.Default) ), true ); diff --git a/src/vs/workbench/services/keybinding/electron-browser/nativeKeymap.ts b/src/vs/workbench/services/keybinding/electron-browser/nativeKeymap.ts index ca41e75e9f3..db94379bd73 100644 --- a/src/vs/workbench/services/keybinding/electron-browser/nativeKeymap.ts +++ b/src/vs/workbench/services/keybinding/electron-browser/nativeKeymap.ts @@ -283,11 +283,7 @@ let _b24_getActualKeyCodeMap = (function() { if (nativeMapping.value && _b24_interestingChars[nativeMapping.value]) { // console.log(nativeMapping.value + " is made by " + nativeMapping.key_code); let keyCode = NATIVE_KEY_CODE_TO_KEY_CODE[nativeMapping.key_code]; - // @alex TS(2.0.2) - KeyCode.Unknown === 0 so if (keyCode) is true then KeyCode !== KeyCode.Unknown - // is superflous code which is now flagged as a compile error (actually as a type check error that - // is very hard to understand) - // Will comment out the keyCode !== KeyCode.Unknown check. - if (keyCode /* && keyCode !== KeyCode.Unknown */) { + if (keyCode) { if (!result[nativeMapping.value] || result[nativeMapping.value] > keyCode) { result[nativeMapping.value] = keyCode; } @@ -297,11 +293,7 @@ let _b24_getActualKeyCodeMap = (function() { if (nativeMapping.withShift && _b24_interestingChars[nativeMapping.withShift]) { // console.log(nativeMapping.withShift + " is made by " + nativeMapping.key_code); let keyCode = NATIVE_KEY_CODE_TO_KEY_CODE[nativeMapping.key_code]; - // @alex TS(2.0.2) - KeyCode.Unknown === 0 so if (keyCode) is true then KeyCode !== KeyCode.Unknown - // is superflous code which is now flagged as a compile error (actually as a type check error that - // is very hard to understand) - // Will comment out the keyCode !== KeyCode.Unknown check. - if (keyCode /* && keyCode !== KeyCode.Unknown */) { + if (keyCode) { if (!result[nativeMapping.withShift] || result[nativeMapping.withShift] > keyCode) { result[nativeMapping.withShift] = keyCode; } diff --git a/src/vs/workbench/services/themes/electron-browser/stylesContributions.ts b/src/vs/workbench/services/themes/electron-browser/stylesContributions.ts index a2caab677f8..a87b5910ead 100644 --- a/src/vs/workbench/services/themes/electron-browser/stylesContributions.ts +++ b/src/vs/workbench/services/themes/electron-browser/stylesContributions.ts @@ -78,7 +78,7 @@ export class TokenStylesContribution { public contributeStyles(themeId: string, themeDocument: IThemeDocument, cssRules: string[]): void { let theme = new Theme(themeId, themeDocument); theme.getSettings().forEach((s: IThemeSetting, index, arr) => { - // @alex TS(2.0.2) - s.scope is already a string[] so no need for all this checking. + // @martin TS(2.0.2) - s.scope is already a string[] so no need for all this checking. // However will add a cast at split to keep semantic in case s.scope is wrongly typed. let scope: string | string[] = s.scope; let settings = s.settings;