Skip to content

Commit faa736e

Browse files
authored
Fixes microsoft#150177: Extract LinePartMetadata to a separate file (microsoft#150259)
1 parent 927f12f commit faa736e

File tree

3 files changed

+38
-33
lines changed

3 files changed

+38
-33
lines changed

src/vs/editor/common/viewLayout/lineDecorations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import * as strings from 'vs/base/common/strings';
77
import { Constants } from 'vs/base/common/uint';
8+
import { LinePartMetadata } from 'vs/editor/common/viewLayout/linePart';
89
import { InlineDecoration, InlineDecorationType } from 'vs/editor/common/viewModel';
9-
import { LinePartMetadata } from 'vs/editor/common/viewLayout/viewLineRenderer';
1010

1111
export class LineDecoration {
1212
_lineDecorationBrand: void = undefined;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*---------------------------------------------------------------------------------------------
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).
22+
*/
23+
public readonly endIndex: number,
24+
public readonly type: string,
25+
public readonly metadata: number,
26+
public readonly containsRTL: boolean
27+
) { }
28+
29+
public isWhitespace(): boolean {
30+
return (this.metadata & LinePartMetadata.IS_WHITESPACE_MASK ? true : false);
31+
}
32+
33+
public isPseudoAfter(): boolean {
34+
return (this.metadata & LinePartMetadata.PSEUDO_AFTER_MASK ? true : false);
35+
}
36+
}

src/vs/editor/common/viewLayout/viewLineRenderer.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { IViewLineTokens } from 'vs/editor/common/tokens/lineTokens';
99
import { IStringBuilder, createStringBuilder } from 'vs/editor/common/core/stringBuilder';
1010
import { LineDecoration, LineDecorationsNormalizer } from 'vs/editor/common/viewLayout/lineDecorations';
1111
import { InlineDecorationType } from 'vs/editor/common/viewModel';
12+
import { LinePart, LinePartMetadata } from 'vs/editor/common/viewLayout/linePart';
1213

1314
export const enum RenderWhitespace {
1415
None = 0,
@@ -18,38 +19,6 @@ export const enum RenderWhitespace {
1819
All = 4
1920
}
2021

21-
export const enum LinePartMetadata {
22-
IS_WHITESPACE = 1,
23-
PSEUDO_BEFORE = 2,
24-
PSEUDO_AFTER = 4,
25-
26-
IS_WHITESPACE_MASK = 0b001,
27-
PSEUDO_BEFORE_MASK = 0b010,
28-
PSEUDO_AFTER_MASK = 0b100,
29-
}
30-
31-
class LinePart {
32-
_linePartBrand: void = undefined;
33-
34-
constructor(
35-
/**
36-
* last char index of this token (not inclusive).
37-
*/
38-
public readonly endIndex: number,
39-
public readonly type: string,
40-
public readonly metadata: number,
41-
public readonly containsRTL: boolean
42-
) { }
43-
44-
public isWhitespace(): boolean {
45-
return (this.metadata & LinePartMetadata.IS_WHITESPACE_MASK ? true : false);
46-
}
47-
48-
public isPseudoAfter(): boolean {
49-
return (this.metadata & LinePartMetadata.PSEUDO_AFTER_MASK ? true : false);
50-
}
51-
}
52-
5322
export class LineRange {
5423
/**
5524
* Zero-based offset on which the range starts, inclusive.

0 commit comments

Comments
 (0)