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


TypeScript editStack.EditStack類代碼示例

本文整理匯總了TypeScript中vs/editor/common/model/editStack.EditStack的典型用法代碼示例。如果您正苦於以下問題:TypeScript EditStack類的具體用法?TypeScript EditStack怎麽用?TypeScript EditStack使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了EditStack類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: pushStackElement

	public pushStackElement(): void {
		if (this._isDisposed) {
			throw new Error('EditableTextModel.pushStackElement: Model is disposed');
		}

		this._commandManager.pushStackElement();
	}
開發者ID:Artazor,項目名稱:vscode,代碼行數:7,代碼來源:editableTextModel.ts

示例2: pushEditOperations

	public pushEditOperations(beforeCursorState:EditorCommon.IEditorSelection[], editOperations:EditorCommon.IIdentifiedSingleEditOperation[], cursorStateComputer:EditorCommon.ICursorStateComputer): EditorCommon.IEditorSelection[] {
		if (this._isDisposed) {
			throw new Error('EditableTextModel.pushEditOperations: Model is disposed');
		}

		return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer);
	}
開發者ID:gaoxiaojun,項目名稱:vscode,代碼行數:7,代碼來源:editableTextModel.ts

示例3: Range

		return this.deferredEmit(() => {
			if (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {
				// Go through each saved line number and insert a trim whitespace edit
				// if it is safe to do so (no conflicts with other edits).

				let incomingEdits = editOperations.map((op) => {
					return {
						range: this.validateRange(op.range),
						text: op.text
					};
				});

				for (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {
					let trimLineNumber = this._trimAutoWhitespaceLines[i];
					let maxLineColumn = this.getLineMaxColumn(trimLineNumber);

					let allowTrimLine = true;
					for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {
						let editRange = incomingEdits[j].range;
						let editText = incomingEdits[j].text;

						if (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {
							// `trimLine` is completely outside this edit
							continue;
						}

						// At this point:
						//   editRange.startLineNumber <= trimLine <= editRange.endLineNumber

						if (
							trimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn
							&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\n'
						) {
							// This edit inserts a new line (and maybe other text) after `trimLine`
							continue;
						}

						// Looks like we can't trim this line as it would interfere with an incoming edit
						allowTrimLine = false;
						break;
					}

					if (allowTrimLine) {
						editOperations.push({
							identifier: null,
							range: new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn),
							text: null,
							forceMoveMarkers: false,
							isAutoWhitespaceEdit: false
						});
					}

				}

				this._trimAutoWhitespaceLines = null;
			}
			return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer);
		});
開發者ID:JackWangCUMT,項目名稱:vscode,代碼行數:58,代碼來源:editableTextModel.ts

示例4: _redo

	private _redo(): Selection[] {
		this._isRedoing = true;
		let r = this._commandManager.redo();
		this._isRedoing = false;

		if (!r) {
			return null;
		}

		this._overwriteAlternativeVersionId(r.recordedVersionId);

		return r.selections;
	}
開發者ID:fs814,項目名稱:vscode,代碼行數:13,代碼來源:editableTextModel.ts

示例5: setEditableRange

	public setEditableRange(range:editorCommon.IRange): void {
		this._commandManager.clear();
		if (this._hasEditableRange) {
			this.removeTrackedRange(this._editableRangeId);
			this._editableRangeId = null;
			this._hasEditableRange = false;
		}

		if (range) {
			this._hasEditableRange = true;
			this._editableRangeId = this.addTrackedRange(range, editorCommon.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges);
		}
	}
開發者ID:CPoirot3,項目名稱:vscode,代碼行數:13,代碼來源:editableTextModel.ts

示例6:

		return this._withDeferredEvents(() => {
			this._isRedoing = true;
			let r = this._commandManager.redo();
			this._isRedoing = false;

			if (!r) {
				return null;
			}

			this._overwriteAlternativeVersionId(r.recordedVersionId);

			return r.selections;
		});
開發者ID:CPoirot3,項目名稱:vscode,代碼行數:13,代碼來源:editableTextModel.ts

示例7: setEditableRange

	public setEditableRange(range:editorCommon.IRange): void {
		if (this._isDisposed) {
			throw new Error('EditableTextModel.setEditableRange: Model is disposed');
		}

		this._commandManager.clear();
		if (this._hasEditableRange) {
			this.removeTrackedRange(this._editableRangeId);
			this._editableRangeId = null;
			this._hasEditableRange = false;
		}

		if (range) {
			this._hasEditableRange = true;
			this._editableRangeId = this.addTrackedRange(range, editorCommon.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges);
		}
	}
開發者ID:Artazor,項目名稱:vscode,代碼行數:17,代碼來源:editableTextModel.ts

示例8: setEditableRange

	public setEditableRange(range: editorCommon.IRange): void {
		this._commandManager.clear();

		if (!this._hasEditableRange && !range) {
			// Nothing to do
			return;
		}

		this.changeDecorations((changeAccessor) => {
			if (this._hasEditableRange) {
				changeAccessor.removeDecoration(this._editableRangeId);
				this._editableRangeId = null;
				this._hasEditableRange = false;
			}

			if (range) {
				this._hasEditableRange = true;
				this._editableRangeId = changeAccessor.addDecoration(range, {
					stickiness: editorCommon.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges
				});
			}
		});
	}
開發者ID:fs814,項目名稱:vscode,代碼行數:23,代碼來源:editableTextModel.ts

示例9: _pushEditOperations

	private _pushEditOperations(beforeCursorState: Selection[], editOperations: editorCommon.IIdentifiedSingleEditOperation[], cursorStateComputer: editorCommon.ICursorStateComputer): Selection[] {
		if (this._options.trimAutoWhitespace && this._trimAutoWhitespaceLines) {
			// Go through each saved line number and insert a trim whitespace edit
			// if it is safe to do so (no conflicts with other edits).

			let incomingEdits = editOperations.map((op) => {
				return {
					range: this.validateRange(op.range),
					text: op.text
				};
			});

			// Sometimes, auto-formatters change ranges automatically which can cause undesired auto whitespace trimming near the cursor
			// We'll use the following heuristic: if the edits occur near the cursor, then it's ok to trim auto whitespace
			let editsAreNearCursors = true;
			for (let i = 0, len = beforeCursorState.length; i < len; i++) {
				let sel = beforeCursorState[i];
				let foundEditNearSel = false;
				for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {
					let editRange = incomingEdits[j].range;
					let selIsAbove = editRange.startLineNumber > sel.endLineNumber;
					let selIsBelow = sel.startLineNumber > editRange.endLineNumber;
					if (!selIsAbove && !selIsBelow) {
						foundEditNearSel = true;
						break;
					}
				}
				if (!foundEditNearSel) {
					editsAreNearCursors = false;
					break;
				}
			}

			if (editsAreNearCursors) {
				for (let i = 0, len = this._trimAutoWhitespaceLines.length; i < len; i++) {
					let trimLineNumber = this._trimAutoWhitespaceLines[i];
					let maxLineColumn = this.getLineMaxColumn(trimLineNumber);

					let allowTrimLine = true;
					for (let j = 0, lenJ = incomingEdits.length; j < lenJ; j++) {
						let editRange = incomingEdits[j].range;
						let editText = incomingEdits[j].text;

						if (trimLineNumber < editRange.startLineNumber || trimLineNumber > editRange.endLineNumber) {
							// `trimLine` is completely outside this edit
							continue;
						}

						// At this point:
						//   editRange.startLineNumber <= trimLine <= editRange.endLineNumber

						if (
							trimLineNumber === editRange.startLineNumber && editRange.startColumn === maxLineColumn
							&& editRange.isEmpty() && editText && editText.length > 0 && editText.charAt(0) === '\n'
						) {
							// This edit inserts a new line (and maybe other text) after `trimLine`
							continue;
						}

						// Looks like we can't trim this line as it would interfere with an incoming edit
						allowTrimLine = false;
						break;
					}

					if (allowTrimLine) {
						editOperations.push({
							identifier: null,
							range: new Range(trimLineNumber, 1, trimLineNumber, maxLineColumn),
							text: null,
							forceMoveMarkers: false,
							isAutoWhitespaceEdit: false
						});
					}

				}
			}

			this._trimAutoWhitespaceLines = null;
		}
		return this._commandManager.pushEditOperation(beforeCursorState, editOperations, cursorStateComputer);
	}
開發者ID:fs814,項目名稱:vscode,代碼行數:81,代碼來源:editableTextModel.ts

示例10: pushStackElement

	public pushStackElement(): void {
		this._commandManager.pushStackElement();
	}
開發者ID:fs814,項目名稱:vscode,代碼行數:3,代碼來源:editableTextModel.ts


注:本文中的vs/editor/common/model/editStack.EditStack類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。