testLineToken.ts ×26

Frontier kind: Code frontier

unlabeled · c_57d879044efd

159 tests · 8149 LOC · 37 files · introduces 0 tests · 79 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
26 ranges79 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
987 ranges8149 lines · 37 files · Browse complete extent
All tests (intent)
159 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: 79 introduced LOC across 26 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/test/common/core/testLineToken.ts 79 introduced LOC · 26 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- testLineToken.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { IViewLineTokens } from '../../../common/tokens/lineTokens.js';
7 > import { ColorId, TokenMetadata, ITokenPresentation, StandardTokenType } from '../../../common/encodedTokenAttributes.js';
8 > import { ILanguageIdCodec } from '../../../common/languages.js';
9 >
10 > /**
11 > * A token on a line.
12 > */
13 > export class TestLineToken {
14 >
15 > /**
16 > * last char index of this token (not inclusive).
17 > */
18 > public readonly endIndex: number;
19 > private readonly _metadata: number;
20 >
21 > constructor(endIndex: number, metadata: number) {
22 this.endIndex = endIndex;
23 this._metadata = metadata;
24 }
26 > public getStandardTokenType(): StandardTokenType {
27 return TokenMetadata.getTokenType(this._metadata);
28 }
30 > public getForeground(): ColorId {
31 return TokenMetadata.getForeground(this._metadata);
32 }
34 > public getType(): string {
35 return TokenMetadata.getClassNameFromMetadata(this._metadata);
36 }
38 > public getInlineStyle(colorMap: string[]): string {
39 return TokenMetadata.getInlineStyleFromMetadata(this._metadata, colorMap);
40 }
42 > public getPresentation(): ITokenPresentation {
43 return TokenMetadata.getPresentationFromMetadata(this._metadata);
44 }
46 > private static _equals(a: TestLineToken, b: TestLineToken): boolean {
47 return (
48 a.endIndex === b.endIndex
50 );
51 }
53 > public static equalsArr(a: TestLineToken[], b: TestLineToken[]): boolean {
54 const aLen = a.length;
55 const bLen = b.length;
64 return true;
65 }
67 >
68 > export class TestLineTokens implements IViewLineTokens {
69 >
70 > private readonly _actual: TestLineToken[];
71 >
72 > constructor(actual: TestLineToken[]) {
73 this._actual = actual;
74 }
76 > public equals(other: IViewLineTokens): boolean {
77 if (other instanceof TestLineTokens) {
78 return TestLineToken.equalsArr(this._actual, other._actual);
80 return false;
81 }
83 > public getCount(): number {
84 return this._actual.length;
85 }
87 > public getStandardTokenType(tokenIndex: number): StandardTokenType {
88 return this._actual[tokenIndex].getStandardTokenType();
89 }
91 > public getForeground(tokenIndex: number): ColorId {
92 return this._actual[tokenIndex].getForeground();
93 }
95 > public getEndOffset(tokenIndex: number): number {
96 return this._actual[tokenIndex].endIndex;
97 }
99 > public getClassName(tokenIndex: number): string {
100 return this._actual[tokenIndex].getType();
101 }
103 > public getInlineStyle(tokenIndex: number, colorMap: string[]): string {
104 return this._actual[tokenIndex].getInlineStyle(colorMap);
105 }
107 > public getPresentation(tokenIndex: number): ITokenPresentation {
108 return this._actual[tokenIndex].getPresentation();
109 }
111 > public findTokenIndexAtOffset(offset: number): number {
112 throw new Error('Not implemented');
113 }
115 > public getLineContent(): string {
116 throw new Error('Not implemented');
117 }
119 > public getMetadata(tokenIndex: number): number {
120 throw new Error('Method not implemented.');
121 }
123 > public getLanguageId(tokenIndex: number): string {
124 throw new Error('Method not implemented.');
125 }
127 > public getTokenText(tokenIndex: number): string {
128 throw new Error('Method not implemented.');
129 }
131 > public forEach(callback: (tokenIndex: number) => void): void {
132 throw new Error('Not implemented');
133 }
135 > public get languageIdCodec(): ILanguageIdCodec {
136 throw new Error('Not implemented');
137 }
139 >
140 > export class TestLineTokenFactory {
141 >
142 > public static inflateArr(tokens: Uint32Array): TestLineToken[] {
143 const tokensCount = (tokens.length >>> 1);
144