-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathatom.d.ts
More file actions
115 lines (88 loc) · 3.76 KB
/
atom.d.ts
File metadata and controls
115 lines (88 loc) · 3.76 KB
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
// TODO add to @types/Atom
export {}
// An {Object} with the following fields:
interface BufferChangeEvent {
// The deleted text
oldText: string
// The {Range} of the deleted text before the change took place.
oldRange: Range
// The inserted text
newText: string
// The {Range} of the inserted text after the change took place.
newRange: Range
}
type HighlightingChangeEvent = (range: Range) => void
declare module "atom" {
interface TextEditor {
// Get the Element for the editor.
getElement(): TextEditorElement
// Controls visibility based on the given {Boolean}.
setVisible(visible: boolean): void
// Experimental: Get a notification when async tokenization is completed.
onDidTokenize(callback: () => any): Disposable
component: {
getNextUpdatePromise(): Promise<unknown>
}
isDestroyed(): boolean
getDefaultCharWidth(): number
}
interface LanguageMode {
// A {Function} that returns a {String} identifying the language.
getLanguageId(): string
// A {Function} that is called whenever the buffer changes.
bufferDidChange(change: BufferChangeEvent): void
// A {Function} that takes a callback {Function} and calls it with a {Range} argument whenever the syntax of a given part of the buffer is updated.
onDidChangeHighlighting(callback: HighlightingChangeEvent): void
// A function that returns an iterator object with the following methods:
buildHighlightIterator(): {
// A {Function} that takes a {Point} and resets the iterator to that position.
seek(point: Point): any
// A {Function} that advances the iterator to the next token
moveToSuccessor(): void
// A {Function} that returns a {Point} representing the iterator's current position in the buffer.
getPosition(): Point
// A {Function} that returns an {Array} of {Number}s representing tokens that end at the current position.
getCloseTags(): Array<number>
// A {Function} that returns an {Array} of {Number}s representing tokens that begin at the current position.
getOpenTags(): Array<number>
}
}
interface TextMateLanguageMode {
fullyTokenized: boolean
// Get the suggested indentation level for an existing line in the buffer.
//
// * bufferRow - A {Number} indicating the buffer row
//
// Returns a {Number}.
suggestedIndentForBufferRow(bufferRow: number, tabLength: number, options: object): number
// Get the suggested indentation level for a given line of text, if it were inserted at the given
// row in the buffer.
//
// * bufferRow - A {Number} indicating the buffer row
//
// Returns a {Number}.
suggestedIndentForLineAtBufferRow(bufferRow: number, line: number, tabLength: number): number
// Get the suggested indentation level for a line in the buffer on which the user is currently
// typing. This may return a different result from {::suggestedIndentForBufferRow} in order
// to avoid unexpected changes in indentation. It may also return undefined if no change should
// be made.
//
// * bufferRow - The row {Number}
//
// Returns a {Number}.
suggestedIndentForEditedBufferRow(bufferRow: number, tabLength: number): number
}
interface TextBuffer {
// Experimental: Get the language mode associated with this buffer.
//
// Returns a language mode {Object} (See {TextBuffer::setLanguageMode} for its interface).
getLanguageMode(): LanguageMode | TextMateLanguageMode
// Experimental: Set the LanguageMode for this buffer.
//
// * `languageMode` - an {Object} with the following methods:
setLanguageMode(languageMode: LanguageMode | TextMateLanguageMode): void
}
interface TextEditorElement {
setUpdatedSynchronously(val: boolean): void
}
}