switch textChange to interface

This commit is contained in:
Mohamed Hegazy
2014-09-24 10:34:58 -07:00
parent 4eb12f8029
commit 031b0a7e0c
2 changed files with 7 additions and 15 deletions
+5 -3
View File
@@ -112,9 +112,11 @@ module TypeScript.Services.Formatting {
//
// TODO: Change the ILanguageService interface to return TextEditInfo (with start, and length) instead of TextEdit (with minChar and limChar)
formattingEdits.forEach((item) => {
var edit = new ts.TextChange(new TextSpan(item.position, item.length), item.replaceWith);
result.push(edit);
formattingEdits.forEach(item => {
result.push({
span: new TextSpan(item.position, item.length),
newText: item.replaceWith
});
});
return result;
+2 -12
View File
@@ -731,18 +731,8 @@ module ts {
}
export class TextChange {
constructor(public span: TypeScript.TextSpan, public newText: string) {
}
static createInsert(pos: number, newText: string): TextChange {
return new TextChange(new TypeScript.TextSpan(pos, 0), newText);
}
static createDelete(start: number, end: number): TextChange {
return new TextChange(TypeScript.TextSpan.fromBounds(start, end), "");
}
static createReplace(start: number, end: number, newText: string): TextChange {
return new TextChange(TypeScript.TextSpan.fromBounds(start, end), newText);
}
span: TypeScript.TextSpan;
newText: string;
}
export interface ReferenceEntry {