提交 d9aaca92 编写于 作者: M Martin Aeschlimann

[json formatter] add applyEdit

上级 c3beba97
......@@ -27,6 +27,17 @@ export interface Edit {
content: string;
}
export function applyEdit(text: string, edit: Edit) : string {
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
}
export function applyEdits(text: string, edits: Edit[]) : string {
for (let i = edits.length - 1; i >= 0; i--) {
text = applyEdit(text, edits[i]);
}
return text;
}
export function format(documentText: string, range: { offset: number, length: number}, options: FormattingOptions): Edit[] {
let initialIndentLevel: number;
let value: string;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册