textModel.ts ×9

Frontier kind: Code frontier

unlabeled · c_3204b6ac07e6

367 tests · 40617 LOC · 238 files · introduces 0 tests · 50 LOC · 8 files

Introduces — evidence that enters the hierarchy at this concept

Code
22 ranges50 lines · 8 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4944 ranges40617 lines · 238 files · Browse complete extent
All tests (intent)
367 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.

8 files ranked by introduced lines: 50 introduced LOC across 22 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/textModel.ts 18 introduced LOC · 9 ranges

Open complete file

466
467 private _emitContentChangedEvent(rawChange: ModelRawContentChangedEvent, change: IModelContentChangedEvent, resultingSelection: Selection[] | null = null): void {
468 > if (this.__isDisposing) { textModel.ts
469 // Do not confuse listeners by emitting any event after disposing
470 return;
471 }
472 > this._tokenizationTextModelPart.handleDidChangeContent(change); textModel.ts
473 > this._bracketPairs.handleDidChangeContent(change);
474 > this._fontTokenDecorationsProvider.handleDidChangeContent(change);
475 > const contentChangeEvent = new InternalModelContentChangeEvent(rawChange, change);
476 > // Set resultingSelection early so viewModels can use it for cursor positioning
477 > if (resultingSelection) {
478 contentChangeEvent.rawContentChangedEvent.resultingSelection = resultingSelection;
479 }
480 > this._onDidChangeContentOrInjectedText(contentChangeEvent); textModel.ts
481 > this._eventEmitter.fire(contentChangeEvent);
482 > }
483
484 public setValue(value: string | model.ITextSnapshot, reason = EditSources.setValue()): void {
781
782 private _increaseVersionId(): void {
783 > this._versionId = this._versionId + 1; textModel.ts
784 > this._alternativeVersionId = this._versionId;
785 > }
786
787 public _overwriteVersionId(versionId: number): void {
1651
1652 private _onDidChangeContentOrInjectedText(e: InternalModelContentChangeEvent | ModelInjectedTextChangedEvent): void {
1653 > for (const viewModel of this._viewModels) { textModel.ts
1654 try {
1655 viewModel.onDidChangeContentOrInjectedText(e);
1658 }
1659 }
1660 > for (const viewModel of this._viewModels) { textModel.ts
1661 try {
1662 viewModel.emitContentChangeEvent(e);
1665 }
1666 }
1667 > } textModel.ts
1668
1669 public changeDecorations<T>(callback: (changeAccessor: model.IModelDecorationsChangeAccessor) => T, ownerId: number = 0): T | null {
2731
2732 public fire(e: InternalModelContentChangeEvent): void {
2733 > if (this._deferredCnt > 0) { textModel.ts
2734 if (this._deferredEvent) {
2735 this._deferredEvent = this._deferredEvent.merge(e);
2740 }
2741 this._emitter.fire(e);
2742 > } textModel.ts
2743 }
src/vs/editor/common/textModelEvents.ts 9 introduced LOC · 2 ranges

Open complete file

474
475 constructor(changes: ModelRawChange[], versionId: number, isUndoing: boolean, isRedoing: boolean) {
476 > this.changes = changes; textModelEvents.ts
477 > this.versionId = versionId;
478 > this.isUndoing = isUndoing;
479 > this.isRedoing = isRedoing;
480 > this.resultingSelection = null;
481 > }
482
483 public containsEvent(type: RawContentChangedType): boolean {
562 export class InternalModelContentChangeEvent {
563 constructor(
564 > public readonly rawContentChangedEvent: ModelRawContentChangedEvent, textModelEvents.ts
565 > public readonly contentChangedEvent: IModelContentChangedEvent,
566 > ) { }
567
568 public merge(other: InternalModelContentChangeEvent): InternalModelContentChangeEvent {
src/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.ts 6 introduced LOC · 2 ranges

Open complete file

99
100 public handleDidChangeContent(change: IModelContentChangedEvent) {
101 > const edits = offsetEditFromContentChanges(change.changes); tokenizationFontDecorationsProvider.ts
102 > const deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);
103 > if (deletedAnnotations.length === 0) {
104 > return;
105 > }
106 /* We should fire line and font change events if decorations have been added or removed
107 * No decorations are added on edit, but they can be removed */
117 this._onDidChangeLineHeight.fire(affectedLineHeights);
118 this._onDidChangeFont.fire(affectedLineFonts);
120
121 public getDecorationsInRange(range: Range, ownerId?: number, filterOutValidation?: boolean, filterFontDecorations?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[] {
src/vs/editor/common/model/textModelStringEdit.ts 5 introduced LOC · 1 range

Open complete file

27
28 export function offsetEditFromContentChanges(contentChanges: readonly IModelContentChange[]) {
29 > const editsArr = contentChanges.map(c => new StringReplacement(OffsetRange.ofStartAndLength(c.rangeOffset, c.rangeLength), c.text)); textModelStringEdit.ts
30 > editsArr.reverse();
31 > const edits = new StringEdit(editsArr);
32 > return edits;
33 > }
34
35 export function offsetEditFromLineRangeMapping(original: ITextModel, modified: ITextModel, changes: readonly DetailedLineRangeMapping[]): StringEdit {
src/vs/editor/common/model/tokens/tokenizationTextModelPart.ts 5 introduced LOC · 3 ranges

Open complete file

132
133 public handleDidChangeContent(e: IModelContentChangedEvent): void {
134 > if (e.isFlush) { tokenizationTextModelPart.ts
135 this._semanticTokens.flush();
136 > } else if (!e.isEolChange) { // We don't have to do anything on an EOL change tokenizationTextModelPart.ts
137 for (const c of e.changes) {
138 const [eolCount, firstLineLength, lastLineLength] = countEOL(c.text);
147 }
148 }
150 > this.tokens.get().handleDidChangeContent(e);
151 > }
152
153 public handleDidChangeAttached(): void {
src/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.ts 3 introduced LOC · 3 ranges

Open complete file

188
189 public handleDidChangeContent(e: IModelContentChangedEvent): void {
190 > if (e.isFlush) { tokenizerSyntaxTokenBackend.ts
191 // Don't fire the event, as the view might not have got the text change event yet
192 this.todo_resetTokenization(false);
193 > } else if (!e.isEolChange) { // We don't have to do anything on an EOL change tokenizerSyntaxTokenBackend.ts
194 for (const c of e.changes) {
195 const [eolCount, firstLineLength] = countEOL(c.text);
205 this._defaultBackgroundTokenizer?.handleChanges();
206 }
208
209 private setTokens(tokens: ContiguousMultilineTokens[]): { changes: { fromLineNumber: number; toLineNumber: number }[] } {
src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsImpl.ts 2 introduced LOC · 1 range

Open complete file

59
60 public handleDidChangeContent(change: IModelContentChangedEvent) {
61 > this.bracketPairsTree.value?.object.handleContentChanged(change); bracketPairsImpl.ts
62 > }
63
64 public handleDidChangeBackgroundTokenizationState(): void {
src/vs/editor/common/model/tokens/annotations.ts 2 introduced LOC · 1 range

Open complete file

149 const annotation = annotations[0];
150 if (!annotation) {
151 > break; annotations.ts
152 > }
153 const range = annotation.range;
154 if (range.endExclusive >= e.replaceRange.start) {