lineDecorations.ts ×14

Frontier kind: Code frontier

unlabeled · c_0db431e7d958

77 tests · 7328 LOC · 35 files · introduces 0 tests · 83 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
18 ranges83 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
849 ranges7328 lines · 35 files · Browse complete extent
All tests (intent)
77 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: 83 introduced LOC across 18 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/editor/common/viewLayout/lineDecorations.ts 59 introduced LOC · 14 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- lineDecorations.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 * as strings from '../../../base/common/strings.js';
7 > import { Constants } from '../../../base/common/uint.js';
8 > import { InlineDecoration, InlineDecorationType } from '../viewModel/inlineDecorations.js';
9 > import { LinePartMetadata } from './linePart.js';
10 >
11 > export class LineDecoration {
12 > _lineDecorationBrand: void = undefined;
13 >
14 > constructor(
15 public readonly startColumn: number,
16 public readonly endColumn: number,
19 ) {
20 }
22 > private static _equals(a: LineDecoration, b: LineDecoration): boolean {
23 return (
24 a.startColumn === b.startColumn
28 );
29 }
31 > public static equalsArr(a: readonly LineDecoration[], b: readonly LineDecoration[]): boolean {
32 const aLen = a.length;
33 const bLen = b.length;
42 return true;
43 }
45 > public static extractWrapped(arr: LineDecoration[], startOffset: number, endOffset: number): LineDecoration[] {
46 if (arr.length === 0) {
47 return arr;
60 return r;
61 }
63 > public static filter(lineDecorations: InlineDecoration[], lineNumber: number, minLineColumn: number, maxLineColumn: number): LineDecoration[] {
64 if (lineDecorations.length === 0) {
65 return [];
91 return result;
92 }
94 > private static _typeCompare(a: InlineDecorationType, b: InlineDecorationType): number {
95 const ORDER = [2, 0, 1, 3];
96 return ORDER[a] - ORDER[b];
97 }
99 > public static compare(a: LineDecoration, b: LineDecoration): number {
100 if (a.startColumn !== b.startColumn) {
101 return a.startColumn - b.startColumn;
117 return 0;
118 }
120 >
121 > export class DecorationSegment {
122 > startOffset: number;
123 > endOffset: number;
124 > className: string;
125 > metadata: number;
126 >
127 > constructor(startOffset: number, endOffset: number, className: string, metadata: number) {
128 this.startOffset = startOffset;
129 this.endOffset = endOffset;
131 this.metadata = metadata;
132 }
134 >
135 > class Stack {
136 > public count: number;
137 > private readonly stopOffsets: number[];
138 > private readonly classNames: string[];
139 > private readonly metadata: number[];
140 >
141 > constructor() {
142 this.stopOffsets = [];
143 this.classNames = [];
145 this.count = 0;
146 }
148 > private static _metadata(metadata: number[]): number {
149 let result = 0;
150 for (let i = 0, len = metadata.length; i < len; i++) {
153 return result;
154 }
156 > public consumeLowerThan(maxStopOffset: number, nextStartOffset: number, result: DecorationSegment[]): number {
157
158 while (this.count > 0 && this.stopOffsets[0] < maxStopOffset) {
182 return nextStartOffset;
183 }
185 > public insert(stopOffset: number, className: string, metadata: number): void {
186 if (this.count === 0 || this.stopOffsets[this.count - 1] <= stopOffset) {
187 // Insert at the end
203 return;
204 }
206 >
207 > export class LineDecorationsNormalizer {
208 > /**
209 > * Normalize line decorations. Overlapping decorations will generate multiple segments
210 > */
211 > public static normalize(lineContent: string, lineDecorations: LineDecoration[]): DecorationSegment[] {
212 if (lineDecorations.length === 0) {
213 return [];
src/vs/editor/common/viewLayout/linePart.ts 24 introduced LOC · 4 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- linePart.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 > export const enum LinePartMetadata {
7 > IS_WHITESPACE = 1,
8 > PSEUDO_BEFORE = 2,
9 > PSEUDO_AFTER = 4,
10 >
11 > IS_WHITESPACE_MASK = 0b001,
12 > PSEUDO_BEFORE_MASK = 0b010,
13 > PSEUDO_AFTER_MASK = 0b100,
14 > }
15 >
16 > export class LinePart {
17 > _linePartBrand: void = undefined;
18 >
19 > constructor(
20 /**
21 * last char index of this token (not inclusive).
26 public readonly containsRTL: boolean
27 ) { }
29 > public isWhitespace(): boolean {
30 return (this.metadata & LinePartMetadata.IS_WHITESPACE_MASK ? true : false);
31 }
33 > public isPseudoAfter(): boolean {
34 return (this.metadata & LinePartMetadata.PSEUDO_AFTER_MASK ? true : false);
35 }
36 > } linePart.ts