本文整理汇总了TypeScript中vscode.TextEditorEdit类的典型用法代码示例。如果您正苦于以下问题:TypeScript TextEditorEdit类的具体用法?TypeScript TextEditorEdit怎么用?TypeScript TextEditorEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextEditorEdit类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: Position
return editor.edit((editBuilder: TextEditorEdit) => {
const doc = editor.document;
const startPos = new Position(0, 0);
const lastLine = doc.lineAt(doc.lineCount - 1);
const endPos = lastLine.range.end;
const entireRange = new Range(startPos, endPos);
editBuilder.replace(entireRange, text);
editBuilder.setEndOfLine(EndOfLine.LF);
});
开发者ID:sgryjp,项目名称:japanese-word-handler,代码行数:9,代码来源:extension.test.ts
示例2: applyUsingTextEditorEdit
// Applies Edit using given TextEditorEdit
applyUsingTextEditorEdit(editBuilder: TextEditorEdit): void {
switch (this.action) {
case EditTypes.EDIT_INSERT:
editBuilder.insert(this.start, this.text);
break;
case EditTypes.EDIT_DELETE:
editBuilder.delete(new Range(this.start, this.end));
break;
case EditTypes.EDIT_REPLACE:
editBuilder.replace(new Range(this.start, this.end), this.text);
break;
}
}
开发者ID:leaxoy,项目名称:vscode-go,代码行数:16,代码来源:diffUtils.ts
示例3:
window.activeTextEditor.edit((textEditorEdit: TextEditorEdit) => {
textEditorEdit.replace(te.range, te.newText);
});
开发者ID:Dickurt,项目名称:vscode-php-formatter,代码行数:3,代码来源:formatter.ts
示例4:
textEditor.selections.forEach((selection) => {
let text = doc.getText(selection);
let value = Number.parseFloat(text.replace('px', ''));
let result = value / factor;
let fixed = Number.parseFloat(result.toFixed(decimals));
edit.replace(selection, fixed + unit);
});
开发者ID:Maroon1,项目名称:px2rem,代码行数:7,代码来源:util.ts
示例5: insertTask
private insertTask(pos: Position, task: string) {
this._textEditorEdit.insert(pos, task);
new TodoDocumentDecorator(this._textEditor).performDecoration();
}
开发者ID:mmilczewski,项目名称:vscode-todotasks,代码行数:4,代码来源:TodoDocumentEditor.ts
示例6: updateTask
private updateTask(taskLine: TextLine, taskDescription: string, symbol: string, tag?: string) {
this._textEditorEdit.delete(new Range(new Position(taskLine.lineNumber, taskLine.firstNonWhitespaceCharacterIndex), taskLine.range.end));
this.insertTask(new Position(taskLine.lineNumber, taskLine.firstNonWhitespaceCharacterIndex), symbol + " " + taskDescription + (tag ? (" " + TodoDocument.toTag(tag)) : ""));
}
开发者ID:mmilczewski,项目名称:vscode-todotasks,代码行数:4,代码来源:TodoDocumentEditor.ts
示例7: updateTask
private updateTask(taskLine: TextLine, taskDescription: string, symbol: string, tag?: string) {
this._textEditorEdit.replace(new Range(new Position(taskLine.lineNumber, taskLine.firstNonWhitespaceCharacterIndex), taskLine.range.end), symbol + " " + taskDescription + (tag ? (" " + TodoDocument.toTag(tag)) : ""));
new TodoDocumentDecorator(this._textEditor).performDecoration();
}
开发者ID:sandy081,项目名称:vscode-tasks,代码行数:4,代码来源:TodoDocumentEditor.ts
注:本文中的vscode.TextEditorEdit类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论