annotations.ts ×5

Frontier kind: Code frontier

unlabeled · c_6e4dde614979

380 tests · 6367 LOC · 36 files · introduces 0 tests · 34 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges34 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1041 ranges6367 lines · 36 files · Browse complete extent
All tests (intent)
380 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.

1 file ranked by introduced lines: 34 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/model/tokens/annotations.ts 34 introduced LOC · 5 ranges

Open complete file

136 */
137 public applyEdit(edit: StringEdit): IAnnotation<T>[] {
138 > const annotations = this._annotations.slice(); annotations.ts
139 >
140 > // treat edits as deletion of the replace range and then as insertion that extends the first range
141 > const finalAnnotations: IAnnotation<T>[] = [];
142 > const deletedAnnotations: IAnnotation<T>[] = [];
143 >
144 > let offset = 0;
145 >
146 > for (const e of edit.replacements) {
147 > while (true) {
148 > // ranges before the current edit
149 > const annotation = annotations[0];
150 > if (!annotation) {
151 break;
152 }
162 deletedAnnotations.push(newAnnotation);
163 }
164 > } annotations.ts
165 >
166 > const intersecting: IAnnotation<T>[] = [];
167 > while (true) {
168 > const annotation = annotations[0];
169 > if (!annotation) {
170 break;
171 }
177 intersecting.push(annotation);
178 }
180 > for (let i = intersecting.length - 1; i >= 0; i--) {
181 const annotation = intersecting[i];
182 let r = annotation.range;
206 annotations.unshift({ annotation: annotation.annotation, range: r });
207 }
209 > offset += e.newText.length - e.replaceRange.length;
210 > }
211 >
212 > while (true) {
213 > const annotation = annotations[0];
214 > if (!annotation) {
215 > break;
216 > }
217 annotations.shift();
218 const newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };
222 deletedAnnotations.push(newAnnotation);
223 }
224 > } annotations.ts
225 > this._annotations = finalAnnotations;
226 > return deletedAnnotations;
227 > }
228
229 /**