@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.
- package/.github/workflows/publish.yml +33 -0
- package/LICENSE.md +8 -0
- package/README.md +187 -0
- package/atom-i18n/config.d.ts +9 -0
- package/atom-i18n/index.d.ts +4 -0
- package/autocomplete-plus/config.d.ts +140 -0
- package/autocomplete-plus/index.d.ts +200 -0
- package/dependencies/event-kit/index.d.ts +143 -0
- package/dependencies/first-mate/index.d.ts +1 -0
- package/dependencies/first-mate/src/first-mate.d.ts +1 -0
- package/dependencies/first-mate/src/grammar.d.ts +119 -0
- package/dependencies/pathwatcher/index.d.ts +1 -0
- package/dependencies/pathwatcher/src/directory.d.ts +98 -0
- package/dependencies/pathwatcher/src/file.d.ts +115 -0
- package/dependencies/pathwatcher/src/main.d.ts +2 -0
- package/dependencies/service-hub/index.d.ts +3 -0
- package/dependencies/service-hub/src/consumer.d.ts +8 -0
- package/dependencies/service-hub/src/provider.d.ts +14 -0
- package/dependencies/service-hub/src/service-hub.d.ts +46 -0
- package/dependencies/service-hub/src/util.d.ts +1 -0
- package/dependencies/text-buffer/index.d.ts +1 -0
- package/dependencies/text-buffer/src/display-marker-layer.d.ts +182 -0
- package/dependencies/text-buffer/src/display-marker.d.ts +232 -0
- package/dependencies/text-buffer/src/helpers.d.ts +11 -0
- package/dependencies/text-buffer/src/marker-layer.d.ts +117 -0
- package/dependencies/text-buffer/src/marker.d.ts +207 -0
- package/dependencies/text-buffer/src/point.d.ts +102 -0
- package/dependencies/text-buffer/src/range.d.ts +141 -0
- package/dependencies/text-buffer/src/text-buffer.d.ts +759 -0
- package/index.d.ts +72 -0
- package/linter/config.d.ts +26 -0
- package/linter/index.d.ts +108 -0
- package/package.json +61 -0
- package/src/atom-environment.d.ts +361 -0
- package/src/branding.d.ts +19 -0
- package/src/buffered-node-process.d.ts +10 -0
- package/src/buffered-process.d.ts +88 -0
- package/src/clipboard.d.ts +14 -0
- package/src/color.d.ts +11 -0
- package/src/command-registry.d.ts +118 -0
- package/src/config-schema.d.ts +271 -0
- package/src/config.d.ts +168 -0
- package/src/context-menu-manager.d.ts +65 -0
- package/src/cursor.d.ts +252 -0
- package/src/decoration.d.ts +156 -0
- package/src/deserializer-manager.d.ts +15 -0
- package/src/dock.d.ts +121 -0
- package/src/get-window-load-settings.d.ts +26 -0
- package/src/git-repository.d.ts +174 -0
- package/src/grammar-registry.d.ts +241 -0
- package/src/gutter.d.ts +118 -0
- package/src/history-manager.d.ts +28 -0
- package/src/keymap-extensions.d.ts +190 -0
- package/src/language-mode.d.ts +314 -0
- package/src/layer-decoration.d.ts +31 -0
- package/src/menu-manager.d.ts +24 -0
- package/src/notification-manager.d.ts +37 -0
- package/src/notification.d.ts +79 -0
- package/src/other-types.d.ts +283 -0
- package/src/package-manager.d.ts +103 -0
- package/src/package.d.ts +33 -0
- package/src/pane.d.ts +604 -0
- package/src/panel.d.ts +38 -0
- package/src/path-watcher.d.ts +35 -0
- package/src/project.d.ts +110 -0
- package/src/scope-descriptor.d.ts +8 -0
- package/src/selection.d.ts +341 -0
- package/src/style-manager.d.ts +68 -0
- package/src/task.d.ts +38 -0
- package/src/text-editor-component.d.ts +15 -0
- package/src/text-editor-element.d.ts +48 -0
- package/src/text-editor-registry.d.ts +48 -0
- package/src/text-editor.d.ts +1416 -0
- package/src/theme-manager.d.ts +29 -0
- package/src/tooltip-manager.d.ts +42 -0
- package/src/tooltip.d.ts +63 -0
- package/src/ui.d.ts +101 -0
- package/src/view-registry.d.ts +34 -0
- package/src/wasm-tree-sitter-grammar.d.ts +305 -0
- package/src/wasm-tree-sitter-language-mode.d.ts +294 -0
- package/src/workspace-center.d.ts +117 -0
- package/src/workspace.d.ts +485 -0
- package/status-bar/config.d.ts +23 -0
- package/status-bar/index.d.ts +51 -0
- package/tool-bar/config.d.ts +20 -0
- package/tool-bar/index.d.ts +235 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { Disposable } from "../index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Allows commands to be associated with keystrokes in a context-sensitive way.
|
|
5
|
+
*
|
|
6
|
+
* In Atom, you can access a global instance of this object via `atom.keymaps`.
|
|
7
|
+
*/
|
|
8
|
+
export interface KeymapManager {
|
|
9
|
+
/**
|
|
10
|
+
* Clear all registered key bindings and enqueued keystrokes.
|
|
11
|
+
*
|
|
12
|
+
* For use in tests.
|
|
13
|
+
*/
|
|
14
|
+
clear(): void;
|
|
15
|
+
|
|
16
|
+
/** Unwatch all watched paths. */
|
|
17
|
+
destroy(): void;
|
|
18
|
+
|
|
19
|
+
// Event Subscription
|
|
20
|
+
/**
|
|
21
|
+
* Invoke the given callback when one or more keystrokes completely match a
|
|
22
|
+
* key binding.
|
|
23
|
+
*/
|
|
24
|
+
onDidMatchBinding(callback: (event: FullKeybindingMatchEvent) => void): Disposable;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Invoke the given callback when one or more keystrokes partially match a
|
|
28
|
+
* binding.
|
|
29
|
+
*/
|
|
30
|
+
onDidPartiallyMatchBindings(callback: (event: PartialKeybindingMatchEvent) => void): Disposable;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Invoke the given callback when one or more keystrokes fail to match any
|
|
34
|
+
* bindings.
|
|
35
|
+
*/
|
|
36
|
+
onDidFailToMatchBinding(callback: (event: FailedKeybindingMatchEvent) => void): Disposable;
|
|
37
|
+
|
|
38
|
+
/** Invoke the given callback when a keymap file is reloaded. */
|
|
39
|
+
onDidReloadKeymap(callback: (event: KeymapLoadedEvent) => void): Disposable;
|
|
40
|
+
|
|
41
|
+
/** Invoke the given callback when a keymap file is unloaded. */
|
|
42
|
+
onDidUnloadKeymap(callback: (event: KeymapLoadedEvent) => void): Disposable;
|
|
43
|
+
|
|
44
|
+
/** Invoke the given callback when a keymap file not able to be loaded. */
|
|
45
|
+
onDidFailToReadFile(callback: (error: FailedKeymapFileReadEvent) => void): Disposable;
|
|
46
|
+
|
|
47
|
+
// Adding and Removing Bindings
|
|
48
|
+
/** Construct KeyBindings from an object grouping them by CSS selector. */
|
|
49
|
+
build(source: string, bindings: { [key: string]: { [key: string]: string } }, priority?: number): KeyBinding[];
|
|
50
|
+
|
|
51
|
+
/** Add sets of key bindings grouped by CSS selector. */
|
|
52
|
+
add(source: string, bindings: { [key: string]: { [key: string]: string } }, priority?: number): Disposable;
|
|
53
|
+
|
|
54
|
+
// Accessing Bindings
|
|
55
|
+
/** Get all current key bindings. */
|
|
56
|
+
getKeyBindings(): KeyBinding[];
|
|
57
|
+
|
|
58
|
+
/** Get the key bindings for a given command and optional target. */
|
|
59
|
+
findKeyBindings(params?: {
|
|
60
|
+
keystrokes?: string | undefined; // e.g. 'ctrl-x ctrl-s'
|
|
61
|
+
command?: string | undefined; // e.g. 'editor:backspace'
|
|
62
|
+
target?: Element | undefined;
|
|
63
|
+
}): KeyBinding[];
|
|
64
|
+
|
|
65
|
+
// Managing Keymap Files
|
|
66
|
+
/** Load the key bindings from the given path. */
|
|
67
|
+
loadKeymap(bindingsPath: string, options?: { watch?: boolean | undefined; priority?: number | undefined }): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Cause the keymap to reload the key bindings file at the given path
|
|
71
|
+
* whenever it changes.
|
|
72
|
+
*/
|
|
73
|
+
watchKeymap(filePath: string, options?: { priority: number }): void;
|
|
74
|
+
|
|
75
|
+
// Managing Keyboard Events
|
|
76
|
+
/**
|
|
77
|
+
* Dispatch a custom event associated with the matching key binding for the
|
|
78
|
+
* given `KeyboardEvent` if one can be found.
|
|
79
|
+
*/
|
|
80
|
+
handleKeyboardEvent(event: KeyboardEvent): void;
|
|
81
|
+
|
|
82
|
+
/** Translates a keydown event to a keystroke string. */
|
|
83
|
+
keystrokeForKeyboardEvent(event: KeyboardEvent): string;
|
|
84
|
+
|
|
85
|
+
/** Customize translation of raw keyboard events to keystroke strings. */
|
|
86
|
+
addKeystrokeResolver(resolver: (event: AddedKeystrokeResolverEvent) => string): Disposable;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get the number of milliseconds allowed before pending states caused by
|
|
90
|
+
* partial matches of multi-keystroke bindings are terminated.
|
|
91
|
+
*/
|
|
92
|
+
getPartialMatchTimeout(): number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface FullKeybindingMatchEvent {
|
|
96
|
+
/** The string of keystrokes that matched the binding. */
|
|
97
|
+
keystrokes: string;
|
|
98
|
+
|
|
99
|
+
/** The KeyBinding that the keystrokes matched. */
|
|
100
|
+
binding: KeyBinding;
|
|
101
|
+
|
|
102
|
+
/** The DOM element that was the target of the most recent keyboard event. */
|
|
103
|
+
keyboardEventTarget: Element;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface KeyBinding {
|
|
107
|
+
// Properties
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
source: string;
|
|
110
|
+
command: string;
|
|
111
|
+
keystrokes: string;
|
|
112
|
+
keystrokeArray: string[];
|
|
113
|
+
keystrokeCount: number;
|
|
114
|
+
selector: string;
|
|
115
|
+
specificity: number;
|
|
116
|
+
|
|
117
|
+
// Comparison
|
|
118
|
+
/** Determines whether the given keystroke matches any contained within this binding. */
|
|
119
|
+
matches(keystroke: string): boolean;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Compare another KeyBinding to this instance.
|
|
123
|
+
*
|
|
124
|
+
* Returns `<= -1` if the argument is considered lesser or of lower priority.
|
|
125
|
+
*
|
|
126
|
+
* Returns `0` if this binding is equivalent to the argument.
|
|
127
|
+
*
|
|
128
|
+
* Returns `>= 1` if the argument is considered greater or of higher
|
|
129
|
+
* priority.
|
|
130
|
+
*/
|
|
131
|
+
compare(other: KeyBinding): number;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface PartialKeybindingMatchEvent {
|
|
135
|
+
/** The string of keystrokes that matched the binding. */
|
|
136
|
+
keystrokes: string;
|
|
137
|
+
|
|
138
|
+
/** The KeyBindings that the keystrokes partially matched. */
|
|
139
|
+
partiallyMatchedBindings: KeyBinding[];
|
|
140
|
+
|
|
141
|
+
/** DOM element that was the target of the most recent keyboard event. */
|
|
142
|
+
keyboardEventTarget: Element;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface AddedKeystrokeResolverEvent {
|
|
146
|
+
/**
|
|
147
|
+
* The currently resolved keystroke string.
|
|
148
|
+
*
|
|
149
|
+
* If your function returns a falsy value, this is how Pulsar will resolve
|
|
150
|
+
* your keystroke.
|
|
151
|
+
*/
|
|
152
|
+
keystroke: string;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API
|
|
156
|
+
* documentation for more details.
|
|
157
|
+
*/
|
|
158
|
+
event: KeyboardEvent;
|
|
159
|
+
|
|
160
|
+
/** The OS-specific name of the current keyboard layout. */
|
|
161
|
+
layoutName: string;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
|
|
165
|
+
* typed character for that key in each modifier state, based on the current
|
|
166
|
+
* operating system layout.
|
|
167
|
+
*/
|
|
168
|
+
keymap: object;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface FailedKeybindingMatchEvent {
|
|
172
|
+
/** The string of keystrokes that failed to match the binding. */
|
|
173
|
+
keystrokes: string;
|
|
174
|
+
|
|
175
|
+
/** The DOM element that was the target of the most recent keyboard event. */
|
|
176
|
+
keyboardEventTarget: Element;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface FailedKeymapFileReadEvent {
|
|
180
|
+
/** The error message. */
|
|
181
|
+
message: string;
|
|
182
|
+
|
|
183
|
+
/** The error stack trace. */
|
|
184
|
+
stack: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface KeymapLoadedEvent {
|
|
188
|
+
/** The path of the keymap file. */
|
|
189
|
+
path: string;
|
|
190
|
+
}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Disposable,
|
|
3
|
+
Grammar,
|
|
4
|
+
Point,
|
|
5
|
+
PointCompatible,
|
|
6
|
+
Range,
|
|
7
|
+
ScopeDescriptor
|
|
8
|
+
} from '../index';
|
|
9
|
+
|
|
10
|
+
type CommentStrings = {
|
|
11
|
+
commentStartString?: string;
|
|
12
|
+
commentEndString?: string;
|
|
13
|
+
commentDelimiters?: {
|
|
14
|
+
line?: string;
|
|
15
|
+
block?: [string, string]
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** The payload passed to the `bufferDidChange` method. */
|
|
20
|
+
type BufferDidChangeEvent = {
|
|
21
|
+
oldText: string;
|
|
22
|
+
newText: string;
|
|
23
|
+
oldRange: Range;
|
|
24
|
+
newRange: Range;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An interface that must be implemented by anything that wants to tell a
|
|
29
|
+
* {@link TextBuffer} how to apply syntax highlighting to a range of the
|
|
30
|
+
* buffer.
|
|
31
|
+
*
|
|
32
|
+
* The methods described are the ones that {@link TextBuffer} requires to be
|
|
33
|
+
* present in order to fulfill the `HighlightIterator` contract.
|
|
34
|
+
*/
|
|
35
|
+
export interface HighlightIterator {
|
|
36
|
+
/**
|
|
37
|
+
* Starts a `HighlightIterator` job. Accepts a {@link Point} and prepares to
|
|
38
|
+
* begin describing the syntax highlighting context of the buffer starting at
|
|
39
|
+
* that position and ending at the end of `endRow`.
|
|
40
|
+
*
|
|
41
|
+
* Should return an array of scope IDs for scopes that are already open at
|
|
42
|
+
* the given `position`.
|
|
43
|
+
*/
|
|
44
|
+
seek(position: PointCompatible, endRow: number): number[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Advances the iterator to the next {@link Point} at which a scope is opened
|
|
48
|
+
* or closed, if any.
|
|
49
|
+
*/
|
|
50
|
+
moveToSuccessor(): boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns the current position of the highlight iterator.
|
|
54
|
+
*
|
|
55
|
+
* If there are no further scope boundaries to apply, the iterator may return
|
|
56
|
+
* {@link Point.INFINITY} as a way of telling the buffer that the
|
|
57
|
+
* highlighting task is done.
|
|
58
|
+
*/
|
|
59
|
+
getPosition(): Point;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Returns all scope IDs that begin at the iterator's current position.
|
|
63
|
+
*/
|
|
64
|
+
getOpenScopeIds(): number[];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns all scope IDs that end at the iterator's current position.
|
|
68
|
+
*/
|
|
69
|
+
getCloseScopeIds(): number[];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// NOTE: This interface contains only the methods that are shared between
|
|
73
|
+
// the two kinds of language mode.
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* An adapter that helps a text buffer fulfill grammar-specific editor tasks
|
|
77
|
+
* like syntax highlighting, indentation hinting, and code folding.
|
|
78
|
+
*
|
|
79
|
+
* A language mode helps a {@link TextBuffer} communicate with a
|
|
80
|
+
* {@link Grammar}.
|
|
81
|
+
*
|
|
82
|
+
* There are two different implementations of the `LanguageMode` interface
|
|
83
|
+
* corresponding to the two types of {@link Grammar}: `TextMateLanguageMode`
|
|
84
|
+
* and `WASMTreeSitterLanguageMode`.
|
|
85
|
+
*/
|
|
86
|
+
export interface LanguageMode {
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Called automatically when a buffer is destroyed or when the user changes a
|
|
90
|
+
* buffer's grammar. You probably won't have to call this method yourself.
|
|
91
|
+
*/
|
|
92
|
+
destroy(): void;
|
|
93
|
+
|
|
94
|
+
/** Returns the {@link Grammar} associated with this language mode. */
|
|
95
|
+
getGrammar(): Grammar;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns the root scope name for the {@link Grammar} associated with this
|
|
99
|
+
* language mode.
|
|
100
|
+
*/
|
|
101
|
+
getLanguageId(): string;
|
|
102
|
+
|
|
103
|
+
// INDENTATION
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Given a buffer row and the current configured tab length, returns an
|
|
107
|
+
* indentation "level" for the given row.
|
|
108
|
+
*
|
|
109
|
+
* @returns An indentation level that, when multiplied by `tabLength`, tells
|
|
110
|
+
* how far the given row should be indented. It may also return `null` if
|
|
111
|
+
* the buffer is not in a state where a guess can be made (e.g., if no
|
|
112
|
+
* grammar as been assigned, or if initial parsing is still underway). It
|
|
113
|
+
* may also return a promise if it cannot give the correct answer
|
|
114
|
+
* synchronously — in which case it will eventually resolve with a number
|
|
115
|
+
* or with `undefined` (which means the initial request was made moot
|
|
116
|
+
* because of subsequent buffer changes).
|
|
117
|
+
*/
|
|
118
|
+
suggestedIndentForBufferRow(
|
|
119
|
+
/**
|
|
120
|
+
* The (zero-indexed) buffer row whose indentation level should be checked.
|
|
121
|
+
*/
|
|
122
|
+
bufferRow: number,
|
|
123
|
+
/** The current configured tab length in characters. */
|
|
124
|
+
tabLength: number,
|
|
125
|
+
/**
|
|
126
|
+
* An object of options. The specific options will vary according to the
|
|
127
|
+
* language mode.
|
|
128
|
+
*/
|
|
129
|
+
options?: object
|
|
130
|
+
): number | null | Promise<number | undefined>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Given a buffer row, some text that may appear on the row, and the current
|
|
134
|
+
* configured tab length, returns an ideal indentation "level" for the row.
|
|
135
|
+
* This is used to determine the initial indentation level that should be
|
|
136
|
+
* used when some clipboard text is pasted into the buffer.
|
|
137
|
+
*
|
|
138
|
+
* The return value may just be a "best guess" that is no different from the
|
|
139
|
+
* value that would be returned by {@link suggestedIndentForBufferRow}.
|
|
140
|
+
*
|
|
141
|
+
* @returns An indentation level that, when multiplied by `tabLength`, tells
|
|
142
|
+
* how far the given row should be indented.
|
|
143
|
+
*/
|
|
144
|
+
suggestedIndentForLineAtBufferRow(
|
|
145
|
+
bufferRow: number,
|
|
146
|
+
line: string,
|
|
147
|
+
tabLength: number
|
|
148
|
+
): number;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Given a buffer row on which the user is currently typing and the current
|
|
152
|
+
* configured tab length, returns an ideal indentation "level" for the row.
|
|
153
|
+
*
|
|
154
|
+
* This method differs from {@link suggestedIndentForBufferRow} in that it is
|
|
155
|
+
* typically called after the user has started to type on a row — whereas
|
|
156
|
+
* `suggestedIndentForBufferRow` is called when a row is empty following a
|
|
157
|
+
* carriage return. We are less aggressive in changing the indentation level
|
|
158
|
+
* of a line once the user has started to type on it, since an incorrect
|
|
159
|
+
* guess will annoy the user more.
|
|
160
|
+
*
|
|
161
|
+
* @returns An indentation level that, when multiplied by `tabLength`, tells
|
|
162
|
+
* how far the given row should be indented.
|
|
163
|
+
*/
|
|
164
|
+
suggestedIndentForEditedBufferRow(
|
|
165
|
+
bufferRow: number,
|
|
166
|
+
tabLength: number
|
|
167
|
+
): number;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A method that will be called every time the buffer changes, even for
|
|
171
|
+
* changes inside of a larger transaction.
|
|
172
|
+
*
|
|
173
|
+
* {@link TextBuffer} calls this method so that the language mode can make
|
|
174
|
+
* internal adjustments every time the contents of the buffer change.
|
|
175
|
+
*/
|
|
176
|
+
bufferDidChange(
|
|
177
|
+
/**
|
|
178
|
+
* An object that contains details about the buffer change: the affected
|
|
179
|
+
* {@link Range} in both "old" and "new" coordinate systems, plus the
|
|
180
|
+
* affected text.
|
|
181
|
+
*/
|
|
182
|
+
event: BufferDidChangeEvent
|
|
183
|
+
): void;
|
|
184
|
+
|
|
185
|
+
// COMMENTS
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Given a {@link Point} (or its equivalent) in the current buffer, returns
|
|
189
|
+
* an object describing the appropriate comment delimiters for that position.
|
|
190
|
+
*
|
|
191
|
+
* This information is derived from the {@link Grammar} and the configuration
|
|
192
|
+
* system. Often, the answer is the same no matter where you are in the
|
|
193
|
+
* buffer, but sometimes it depends on position. (For instance, in an HTML
|
|
194
|
+
* document, `<!--`/`-->` should be used outside of a `script` tag, and `//`
|
|
195
|
+
* should be used inside of a `script` tag.
|
|
196
|
+
*
|
|
197
|
+
* Injections notwithstanding, if your language uses the same comment
|
|
198
|
+
* delimiters regardless of context, you may define comment delimiters in the
|
|
199
|
+
* grammar's definition file. But if comment syntax varies based on context
|
|
200
|
+
* (e.g., JSX blocks inside of a JavaScript file), you must define comment
|
|
201
|
+
* delimiters via the configuration system and specify the scope names within
|
|
202
|
+
* the grammar that signify new contexts. For examples, consult the
|
|
203
|
+
* `settings` directory in the `language-javascript` package.
|
|
204
|
+
*/
|
|
205
|
+
commentStringsForPosition(position: PointCompatible): CommentStrings;
|
|
206
|
+
|
|
207
|
+
// SYNTAX HIGHLIGHTING
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Requests a highlight iterator.
|
|
211
|
+
*
|
|
212
|
+
* {@link TextBuffer} calls this method when it starts a highlighting (or
|
|
213
|
+
* re-highlighting) task.
|
|
214
|
+
*/
|
|
215
|
+
buildHighlightIterator(): HighlightIterator;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Translate a scope ID (a number) to the equivalent scope name (a string).
|
|
219
|
+
*
|
|
220
|
+
* For efficiency, scope names within a {@link Grammar} are given unique
|
|
221
|
+
* numeric IDs. This results in more efficient highlighting tasks.
|
|
222
|
+
*/
|
|
223
|
+
classNameForScopeId(id: number): string;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Subscribes to future notifications about when ranges of the buffer need to
|
|
227
|
+
* be re-highlighted.
|
|
228
|
+
*
|
|
229
|
+
* A language mode finds out about buffer changes via
|
|
230
|
+
* {@link bufferDidChange}. Once those changes happen, the language mode does
|
|
231
|
+
* whatever is necessary to determine what range of the buffer (if any) needs
|
|
232
|
+
* to be re-highlighted, then notifies the {@link TextBuffer} about it by
|
|
233
|
+
* emitting the event that is subscribed to in `onDidChangeHighlighting`.
|
|
234
|
+
* This is how a language mode triggers a re-highlighting task.
|
|
235
|
+
*
|
|
236
|
+
* The callbacks that want to know about highlighting changes can be invoked
|
|
237
|
+
* at any point, even when the buffer hasn't changed. For instance, if a
|
|
238
|
+
* new grammar is activated or an old one is deactivated, some ranges of the
|
|
239
|
+
* buffer might need to be re-highlighted accordingly.
|
|
240
|
+
*/
|
|
241
|
+
onDidChangeHighlighting(callback: (range: Range) => unknown): Disposable;
|
|
242
|
+
|
|
243
|
+
// FOLDS
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Whether the buffer can be folded at the given (zero-indexed) row number.
|
|
247
|
+
*/
|
|
248
|
+
isFoldableAtRow(row: number): boolean;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* If the given {@link Point} belongs to a foldable range, returns that
|
|
252
|
+
* {@link Range}; otherwise returns `null`.
|
|
253
|
+
*/
|
|
254
|
+
getFoldableRangeContainingPoint(point: Point, tabLength: number): Range | null;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Returns all foldable ranges in a buffer at a certain level of nesting.
|
|
258
|
+
*
|
|
259
|
+
* The "indent level" described in the method name is a misnomer, and recalls
|
|
260
|
+
* the times when folding was simpler and entirely based on how deeply a
|
|
261
|
+
* given range was indented. An `indentLevel` of `0` means "all foldable
|
|
262
|
+
* ranges that are not surrounded by another foldable range"; `1` means "all
|
|
263
|
+
* foldable ranges that are surrounded by exactly one other foldable range";
|
|
264
|
+
* and so on.
|
|
265
|
+
*/
|
|
266
|
+
getFoldableRangesAtIndentLevel(indentLevel: number, tabLength: number): Range[];
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Returns all foldable ranges in a buffer.
|
|
270
|
+
*/
|
|
271
|
+
getFoldableRanges(tabLength: number): Range[];
|
|
272
|
+
|
|
273
|
+
// SCOPES
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Returns the {@link ScopeDescriptor} at a given position in the buffer.
|
|
277
|
+
*
|
|
278
|
+
* Scope descriptors consist of a list of scope names (strings) in order from
|
|
279
|
+
* broadest to most specific. They are important for looking up context-
|
|
280
|
+
* specific values such as snippets and configuration settings.
|
|
281
|
+
*
|
|
282
|
+
* If you are authoring a language mode, you are encouraged to implement this
|
|
283
|
+
* method by reusing your existing logic for syntax highlighting. This will
|
|
284
|
+
* help guarantee that your scope descriptors are as accurate as they can
|
|
285
|
+
* possibly be.
|
|
286
|
+
*/
|
|
287
|
+
scopeDescriptorForPosition(position: PointCompatible): ScopeDescriptor;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Given a scope selector and a {@link Point}, returns the {@link Range} of
|
|
291
|
+
* the buffer surrounding that buffer position that matches the scope
|
|
292
|
+
* selector.
|
|
293
|
+
*
|
|
294
|
+
* If the given position _does not_ match the scope selector, returns `null`.
|
|
295
|
+
*/
|
|
296
|
+
bufferRangeForScopeAtPosition(selector: string, position: PointCompatible): Range | null;
|
|
297
|
+
|
|
298
|
+
// OTHER
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Given a row number, determines whether the row is "commented" or not.
|
|
302
|
+
*
|
|
303
|
+
* This is used during the "Editor: Toggle Line Comments" command. To know
|
|
304
|
+
* whether to flip a line from uncommented to commented, or vice versa,
|
|
305
|
+
* Pulsar must know whether the line is currently considered to be commented
|
|
306
|
+
* or not.
|
|
307
|
+
*
|
|
308
|
+
* If none of the line is significant to code execution, this method should
|
|
309
|
+
* return `true`. If a line has no comment delimiter on it, or has a
|
|
310
|
+
* delimiter part of the way through the line (meaning the line is only
|
|
311
|
+
* half-commented), this method should return `false`.
|
|
312
|
+
*/
|
|
313
|
+
isRowCommented(row: number): boolean;
|
|
314
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DecorationLayerOptions,
|
|
3
|
+
DisplayMarker,
|
|
4
|
+
Marker,
|
|
5
|
+
TextEditor
|
|
6
|
+
} from "../index";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents a decoration that applies to every marker on a given layer.
|
|
10
|
+
*
|
|
11
|
+
* Created via {@link TextEditor#decorateMarkerLayer}.
|
|
12
|
+
*/
|
|
13
|
+
export interface LayerDecoration {
|
|
14
|
+
/** Destroys the decoration. */
|
|
15
|
+
destroy(): void;
|
|
16
|
+
|
|
17
|
+
/** Determine whether this decoration is destroyed. */
|
|
18
|
+
isDestroyed(): boolean;
|
|
19
|
+
|
|
20
|
+
/** Get this decoration's properties. */
|
|
21
|
+
getProperties(): DecorationLayerOptions;
|
|
22
|
+
|
|
23
|
+
/** Set this decoration's properties. */
|
|
24
|
+
setProperties(newProperties: DecorationLayerOptions): void;
|
|
25
|
+
|
|
26
|
+
/** Override the decoration properties for a specific marker. */
|
|
27
|
+
setPropertiesForMarker(
|
|
28
|
+
marker: DisplayMarker | Marker,
|
|
29
|
+
properties: DecorationLayerOptions
|
|
30
|
+
): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Disposable } from "../index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Provides a registry for menu items that you'd like to appear in the
|
|
5
|
+
* application menu.
|
|
6
|
+
*/
|
|
7
|
+
export interface MenuManager {
|
|
8
|
+
/** Adds the given items to the application menu. */
|
|
9
|
+
add(items: readonly MenuOptions[]): Disposable;
|
|
10
|
+
|
|
11
|
+
/** Refreshes the currently visible menu. */
|
|
12
|
+
update(): void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface MenuOptions {
|
|
16
|
+
/** The menu itme's label. */
|
|
17
|
+
label: string;
|
|
18
|
+
|
|
19
|
+
/** An array of sub menus. */
|
|
20
|
+
submenu?: readonly MenuOptions[] | undefined;
|
|
21
|
+
|
|
22
|
+
/** The command to trigger when the item is clicked. */
|
|
23
|
+
command?: string | undefined;
|
|
24
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Disposable, ErrorNotificationOptions, Notification, NotificationOptions } from "../index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A notification manager used to create Notifications to be shown to the user.
|
|
5
|
+
*/
|
|
6
|
+
export interface NotificationManager {
|
|
7
|
+
// Events
|
|
8
|
+
/** Invoke the given callback after a notification has been added. */
|
|
9
|
+
onDidAddNotification(callback: (notification: Notification) => void): Disposable;
|
|
10
|
+
|
|
11
|
+
/** Invoke the given callback after the notifications have been cleared. */
|
|
12
|
+
onDidClearNotifications(callback: () => void): Disposable;
|
|
13
|
+
|
|
14
|
+
// Adding Notifications
|
|
15
|
+
/** Add a success notification. */
|
|
16
|
+
addSuccess(message: string, options?: NotificationOptions): Notification;
|
|
17
|
+
|
|
18
|
+
/** Add an informational notification. */
|
|
19
|
+
addInfo(message: string, options?: NotificationOptions): Notification;
|
|
20
|
+
|
|
21
|
+
/** Add a warning notification. */
|
|
22
|
+
addWarning(message: string, options?: NotificationOptions): Notification;
|
|
23
|
+
|
|
24
|
+
/** Add an error notification. */
|
|
25
|
+
addError(message: string, options?: ErrorNotificationOptions): Notification;
|
|
26
|
+
|
|
27
|
+
/** Add a fatal error notification. */
|
|
28
|
+
addFatalError(message: string, options?: ErrorNotificationOptions): Notification;
|
|
29
|
+
|
|
30
|
+
// Getting Notifications
|
|
31
|
+
/** Get all the notifications. */
|
|
32
|
+
getNotifications(): readonly Notification[];
|
|
33
|
+
|
|
34
|
+
// Managing Notifications
|
|
35
|
+
/** Clear all the notifications. */
|
|
36
|
+
clear(): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Disposable } from "../index";
|
|
2
|
+
|
|
3
|
+
/** A notification to the user containing a message and type. */
|
|
4
|
+
export class Notification {
|
|
5
|
+
constructor(type: "warning" | "info" | "success", message: string, options?: NotificationOptions);
|
|
6
|
+
constructor(type: "fatal" | "error", message: string, options?: ErrorNotificationOptions);
|
|
7
|
+
|
|
8
|
+
// Event Subscription
|
|
9
|
+
/** Invoke the given callback when the notification is dismissed. */
|
|
10
|
+
onDidDismiss(callback: (notification: Notification) => void): Disposable;
|
|
11
|
+
|
|
12
|
+
/** Invoke the given callback when the notification is displayed. */
|
|
13
|
+
onDidDisplay(callback: (notification: Notification) => void): Disposable;
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
/** Returns the Notification's type. */
|
|
17
|
+
getType(): string;
|
|
18
|
+
|
|
19
|
+
/** Returns the Notification's message. */
|
|
20
|
+
getMessage(): string;
|
|
21
|
+
|
|
22
|
+
/** Returns the {@link Date} of the Notification's creation. */
|
|
23
|
+
getTimestamp(): Date;
|
|
24
|
+
|
|
25
|
+
/** Returns the Notification's detail, if present. */
|
|
26
|
+
getDetail(): string | undefined;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns whether this notification is equal to another. Two notifications
|
|
30
|
+
* are considered to be equal if their message, type, and detail are
|
|
31
|
+
* equivalent.
|
|
32
|
+
*/
|
|
33
|
+
isEqual(other: Notification): boolean
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Dismisses the notification, removing it from the UI. Calling this
|
|
37
|
+
* programmatically will call all callbacks added via onDidDismiss.
|
|
38
|
+
*/
|
|
39
|
+
dismiss(): void;
|
|
40
|
+
|
|
41
|
+
/** Whether the notification has been dismissed. */
|
|
42
|
+
isDismissed(): boolean;
|
|
43
|
+
|
|
44
|
+
/** Whether the notification is able to be dismissed. */
|
|
45
|
+
isDismissable(): boolean;
|
|
46
|
+
|
|
47
|
+
/** Whether the notification has been displayed. */
|
|
48
|
+
wasDisplayed(): boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Undocumented: sets whether this notification should be considered
|
|
52
|
+
* displayed.
|
|
53
|
+
*/
|
|
54
|
+
setDisplayed(displayed: boolean): void;
|
|
55
|
+
|
|
56
|
+
/** Returns the name of the icon used in this notification. */
|
|
57
|
+
getIcon(): string;
|
|
58
|
+
|
|
59
|
+
/** Returns the options used when the notification was created. */
|
|
60
|
+
getOptions(): NotificationOptions;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface NotificationOptions {
|
|
64
|
+
buttons?:
|
|
65
|
+
| Array<{
|
|
66
|
+
className?: string | undefined;
|
|
67
|
+
onDidClick?(event: MouseEvent): void;
|
|
68
|
+
text?: string | undefined;
|
|
69
|
+
}>
|
|
70
|
+
| undefined;
|
|
71
|
+
description?: string | undefined;
|
|
72
|
+
detail?: string | undefined;
|
|
73
|
+
dismissable?: boolean | undefined;
|
|
74
|
+
icon?: string | undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface ErrorNotificationOptions extends NotificationOptions {
|
|
78
|
+
stack?: string | undefined;
|
|
79
|
+
}
|