-
Notifications
You must be signed in to change notification settings - Fork 2
/
syntect.pyi
116 lines (88 loc) · 2.72 KB
/
syntect.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from typing import List, Tuple
class LoadingError(Exception):
"""Exception that occurs whilst loading themes/syntax files."""
...
class SyntaxNotFoundError(Exception):
"""Exception that occurs when a syntax definition was not found."""
...
class Color:
"""Class describing an RGBA color."""
r: int = ...
g: int = ...
b: int = ...
a: int = ...
class Syntax:
"""Handle to a language syntax definition."""
name: str
language: str
class SyntaxSet:
"""Handle to a list of language syntax definitions."""
languages: List[str] = ...
def find_syntax_by_extension(self, extension: str) -> Syntax:
"""
Find language syntax descriptor.
Find and return the syntax definition for a language, given
its file extension.
Parameters
----------
extension: str
Extension name of the language to lookup.
Returns
-------
syntax: Syntax
Handle to the language syntax definition.
Raises
------
SyntaxNotFoundError
If the provided language file extension does not have a known
syntax definition on this set.
"""
...
class Theme:
"""
Handle to a theme descriptor.
This class points and refers to the main colors and settings defined by
the theme.
"""
name: str
background: Color
foreground: Color
caret: Color
line_highlight: Color
misspelling: Color
accent: Color
bracket_contents_foreground: Color
brackets_foreground: Color
brackets_background: Color
tags_foreground: Color
highlight: Color
find_highlight: Color
find_highlight_foreground: Color
gutter: Color
gutter_foreground: Color
selection: Color
selection_foreground: Color
selection_border: Color
inactive_selection: Color
inactive_selection_foreground: Color
guide: Color
active_guide: Color
stack_guide: Color
shadow: Color
class ThemeSet:
"""Handle to a map of highlighting themes."""
themes: List[str]
def __getitem__(self, theme: str) -> Theme: ...
class Style:
"""Style color description used to highlight a token."""
foreground: Color = ...
background: Color = ...
font_style: int = ...
def load_theme_folder(path: str) -> ThemeSet: ...
def load_syntax_folder(path: str) -> SyntaxSet: ...
def load_default_syntax() -> SyntaxSet: ...
def highlight(text: str, language: str, syntax_set: SyntaxSet,
theme: Theme) -> List[Tuple[Style, str]]: ...
def escape_to_console(all_ranges: List[Tuple[Style, str]],
display_bg: bool) -> None: ...
def escape_to_latex(all_ranges: List[Tuple[Style, str]]) -> str: ...