@pulsar-edit/types 1.128.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.github/workflows/publish.yml +33 -0
  2. package/LICENSE.md +8 -0
  3. package/README.md +187 -0
  4. package/atom-i18n/config.d.ts +9 -0
  5. package/atom-i18n/index.d.ts +4 -0
  6. package/autocomplete-plus/config.d.ts +140 -0
  7. package/autocomplete-plus/index.d.ts +200 -0
  8. package/dependencies/event-kit/index.d.ts +143 -0
  9. package/dependencies/first-mate/index.d.ts +1 -0
  10. package/dependencies/first-mate/src/first-mate.d.ts +1 -0
  11. package/dependencies/first-mate/src/grammar.d.ts +119 -0
  12. package/dependencies/pathwatcher/index.d.ts +1 -0
  13. package/dependencies/pathwatcher/src/directory.d.ts +98 -0
  14. package/dependencies/pathwatcher/src/file.d.ts +115 -0
  15. package/dependencies/pathwatcher/src/main.d.ts +2 -0
  16. package/dependencies/service-hub/index.d.ts +3 -0
  17. package/dependencies/service-hub/src/consumer.d.ts +8 -0
  18. package/dependencies/service-hub/src/provider.d.ts +14 -0
  19. package/dependencies/service-hub/src/service-hub.d.ts +46 -0
  20. package/dependencies/service-hub/src/util.d.ts +1 -0
  21. package/dependencies/text-buffer/index.d.ts +1 -0
  22. package/dependencies/text-buffer/src/display-marker-layer.d.ts +182 -0
  23. package/dependencies/text-buffer/src/display-marker.d.ts +232 -0
  24. package/dependencies/text-buffer/src/helpers.d.ts +11 -0
  25. package/dependencies/text-buffer/src/marker-layer.d.ts +117 -0
  26. package/dependencies/text-buffer/src/marker.d.ts +207 -0
  27. package/dependencies/text-buffer/src/point.d.ts +102 -0
  28. package/dependencies/text-buffer/src/range.d.ts +141 -0
  29. package/dependencies/text-buffer/src/text-buffer.d.ts +759 -0
  30. package/index.d.ts +72 -0
  31. package/linter/config.d.ts +26 -0
  32. package/linter/index.d.ts +108 -0
  33. package/package.json +61 -0
  34. package/src/atom-environment.d.ts +361 -0
  35. package/src/branding.d.ts +19 -0
  36. package/src/buffered-node-process.d.ts +10 -0
  37. package/src/buffered-process.d.ts +88 -0
  38. package/src/clipboard.d.ts +14 -0
  39. package/src/color.d.ts +11 -0
  40. package/src/command-registry.d.ts +118 -0
  41. package/src/config-schema.d.ts +271 -0
  42. package/src/config.d.ts +168 -0
  43. package/src/context-menu-manager.d.ts +65 -0
  44. package/src/cursor.d.ts +252 -0
  45. package/src/decoration.d.ts +156 -0
  46. package/src/deserializer-manager.d.ts +15 -0
  47. package/src/dock.d.ts +121 -0
  48. package/src/get-window-load-settings.d.ts +26 -0
  49. package/src/git-repository.d.ts +174 -0
  50. package/src/grammar-registry.d.ts +241 -0
  51. package/src/gutter.d.ts +118 -0
  52. package/src/history-manager.d.ts +28 -0
  53. package/src/keymap-extensions.d.ts +190 -0
  54. package/src/language-mode.d.ts +314 -0
  55. package/src/layer-decoration.d.ts +31 -0
  56. package/src/menu-manager.d.ts +24 -0
  57. package/src/notification-manager.d.ts +37 -0
  58. package/src/notification.d.ts +79 -0
  59. package/src/other-types.d.ts +283 -0
  60. package/src/package-manager.d.ts +103 -0
  61. package/src/package.d.ts +33 -0
  62. package/src/pane.d.ts +604 -0
  63. package/src/panel.d.ts +38 -0
  64. package/src/path-watcher.d.ts +35 -0
  65. package/src/project.d.ts +110 -0
  66. package/src/scope-descriptor.d.ts +8 -0
  67. package/src/selection.d.ts +341 -0
  68. package/src/style-manager.d.ts +68 -0
  69. package/src/task.d.ts +38 -0
  70. package/src/text-editor-component.d.ts +15 -0
  71. package/src/text-editor-element.d.ts +48 -0
  72. package/src/text-editor-registry.d.ts +48 -0
  73. package/src/text-editor.d.ts +1416 -0
  74. package/src/theme-manager.d.ts +29 -0
  75. package/src/tooltip-manager.d.ts +42 -0
  76. package/src/tooltip.d.ts +63 -0
  77. package/src/ui.d.ts +101 -0
  78. package/src/view-registry.d.ts +34 -0
  79. package/src/wasm-tree-sitter-grammar.d.ts +305 -0
  80. package/src/wasm-tree-sitter-language-mode.d.ts +294 -0
  81. package/src/workspace-center.d.ts +117 -0
  82. package/src/workspace.d.ts +485 -0
  83. package/status-bar/config.d.ts +23 -0
  84. package/status-bar/index.d.ts +51 -0
  85. package/tool-bar/config.d.ts +20 -0
  86. package/tool-bar/index.d.ts +235 -0
  87. package/tsconfig.json +8 -0
