editStack.ts ×3

Frontier kind: Code frontier

unlabeled · c_192139d42a72

2 tests · 42189 LOC · 238 files · introduces 0 tests · 33 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges33 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5395 ranges42189 lines · 238 files · Browse complete extent
All tests (intent)
2 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 33 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/textModel.ts 28 introduced LOC · 3 ranges

Open complete file

476 // Set resultingSelection early so viewModels can use it for cursor positioning
477 if (resultingSelection) {
478 > contentChangeEvent.rawContentChangedEvent.resultingSelection = resultingSelection; textModel.ts
479 > }
480 this._onDidChangeContentOrInjectedText(contentChangeEvent);
481 this._eventEmitter.fire(contentChangeEvent);
1440
1441 _applyUndo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {
1442 > const edits = changes.map<ISingleEditOperation>((change) => { textModel.ts
1443 > const rangeStart = this.getPositionAt(change.newPosition);
1444 > const rangeEnd = this.getPositionAt(change.newEnd);
1445 > return {
1446 > range: new Range(rangeStart.lineNumber, rangeStart.column, rangeEnd.lineNumber, rangeEnd.column),
1447 > text: change.oldText
1448 > };
1449 > });
1450 > this._applyUndoRedoEdits(edits, eol, true, false, resultingAlternativeVersionId, resultingSelection);
1451 > }
1452
1453 _applyRedo(changes: TextChange[], eol: model.EndOfLineSequence, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {
1464
1465 private _applyUndoRedoEdits(edits: ISingleEditOperation[], eol: model.EndOfLineSequence, isUndoing: boolean, isRedoing: boolean, resultingAlternativeVersionId: number, resultingSelection: Selection[] | null): void {
1466 > try { textModel.ts
1467 > this._onDidChangeDecorations.beginDeferredEmit();
1468 > this._eventEmitter.beginDeferredEmit();
1469 > this._isUndoing = isUndoing;
1470 > this._isRedoing = isRedoing;
1471 > const operations = this._validateEditOperations(edits);
1472 > this._doApplyEdits(operations, false, EditSources.applyEdits(), resultingSelection);
1473 > this.setEOL(eol);
1474 > this._overwriteAlternativeVersionId(resultingAlternativeVersionId);
1475 > } finally {
1476 > this._isUndoing = false;
1477 > this._isRedoing = false;
1478 > this._eventEmitter.endDeferredEmit(resultingSelection);
1479 > this._onDidChangeDecorations.endDeferredEmit();
1480 > }
1481 > }
1482
1483 public applyEdits(operations: readonly model.IIdentifiedSingleEditOperation[]): void;
src/vs/editor/common/model/editStack.ts 5 introduced LOC · 3 ranges

Open complete file

210
211 public undo(): void {
212 > if (URI.isUri(this.model)) { editStack.ts
213 // don't have a model
214 throw new Error(`Invalid SingleModelEditStackElement`);
215 }
216 > if (this._data instanceof SingleModelEditStackData) { editStack.ts
217 this._data = this._data.serialize();
218 }
219 > const data = SingleModelEditStackData.deserialize(this._data); editStack.ts
220 > this.model._applyUndo(data.changes, data.beforeEOL, data.beforeVersionId, data.beforeCursorState);
221 > }
222
223 public redo(): void {