Skip to content

Commit 031b0a7

Browse files
committed
switch textChange to interface
1 parent 4eb12f8 commit 031b0a7

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/services/formatting/formattingManager.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,11 @@ module TypeScript.Services.Formatting {
112112

113113
//
114114
// TODO: Change the ILanguageService interface to return TextEditInfo (with start, and length) instead of TextEdit (with minChar and limChar)
115-
formattingEdits.forEach((item) => {
116-
var edit = new ts.TextChange(new TextSpan(item.position, item.length), item.replaceWith);
117-
result.push(edit);
115+
formattingEdits.forEach(item => {
116+
result.push({
117+
span: new TextSpan(item.position, item.length),
118+
newText: item.replaceWith
119+
});
118120
});
119121

120122
return result;

src/services/services.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -731,18 +731,8 @@ module ts {
731731
}
732732

733733
export class TextChange {
734-
constructor(public span: TypeScript.TextSpan, public newText: string) {
735-
}
736-
737-
static createInsert(pos: number, newText: string): TextChange {
738-
return new TextChange(new TypeScript.TextSpan(pos, 0), newText);
739-
}
740-
static createDelete(start: number, end: number): TextChange {
741-
return new TextChange(TypeScript.TextSpan.fromBounds(start, end), "");
742-
}
743-
static createReplace(start: number, end: number, newText: string): TextChange {
744-
return new TextChange(TypeScript.TextSpan.fromBounds(start, end), newText);
745-
}
734+
span: TypeScript.TextSpan;
735+
newText: string;
746736
}
747737

748738
export interface ReferenceEntry {

0 commit comments

Comments
 (0)