src/vs/editor/common/tokenizationTextModelPart.ts

102 LOC · 102 covered · 0 uncovered · 1 ranges · 1708 concepts · 1 introducers · 861 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- textModel.ts ×190
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 { Range } from './core/range.js';
7 > import { StandardTokenType } from './encodedTokenAttributes.js';
8 > import { LineTokens } from './tokens/lineTokens.js';
9 > import { SparseMultilineTokens } from './tokens/sparseMultilineTokens.js';
10 >
11 > /**
12 > * Provides tokenization related functionality of the text model.
13 > */
14 > export interface ITokenizationTextModelPart {
15 > readonly hasTokens: boolean;
16 >
17 > /**
18 > * Replaces all semantic tokens with the provided `tokens`.
19 > * @internal
20 > */
21 > setSemanticTokens(tokens: SparseMultilineTokens[] | null, isComplete: boolean): void;
22 >
23 > /**
24 > * Merges the provided semantic tokens into existing semantic tokens.
25 > * @internal
26 > */
27 > setPartialSemanticTokens(range: Range, tokens: SparseMultilineTokens[] | null): void;
28 >
29 > /**
30 > * @internal
31 > */
32 > hasCompleteSemanticTokens(): boolean;
33 >
34 > /**
35 > * @internal
36 > */
37 > hasSomeSemanticTokens(): boolean;
38 >
39 > /**
40 > * Flush all tokenization state.
41 > * @internal
42 > */
43 > resetTokenization(): void;
44 >
45 > /**
46 > * Force tokenization information for `lineNumber` to be accurate.
47 > * @internal
48 > */
49 > forceTokenization(lineNumber: number): void;
50 >
51 > /**
52 > * If it is cheap, force tokenization information for `lineNumber` to be accurate.
53 > * This is based on a heuristic.
54 > * @internal
55 > */
56 > tokenizeIfCheap(lineNumber: number): void;
57 >
58 > /**
59 > * Check if tokenization information is accurate for `lineNumber`.
60 > * @internal
61 > */
62 > hasAccurateTokensForLine(lineNumber: number): boolean;
63 >
64 > /**
65 > * Check if calling `forceTokenization` for this `lineNumber` will be cheap (time-wise).
66 > * This is based on a heuristic.
67 > * @internal
68 > */
69 > isCheapToTokenize(lineNumber: number): boolean;
70 >
71 > /**
72 > * Get the tokens for the line `lineNumber`.
73 > * The tokens might be inaccurate. Use `forceTokenization` to ensure accurate tokens.
74 > * @internal
75 > */
76 > getLineTokens(lineNumber: number): LineTokens;
77 >
78 > /**
79 > * Returns the standard token type for a character if the character were to be inserted at
80 > * the given position. If the result cannot be accurate, it returns null.
81 > * @internal
82 > */
83 > getTokenTypeIfInsertingCharacter(lineNumber: number, column: number, character: string): StandardTokenType;
84 >
85 > /**
86 > * Tokens the lines as if they were inserted at [lineNumber, lineNumber).
87 > * @internal
88 > */
89 > tokenizeLinesAt(lineNumber: number, lines: string[]): LineTokens[] | null;
90 >
91 > getLanguageId(): string;
92 > getLanguageIdAtPosition(lineNumber: number, column: number): string;
93 >
94 > setLanguageId(languageId: string, source?: string): void;
95 >
96 > readonly backgroundTokenizationState: BackgroundTokenizationState;
97 > }
98 >
99 > export const enum BackgroundTokenizationState {
100 > InProgress = 1,
101 > Completed = 2,
102 > }