@@ -0,0 +1,29 @@
1
+ import { Disposable, Package } from "../index";
2
+
3
+ /** Handles loading and activating available themes. */
4
+ export interface ThemeManager {
5
+ // Event Subscription
6
+ /**
7
+ * Invoke callback when style sheet changes associated with updating the
8
+ * list of active themes have completed.
9
+ */
10
+ onDidChangeActiveThemes(callback: () => void): Disposable;
11
+
12
+ // Accessing Loaded Themes
13
+ /** Returns an Array of strings of all the loaded theme names. */
14
+ getLoadedThemeNames(): string[] | undefined;
15
+
16
+ /** Returns an Array of all the loaded themes. */
17
+ getLoadedThemes(): Package[] | undefined;
18
+
19
+ // Managing Enabled Themes
20
+ /** Returns an Array of strings all the active theme names. */
21
+ getActiveThemeNames(): string[] | undefined;
22
+
23
+ /** Returns an Array of all the active themes. */
24
+ getActiveThemes(): Package[] | undefined;
25
+
26
+ // Managing Enabled Themes
27
+ /** Get the enabled theme names from the config. */
28
+ getEnabledThemeNames(): string[];
29
+ }
@@ -0,0 +1,42 @@
1
+ import { Disposable, Tooltip } from "../index";
2
+
3
+ export type TooltipPlacement =
4
+ | "top"
5
+ | "bottom"
6
+ | "left"
7
+ | "right"
8
+ | "auto"
9
+ | "auto top"
10
+ | "auto bottom"
11
+ | "auto left"
12
+ | "auto right";
13
+
14
+ /** Associates tooltips with HTML elements or selectors. */
15
+ export interface TooltipManager {
16
+ /** Add a tooltip to the given element. */
17
+ add(
18
+ target: HTMLElement | JQueryCompatible,
19
+ options:
20
+ | {
21
+ item?: object | undefined;
22
+ }
23
+ | ({
24
+ title?: string | (() => string) | undefined;
25
+ html?: boolean | undefined;
26
+ keyBindingCommand?: string | undefined;
27
+ keyBindingTarget?: HTMLElement | undefined;
28
+ } & {
29
+ class?: string | undefined;
30
+ placement?: TooltipPlacement | (() => TooltipPlacement) | undefined;
31
+ trigger?: "click" | "hover" | "focus" | "manual" | undefined;
32
+ delay?: { show: number; hide: number } | undefined;
33
+ }),
34
+ ): Disposable;
35
+
36
+ /** Find the tooltips that have been applied to the given element. */
37
+ findTooltips(target: HTMLElement): Tooltip[];
38
+ }
39
+
40
+ export interface JQueryCompatible<Element extends Node = HTMLElement> extends Iterable<Element> {
41
+ jquery: string;
42
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * This tooltip class is derived from Bootstrap 3, but modified to not require
3
+ * jQuery, which is an expensive dependency we want to eliminate.
4
+ */
5
+ export interface Tooltip {
6
+ readonly options: TooltipOptions;
7
+ readonly enabled: boolean;
8
+ readonly timeout: number;
9
+ readonly hoverState: "in" | "out" | null;
10
+ readonly element: HTMLElement;
11
+
12
+ getTitle(): string;
13
+ getTooltipElement(): HTMLElement;
14
+ getArrowElement(): HTMLElement;
15
+ enable(): void;
16
+ disable(): void;
17
+ toggleEnabled(): void;
18
+ toggle(): void;
19
+ recalculatePosition(): void;
20
+ }
21
+
22
+ /** The options for a Bootstrap 3 Tooltip class, which Atom uses a variant of. */
23
+ export interface TooltipOptions {
24
+ /** Apply a CSS fade transition to the tooltip. */
25
+ animation?: boolean | undefined;
26
+
27
+ /** Appends the tooltip to a specific element. */
28
+ container?: string | HTMLElement | false | undefined;
29
+
30
+ /**
31
+ * Delay showing and hiding the tooltip (ms) - does not apply to manual
32
+ * trigger type.
33
+ */
34
+ delay?: number | { show: number; hide: number } | undefined;
35
+
36
+ /** Allow HTML in the tooltip. */
37
+ html?: boolean | undefined;
38
+
39
+ /** How to position the tooltip. */
40
+ placement?: "top" | "bottom" | "left" | "right" | "auto" | undefined;
41
+
42
+ /**
43
+ * If a selector is provided, tooltip objects will be delegated to the
44
+ * specified targets.
45
+ */
46
+ selector?: string | undefined;
47
+
48
+ /** Base HTML to use when creating the tooltip. */
49
+ template?: string | undefined;
50
+
51
+ /**
52
+ * Default title value if title attribute isn't present.
53
+ * If a function is given, it will be called with its this reference set to
54
+ * the element that the tooltip is attached to.
55
+ */
56
+ title?: string | HTMLElement | (() => string) | undefined;
57
+
58
+ /**
59
+ * How tooltip is triggered - click | hover | focus | manual.
60
+ * You may pass multiple triggers; separate them with a space.
61
+ */
62
+ trigger?: string | undefined;
63
+ }
package/src/ui.d.ts ADDED
@@ -0,0 +1,101 @@
1
+ import { Grammar } from '../index';
2
+
3
+ type MarkdownRenderOptions = {
4
+ renderMode?: 'full' | 'fragment',
5
+ html?: boolean,
6
+ sanitize?: boolean,
7
+ sanitizeAllowUnknownProtocols?: boolean,
8
+ sanitizeAllowSelfClose?: boolean,
9
+ breaks?: boolean,
10
+ handleFrontMatter?: boolean,
11
+ useDefaultEmoji?: boolean,
12
+ useGitHubHeadings?: boolean,
13
+ useTaskCheckbox?: boolean,
14
+ taskCheckboxDisabled?: boolean,
15
+ taskCheckboxDivWrap?: boolean,
16
+ transformImageLinks?: boolean,
17
+ transformAtomLinks?: boolean,
18
+ transformNonFqdnLinks?: boolean,
19
+ rootDomain?: string,
20
+ filePath?: string,
21
+ disableMode?: 'none' | 'strict'
22
+ }
23
+
24
+ type ApplySyntaxHighlightingOptions = {
25
+ syntaxScopeNameFunc?: (id: string) => string,
26
+ renderMode?: 'full'| 'fragment',
27
+ grammar?: Grammar
28
+ };
29
+
30
+ type MatcherOptions = {
31
+ numThreads?: number
32
+ algorithm?: 'fuzzaldrin' | 'command-t'
33
+ maxResults?: number
34
+ recordMatchIndexes?: boolean
35
+ maxGap: number
36
+ }
37
+
38
+ type MatchResult = {
39
+ id: number
40
+ value: string
41
+ score: number
42
+ matchIndexes?: number[]
43
+ }
44
+
45
+ interface Matcher {
46
+ numCpus: number;
47
+ match(query: string, options: MatcherOptions): MatchResult;
48
+ setCandidates(candidates: string[]): void;
49
+ }
50
+
51
+ interface Markdown {
52
+ /**
53
+ * Render a Markdown document as HTML.
54
+ */
55
+ render(content: string, options?: MarkdownRenderOptions): string;
56
+
57
+ /**
58
+ * Apply Pulsar's built-in syntax highlighting system to code blocks within
59
+ * Markdown. Modifies the given `DocumentFragment`.
60
+ */
61
+ applySyntaxHighlighting(
62
+ content: DocumentFragment,
63
+ options?: ApplySyntaxHighlightingOptions
64
+ ): Promise<HTMLElement>;
65
+
66
+ /**
67
+ * Convert a string of HTML into a `DocumentFragment`.
68
+ */
69
+ convertToDOM(content: string): DocumentFragment;
70
+ }
71
+
72
+ interface FuzzyMatcher {
73
+ setCandidates(candidates: string[]): Matcher;
74
+ setCandidates(matcher: Matcher, candidates: string[]): Matcher;
75
+
76
+ score(candidate: string, query: string, options?: MatcherOptions): number;
77
+ match(candidate: string, query: string, options?: MatcherOptions): MatchResult;
78
+ }
79
+
80
+ export interface UI {
81
+ /**
82
+ * Utility methods for converting Markdown to HTML.
83
+ */
84
+ markdown: Markdown,
85
+
86
+ /**
87
+ * The fuzzy-matcher API – just like the one used in `autocomplete-plus`,
88
+ * the command palette, etc.
89
+ *
90
+ * This API filters and scores a list of candidates based on what the user
91
+ * has typed. Scoring is done by the particular algorithm of the configured
92
+ * fuzzy-matching library. Filtering is done by returning a new
93
+ * {@link Matcher} using {@link Matcher#setCandidates}, then calling
94
+ * {@link Matcher#match}.
95
+ *
96
+ * You may also use {@link UI.fuzzyMatcher}’s `match` method to match a
97
+ * single candidate; it uses the same API and options as
98
+ * {@link Matcher#match}.
99
+ */
100
+ fuzzyMatcher: FuzzyMatcher
101
+ }
@@ -0,0 +1,34 @@
1
+ import { Disposable, TextEditor, TextEditorElement } from "../index";
2
+
3
+ /**
4
+ * Handles the association between model and view types in Atom. We call this
5
+ * association a _view provider_.
6
+ *
7
+ * In other words: for a given model, this class can provide a view via
8
+ * {@link getView}, as long as the model/view association was registered via
9
+ * {@link addViewProvider}.
10
+ */
11
+ export interface ViewRegistry {
12
+ /**
13
+ * Add a provider that will be used to construct views in the workspace's
14
+ * view layer based on model objects in its model layer.
15
+ */
16
+ addViewProvider(createView: (model: object) => HTMLElement | undefined): Disposable;
17
+ /**
18
+ * Add a provider that will be used to construct views in the workspace's
19
+ * view layer based on model objects in its model layer.
20
+ */
21
+ // tslint:disable-next-line:no-any
22
+ addViewProvider<T>(
23
+ modelConstructor: { new(...args: any[]): T }, // tslint:disable-line no-any
24
+ createView: (instance: T) => HTMLElement | undefined,
25
+ ): Disposable;
26
+
27
+ /** Get the view associated with an object in the workspace. */
28
+ getView(obj: TextEditor): TextEditorElement;
29
+ getView(obj: object): HTMLElement;
30
+ }
31
+
32
+ export interface ViewModel {
33
+ getTitle: () => string;
34
+ }
@@ -0,0 +1,305 @@
1
+ import {
2
+ Disposable,
3
+ Grammar,
4
+ GrammarRegistry,
5
+ GrammarToken,
6
+ Range,
7
+ TextBuffer,
8
+ TokenizeLineResult
9
+ } from '../index';
10
+ import type { Language, Node, Query } from 'web-tree-sitter';
11
+
12
+ /**
13
+ * An object with properties that describe the comment delimiters of a given
14
+ * language.
15
+ */
16
+ export type CommentDelimiterSpec = {
17
+ /**
18
+ * If present, a delimiter to be used for line comments. (If missing, the
19
+ * language does not support line comments.)
20
+ */
21
+ line?: string,
22
+ /**
23
+ * If present, a two-item tuple representing the starting and ending
24
+ * delimiters of block comments. (If missing, the language does not support
25
+ * block comments.)
26
+ */
27
+ block?: [string, string]
28
+ }
29
+
30
+ /** A "standard" type of query used by Pulsar. */
31
+ type StandardQueryType =
32
+ | 'highlightsQuery'
33
+ | 'foldsQuery'
34
+ | 'tagsQuery'
35
+ | 'indentsQuery'
36
+
37
+ /**
38
+ * An arbitrary query name that can be used by a community package.
39
+ */
40
+ type CustomQueryType = string;
41
+
42
+ type DidChangeQueryPayload = {
43
+ filePath: string,
44
+ queryType: StandardQueryType | CustomQueryType
45
+ }
46
+
47
+ type LanguageScopeFunction = (
48
+ grammar: WASMTreeSitterGrammar,
49
+ buffer: TextBuffer,
50
+ range: Range
51
+ ) => string | null
52
+
53
+ export type InjectionPoint = {
54
+ /** The name of the syntax node that may embed other languages. */
55
+ type: string,
56
+ /**
57
+ * A function that is called with syntax nodes of the specified type. Can
58
+ * return a string that will be tested against grammars' `injectionRegex`
59
+ * properties in order to match this injection point to a given language.
60
+ *
61
+ * If this callback returns `undefined` or `null`, the injection will fail.
62
+ */
63
+ language(node: Node): string | undefined,
64
+ /**
65
+ * A function that is called with syntax nodes of the specified type. Should
66
+ * return a {@link Node} (or an array of {@link Node}s) to identify the exact
67
+ * range or ranges that should be highlighted.
68
+ *
69
+ * Depending on other settings, the ranges described by the return value may
70
+ * be modified further. When the injected language parses this file, only
71
+ * the content within these buffer ranges will be "visible" to the parser.
72
+ *
73
+ * If this callback returns `undefined` or `null`, the injection will fail.
74
+ */
75
+ content(node: Node): Node | Node[] | undefined,
76
+
77
+ /**
78
+ * Whether the children of nodes returned by `content` should be included
79
+ * in the injection range. Defaults to `false`, meaning that for every node
80
+ * returned by the `content` function, the ranges of all that node's children
81
+ * will be "subtracted" from the injection range.
82
+ *
83
+ * When `true`, the full content ranges of all nodes returned from the
84
+ * `content` callback will be part of the injection content range.
85
+ */
86
+ includeChildren?: boolean,
87
+
88
+ /**
89
+ * Whether the injection ranges should include any newline characters that
90
+ * may exist in between injection ranges. Defaults to `false`.
91
+ *
92
+ * Grammars like ERB and EJS need this so that they do not interpret two
93
+ * different embedded code sections on different lines as occurring on the
94
+ * same line.
95
+ */
96
+ newlinesBetween?: boolean,
97
+
98
+ /**
99
+ * A string or function that returns the desired root scope name to apply to
100
+ * each of the injection's buffer ranges. Defaults to the injected grammar's
101
+ * own root language scope — e.g., `source.js` for the JavaScript grammar.
102
+ *
103
+ * Set to `null` if the language scope should be omitted.
104
+ *
105
+ * If a function, will be called with the {@link WASMTreeSitterGrammar}
106
+ * instance, the {@link TextBuffer}, and the given buffer {@link Range}, and
107
+ * should return either a string or `null`.
108
+ */
109
+ languageScope?: string | null | LanguageScopeFunction,
110
+
111
+ /**
112
+ * Whether this injection should prevent shallower layers (including the
113
+ * layer that created this injection) from adding scopes within any of this
114
+ * injection's buffer ranges. Useful for injecting languages into themselves
115
+ * — for instance, injecting Rust into Rust macro definitions. Defaults to
116
+ * `false`.
117
+ */
118
+ coverShallowerScopes?: boolean,
119
+
120
+ /**
121
+ * Whether the injection's buffer ranges should include whitespace that
122
+ * occurs between two ranges that are separated only by whitespace. Defaults
123
+ * to `false`. If `true`, such ranges will be consolidated into a single
124
+ * range along with the whitespace that separates them.
125
+ */
126
+ includeAdjacentWhitespace?: boolean
127
+ }
128
+
129
+ type TreeSitterParams = {
130
+ grammar: string
131
+ highlightsQuery?: string
132
+ foldsQuery?: string
133
+ tagsQuery?: string
134
+ indentsQuery?: string
135
+ languageSegment?: string
136
+ }
137
+
138
+ type WASMTreeSitterGrammarParams = {
139
+ name: string;
140
+ scopeName: string;
141
+ contentRegex?: string | string[]
142
+ firstLineRegex?: string | string[]
143
+ treeSitter: TreeSitterParams,
144
+ comments?: {
145
+ start?: string,
146
+ end?: string
147
+ }
148
+ }
149
+
150
+ /**
151
+ * A grammar responsible for language-specific features like syntax
152
+ * highlighting, indentation, and code folding. Uses Tree-sitter as its parsing
153
+ * system.
154
+ */
155
+ export interface WASMTreeSitterGrammar extends Grammar {
156
+ /** The name of the grammar. */
157
+ readonly name: string;
158
+
159
+ /** Undocumented: Root scope name of the grammar. */
160
+ readonly scopeName: string;
161
+
162
+ constructor(
163
+ registry: GrammarRegistry,
164
+ grammarPath: string,
165
+ params: WASMTreeSitterGrammarParams
166
+ );
167
+
168
+ // Callbacks
169
+ onDidUpdate(callback: () => void): Disposable;
170
+
171
+ /**
172
+ * Calls `callback` when any of this grammar’s queries change.
173
+ *
174
+ * A grammar’s queries typically will not change after initial load. When
175
+ * they do, it may mean:
176
+ *
177
+ * - The user is editing query files in dev mode; Pulsar will automatically
178
+ * reload queries in dev mode after changes.
179
+ * - A community packge is altering a query file via an API like
180
+ * {@link setQueryForTest}.
181
+ */
182
+ onDidChangeQuery(callback: (payload: DidChangeQueryPayload) => void): Disposable;
183
+ onDidChangeQueryFile(callback: (payload: DidChangeQueryPayload) => void): Disposable;
184
+
185
+ /**
186
+ * Calls `callback` when this grammar first loads its query files.
187
+ */
188
+ onDidLoadQueryFiles(callback: () => void): Disposable;
189
+
190
+ /**
191
+ * Undocumented: Adds an injection point by which this language can inject
192
+ * another language during parsing.
193
+ *
194
+ * Do not call this directly; prefer {@link GrammarRegistry#addInjectionPoint}.
195
+ */
196
+ addInjectionPoint(injectionPoint: InjectionPoint): void;
197
+
198
+ /**
199
+ * Undocumented: Removes an injection point that was previously added.
200
+ *
201
+ * Do not call this directly; instead, use
202
+ * {@link GrammarRegistry#addInjectionPoint} to add the injection point, then
203
+ * retain the returned {@link Disposable} so you can use it to remove the
204
+ * injection point you added.
205
+ */
206
+ removeInjectionPoint(injectionPoint: InjectionPoint): void;
207
+
208
+
209
+ /**
210
+ * Retrieve all known comment delimiters for this grammar.
211
+ *
212
+ * Some grammars may have different delimiters for different parts of a file
213
+ * (for example, JSX within JavaScript). In these cases, you might instead
214
+ * want to call {@link TextEditor#getCommentDelimitersForBufferPosition}
215
+ * with a {@link Point} that represents a buffer position.
216
+ */
217
+ getCommentDelimiters(): CommentDelimiterSpec;
218
+
219
+ /**
220
+ * Retrieves the Tree-sitter `Language` instance associated with this
221
+ * grammar.
222
+ */
223
+ getLanguage(): Promise<Language>
224
+
225
+ /**
226
+ * Synchronously retrieves the Tree-sitter `Language` instance associated
227
+ * with this grammar, or `null` if the `Language` has not yet been loaded.
228
+ */
229
+ getLanguageSync(): Language | null
230
+
231
+ /**
232
+ * Retrieve a `Query` instance by name. Asynchronous.
233
+ */
234
+ getQuery(queryType: StandardQueryType | CustomQueryType): Promise<Query>
235
+
236
+ /**
237
+ * Retrieve a `Query` instance by name.
238
+ *
239
+ * Synchronous. Returns `null` if the language itself has not yet loaded.
240
+ */
241
+ getQuerySync(queryType: StandardQueryType | CustomQueryType): Query | null
242
+
243
+ /**
244
+ * Creates an arbitrary Tree-sitter `Query` instance from this grammar’s
245
+ * `Language`.
246
+ *
247
+ * Package authors and end users can use queries for whatever purpose they
248
+ * like.
249
+ */
250
+ createQuery(queryContents: string): Promise<Query>
251
+
252
+ /**
253
+ * Creates an arbitrary Tree-sitter `Query` instance from this grammar’s
254
+ * `Language`.
255
+ *
256
+ * Package authors and end users can use queries for whatever purpose they
257
+ * like.
258
+ *
259
+ * Synchronous; throws an error if the grammar’s `Language` is not yet
260
+ * loaded.
261
+ */
262
+ createQuerySync(queryContents: string): Query
263
+
264
+ /**
265
+ * Sets the contents of standard or custom query type.
266
+ *
267
+ * Used by the specs to override a particular query for testing purposes.
268
+ */
269
+ setQueryForTest(
270
+ queryType: StandardQueryType | CustomQueryType,
271
+ contents: string
272
+ ): Promise<Query>;
273
+
274
+ /**
275
+ * Tokenize all lines in the given text.
276
+ *
277
+ * @param text A string containing one or more lines.
278
+ * @return An array of token arrays for each line tokenized.
279
+ */
280
+ tokenizeLines(text: string): GrammarToken[][];
281
+
282
+ /**
283
+ * Tokenize the line of text.
284
+ *
285
+ * @param line A string of text to tokenize.
286
+ * @param ruleStack An optional array of rules previously returned from this
287
+ * method. This should be null when tokenizing the first line in the file.
288
+ * @param firstLine A optional boolean denoting whether this is the first
289
+ * line in the file which defaults to `false`.
290
+ * @return An object representing the result of the tokenize.
291
+ */
292
+ tokenizeLine(line: string, ruleStack?: null, firstLine?: boolean): TokenizeLineResult;
293
+
294
+ /**
295
+ * Tokenize the line of text.
296
+ *
297
+ * @param line A string of text to tokenize.
298
+ * @param ruleStack An optional array of rules previously returned from this
299
+ * method. This should be null when tokenizing the first line in the file.
300
+ * @param firstLine A optional boolean denoting whether this is the first
301
+ * line in the file which defaults to `false`.
302
+ * @return An object representing the result of the tokenize.
303
+ */
304
+ tokenizeLine(line: string, ruleStack: any[], firstLine?: false): TokenizeLineResult;
305
+ }