mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
switch textChange to interface
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user