當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vscode.TextEditorEdit類代碼示例

本文整理匯總了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;未經允許,請勿轉載。