mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
Fix TS adoption issues
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user