Fix TS adoption issues

This commit is contained in:
Alex Dima
2016-09-23 15:52:44 +03:00
parent c0dd44ef09
commit 55741c8c6e
4 changed files with 7 additions and 27 deletions

View File

@@ -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
);