Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/common/textModelGuides.ts
3292 views
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
import { IPosition } from './core/position.js';
7
8
export interface IGuidesTextModelPart {
9
/**
10
* @internal
11
*/
12
getActiveIndentGuide(lineNumber: number, minLineNumber: number, maxLineNumber: number): IActiveIndentGuideInfo;
13
14
/**
15
* @internal
16
*/
17
getLinesIndentGuides(startLineNumber: number, endLineNumber: number): number[];
18
19
/**
20
* Requests the indent guides for the given range of lines.
21
* `result[i]` will contain the indent guides of the `startLineNumber + i`th line.
22
* @internal
23
*/
24
getLinesBracketGuides(startLineNumber: number, endLineNumber: number, activePosition: IPosition | null, options: BracketGuideOptions): IndentGuide[][];
25
}
26
27
export interface IActiveIndentGuideInfo {
28
startLineNumber: number;
29
endLineNumber: number;
30
indent: number;
31
}
32
33
export enum HorizontalGuidesState {
34
Disabled,
35
EnabledForActive,
36
Enabled
37
}
38
39
export interface BracketGuideOptions {
40
includeInactive: boolean;
41
horizontalGuides: HorizontalGuidesState;
42
highlightActive: boolean;
43
}
44
45
export class IndentGuide {
46
constructor(
47
public readonly visibleColumn: number | -1,
48
public readonly column: number | -1,
49
public readonly className: string,
50
/**
51
* If set, this indent guide is a horizontal guide (no vertical part).
52
* It starts at visibleColumn and continues until endColumn.
53
*/
54
public readonly horizontalLine: IndentGuideHorizontalLine | null,
55
/**
56
* If set (!= -1), only show this guide for wrapped lines that don't contain this model column, but are after it.
57
*/
58
public readonly forWrappedLinesAfterColumn: number | -1,
59
public readonly forWrappedLinesBeforeOrAtColumn: number | -1
60
) {
61
if ((visibleColumn !== -1) === (column !== -1)) {
62
throw new Error();
63
}
64
}
65
}
66
67
export class IndentGuideHorizontalLine {
68
constructor(
69
public readonly top: boolean,
70
public readonly endColumn: number,
71
) { }
72
}
73
74