sparseTokensStore.ts ×6

Frontier kind: Code frontier

unlabeled · c_6797894eeab2

7 tests · 39149 LOC · 240 files · introduces 0 tests · 56 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges56 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4542 ranges39149 lines · 240 files · Browse complete extent
All tests (intent)
7 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: 56 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/tokens/sparseMultilineTokens.ts 29 introduced LOC · 4 ranges

Open complete file

72
73 public removeTokens(range: Range): void {
74 > const startLineIndex = range.startLineNumber - this._startLineNumber; sparseMultilineTokens.ts
75 > const endLineIndex = range.endLineNumber - this._startLineNumber;
76 >
77 > this._startLineNumber += this._tokens.removeTokens(startLineIndex, range.startColumn - 1, endLineIndex, range.endColumn - 1);
78 > this._updateEndLineNumber();
79 > }
80
81 public split(range: Range): [SparseMultilineTokens, SparseMultilineTokens] {
271
272 public removeTokens(startDeltaLine: number, startChar: number, endDeltaLine: number, endChar: number): number {
273 > const tokens = this._tokens; sparseMultilineTokens.ts
274 > const tokenCount = this._tokenCount;
275 > let newTokenCount = 0;
276 > let hasDeletedTokens = false;
277 > let firstDeltaLine = 0;
278 > for (let i = 0; i < tokenCount; i++) {
279 > const srcOffset = 4 * i;
280 > const tokenDeltaLine = tokens[srcOffset];
281 > const tokenStartCharacter = tokens[srcOffset + 1];
282 > const tokenEndCharacter = tokens[srcOffset + 2];
283 > const tokenMetadata = tokens[srcOffset + 3];
284 >
285 > if (
286 > (tokenDeltaLine > startDeltaLine || (tokenDeltaLine === startDeltaLine && tokenEndCharacter >= startChar))
287 > && (tokenDeltaLine < endDeltaLine || (tokenDeltaLine === endDeltaLine && tokenStartCharacter <= endChar))
288 > ) {
289 hasDeletedTokens = true;
290 > } else { sparseMultilineTokens.ts
291 if (newTokenCount === 0) {
292 firstDeltaLine = tokenDeltaLine;
305 newTokenCount++;
306 }
308 >
309 > this._tokenCount = newTokenCount;
310 >
311 > return firstDeltaLine;
312 > }
313
314 public split(startDeltaLine: number, startChar: number, endDeltaLine: number, endChar: number): [SparseMultilineTokensStorage, SparseMultilineTokensStorage, number] {
src/vs/editor/common/tokens/sparseTokensStore.ts 27 introduced LOC · 6 ranges

Open complete file

48
49 public setPartial(_range: Range, pieces: SparseMultilineTokens[]): Range {
50 > // console.log(`setPartial ${_range} ${pieces.map(p => p.toString()).join(', ')}`); sparseTokensStore.ts
51 >
52 > let range = _range;
53 > if (pieces.length > 0) {
54 const _firstRange = pieces[0].getRange();
55 const _lastRange = pieces[pieces.length - 1].getRange();
59 range = _range.plusRange(_firstRange).plusRange(_lastRange);
60 }
62 > let insertPosition: { index: number } | null = null;
63 > for (let i = 0, len = this._pieces.length; i < len; i++) {
64 > const piece = this._pieces[i];
65 > if (piece.endLineNumber < range.startLineNumber) {
66 // this piece is before the range
67 continue;
68 }
70 > if (piece.startLineNumber > range.endLineNumber) {
71 // this piece is after the range, so mark the spot before this piece
72 // as a good insertion position and stop looping
74 break;
75 }
77 > // this piece might intersect with the range
78 > piece.removeTokens(range);
79 >
80 > if (piece.isEmpty()) {
81 // remove the piece if it became empty
82 this._pieces.splice(i, 1);
113
114 insertPosition = insertPosition || { index: i };
116 >
117 > insertPosition = insertPosition || { index: this._pieces.length };
118 >
119 > if (pieces.length > 0) {
120 this._pieces = arrays.arrayInsert(this._pieces, insertPosition.index, pieces);
121 }
123 > // console.log(`I HAVE ${this._pieces.length} pieces`);
124 > // console.log(`${this._pieces.map(p => p.toString()).join('\n')}`);
125 >
126 > return range;
127 > }
128
129 public isComplete(): boolean {