canopus 0.1.0
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +148 -0
- data/docs/adr/001-runtime-gem-components.md +24 -0
- data/docs/adr/002-bounded-diff-engine.md +22 -0
- data/docs/adr/003-background-language-analysis.md +22 -0
- data/docs/adr/004-persistent-display-map.md +23 -0
- data/docs/adr/005-windows-runtime.md +27 -0
- data/docs/adr/README.md +36 -0
- data/docs/distribution.md +27 -0
- data/docs/lsp.md +38 -0
- data/docs/performance.md +40 -0
- data/docs/snippets.md +32 -0
- data/docs/vim.md +24 -0
- data/docs/workspace_edits.md +32 -0
- data/examples/native_smoke.rb +25 -0
- data/examples/plugins/word_count.rb +11 -0
- data/exe/canopus +19 -0
- data/lib/canopus/block_map.rb +19 -0
- data/lib/canopus/buffer.rb +293 -0
- data/lib/canopus/cli.rb +171 -0
- data/lib/canopus/controller.rb +507 -0
- data/lib/canopus/data_compat.rb +25 -0
- data/lib/canopus/display_map/line_builder.rb +54 -0
- data/lib/canopus/display_map/line_set.rb +8 -0
- data/lib/canopus/display_map/pending_line_set.rb +9 -0
- data/lib/canopus/display_map/summary.rb +23 -0
- data/lib/canopus/display_map/worker.rb +89 -0
- data/lib/canopus/display_map.rb +350 -0
- data/lib/canopus/display_point.rb +5 -0
- data/lib/canopus/editor/snippet_expandable.rb +281 -0
- data/lib/canopus/editor.rb +445 -0
- data/lib/canopus/error.rb +5 -0
- data/lib/canopus/fold_map.rb +87 -0
- data/lib/canopus/git/blame.rb +50 -0
- data/lib/canopus/git/commit.rb +7 -0
- data/lib/canopus/git/corrupt_object.rb +7 -0
- data/lib/canopus/git/diff.rb +131 -0
- data/lib/canopus/git/index.rb +94 -0
- data/lib/canopus/git/object_database.rb +45 -0
- data/lib/canopus/git/pack.rb +186 -0
- data/lib/canopus/git/repository.rb +313 -0
- data/lib/canopus/git/status.rb +74 -0
- data/lib/canopus/git/tree_entry.rb +7 -0
- data/lib/canopus/git.rb +15 -0
- data/lib/canopus/icon_theme.rb +43 -0
- data/lib/canopus/language/background_analysis/job.rb +12 -0
- data/lib/canopus/language/background_analysis/scheduler.rb +70 -0
- data/lib/canopus/language/background_analysis.rb +280 -0
- data/lib/canopus/language/definition.rb +7 -0
- data/lib/canopus/language/document.rb +143 -0
- data/lib/canopus/language/symbol.rb +7 -0
- data/lib/canopus/language/syntax_worker.rb +91 -0
- data/lib/canopus/language.rb +42 -0
- data/lib/canopus/lazy_rope.rb +218 -0
- data/lib/canopus/lsp/client.rb +299 -0
- data/lib/canopus/lsp/error.rb +7 -0
- data/lib/canopus/lsp/future/subscription.rb +9 -0
- data/lib/canopus/lsp/future.rb +87 -0
- data/lib/canopus/lsp/protocol.rb +83 -0
- data/lib/canopus/lsp/server_error.rb +13 -0
- data/lib/canopus/lsp/timeout.rb +7 -0
- data/lib/canopus/lsp/transport.rb +123 -0
- data/lib/canopus/lsp.rb +19 -0
- data/lib/canopus/markdown.rb +69 -0
- data/lib/canopus/match_data_compat.rb +17 -0
- data/lib/canopus/multi_buffer.rb +266 -0
- data/lib/canopus/pane.rb +61 -0
- data/lib/canopus/patch/composite.rb +12 -0
- data/lib/canopus/patch/reload.rb +18 -0
- data/lib/canopus/patch.rb +27 -0
- data/lib/canopus/performance_recorder.rb +207 -0
- data/lib/canopus/plugins/api.rb +50 -0
- data/lib/canopus/plugins/isolated_runtime.rb +167 -0
- data/lib/canopus/plugins/local_runtime.rb +25 -0
- data/lib/canopus/plugins/permission_denied.rb +7 -0
- data/lib/canopus/plugins/registry.rb +30 -0
- data/lib/canopus/plugins.rb +11 -0
- data/lib/canopus/project/ignore_matcher.rb +104 -0
- data/lib/canopus/project/search.rb +164 -0
- data/lib/canopus/project/search_worker/cancelled.rb +3 -0
- data/lib/canopus/project/search_worker/runner.rb +9 -0
- data/lib/canopus/project/search_worker.rb +108 -0
- data/lib/canopus/project/tree.rb +48 -0
- data/lib/canopus/project/watcher.rb +59 -0
- data/lib/canopus/project.rb +127 -0
- data/lib/canopus/regexp_compat.rb +30 -0
- data/lib/canopus/save_conflict.rb +5 -0
- data/lib/canopus/selection.rb +11 -0
- data/lib/canopus/settings.rb +118 -0
- data/lib/canopus/snippet/transform.rb +209 -0
- data/lib/canopus/snippet.rb +183 -0
- data/lib/canopus/tab_map.rb +30 -0
- data/lib/canopus/terminal/cell.rb +7 -0
- data/lib/canopus/terminal/grid.rb +321 -0
- data/lib/canopus/terminal/pty.rb +103 -0
- data/lib/canopus/terminal/scrollback.rb +38 -0
- data/lib/canopus/terminal/vt.rb +398 -0
- data/lib/canopus/terminal.rb +13 -0
- data/lib/canopus/theme.rb +43 -0
- data/lib/canopus/version.rb +5 -0
- data/lib/canopus/vim/commandable.rb +148 -0
- data/lib/canopus/vim/motionable.rb +321 -0
- data/lib/canopus/vim/operator_capable.rb +377 -0
- data/lib/canopus/vim/text_object_selectable.rb +141 -0
- data/lib/canopus/vim.rb +426 -0
- data/lib/canopus/workspace/edit/executable.rb +139 -0
- data/lib/canopus/workspace/edit/node.rb +8 -0
- data/lib/canopus/workspace/edit/plan.rb +170 -0
- data/lib/canopus/workspace/edit/resource_preparable.rb +98 -0
- data/lib/canopus/workspace/edit.rb +6 -0
- data/lib/canopus/workspace/file_change_aware.rb +40 -0
- data/lib/canopus/workspace/file_previewable.rb +31 -0
- data/lib/canopus/workspace/git_aware.rb +140 -0
- data/lib/canopus/workspace/language_aware.rb +413 -0
- data/lib/canopus/workspace/language_server_configurable.rb +181 -0
- data/lib/canopus/workspace/project_searchable.rb +208 -0
- data/lib/canopus/workspace/project_tree_editable.rb +82 -0
- data/lib/canopus/workspace/session_persistable.rb +153 -0
- data/lib/canopus/workspace/settings_aware.rb +91 -0
- data/lib/canopus/workspace/view/terminal_presentable.rb +185 -0
- data/lib/canopus/workspace/view.rb +643 -0
- data/lib/canopus/workspace.rb +525 -0
- data/lib/canopus/wrap_map.rb +108 -0
- data/lib/canopus.rb +24 -0
- data/sig/canopus.rbs +375 -0
- data/sig/controller.rbs +55 -0
- data/sig/display_stages.rbs +49 -0
- data/sig/git.rbs +140 -0
- data/sig/lsp.rbs +99 -0
- data/sig/markdown.rbs +11 -0
- data/sig/performance_recorder.rbs +23 -0
- data/sig/search_services.rbs +8 -0
- data/sig/services.rbs +81 -0
- data/sig/snippet.rbs +42 -0
- data/sig/terminal.rbs +125 -0
- data/sig/vim.rbs +27 -0
- data/sig/workspace_edits.rbs +11 -0
- data/sig/workspace_services.rbs +117 -0
- data/tools/certify_snippet_regex.rb +35 -0
- data/tools/check_dependencies.rb +80 -0
- data/tools/native_check.rb +70 -0
- data/tools/package.rb +113 -0
- data/tools/package_test.rb +32 -0
- metadata +314 -0
data/sig/canopus.rbs
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
module Canopus
|
|
2
|
+
VERSION: String
|
|
3
|
+
type json = nil | bool | Integer | Float | String | Array[json] | Hash[String | Symbol, json]
|
|
4
|
+
type rope = Denebola::Rope | LazyRope
|
|
5
|
+
type patch = Patch | Patch::Composite | Patch::Reload
|
|
6
|
+
type changes = Array[[Range[Integer], String]]
|
|
7
|
+
type bias = :left | :right
|
|
8
|
+
|
|
9
|
+
class Error < StandardError
|
|
10
|
+
end
|
|
11
|
+
class SaveConflict < Error
|
|
12
|
+
end
|
|
13
|
+
module CLI
|
|
14
|
+
def self.main: (?Array[String] arguments, ?output: IO | StringIO, ?error: IO | StringIO) -> Integer
|
|
15
|
+
end
|
|
16
|
+
def self.with_regexp_timeout: [A] (Regexp expression) { () -> A } -> A
|
|
17
|
+
|
|
18
|
+
class Selection < Data
|
|
19
|
+
attr_reader id: Integer
|
|
20
|
+
attr_reader anchor: Integer
|
|
21
|
+
attr_reader head: Integer
|
|
22
|
+
attr_reader goal: Integer?
|
|
23
|
+
def self.new: (Integer id, Integer anchor, Integer head, Integer? goal) -> instance
|
|
24
|
+
def start: () -> Integer
|
|
25
|
+
def end: () -> Integer
|
|
26
|
+
def range: () -> Range[Integer]
|
|
27
|
+
def empty?: () -> bool
|
|
28
|
+
def reversed?: () -> bool
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class Patch
|
|
32
|
+
class Edit < Data
|
|
33
|
+
attr_reader old_range: Range[Integer]
|
|
34
|
+
attr_reader new_range: Range[Integer]
|
|
35
|
+
attr_reader old_text: String
|
|
36
|
+
attr_reader new_text: String
|
|
37
|
+
end
|
|
38
|
+
attr_reader before: rope
|
|
39
|
+
attr_reader after: rope
|
|
40
|
+
attr_reader edits: Array[Edit]
|
|
41
|
+
def initialize: (rope before, rope after, changes changes) -> void
|
|
42
|
+
def map_offset: (Integer offset, ?bias: bias) -> Integer
|
|
43
|
+
def inverse: () -> Patch
|
|
44
|
+
def compose: (patch other) -> Composite
|
|
45
|
+
class Composite
|
|
46
|
+
attr_reader patches: Array[patch]
|
|
47
|
+
def initialize: (Array[patch] patches) -> void
|
|
48
|
+
def before: () -> rope
|
|
49
|
+
def after: () -> rope
|
|
50
|
+
def edits: () -> Array[Edit]
|
|
51
|
+
def map_offset: (Integer offset, ?bias: bias) -> Integer
|
|
52
|
+
def inverse: () -> Composite
|
|
53
|
+
def compose: (patch other) -> Composite
|
|
54
|
+
end
|
|
55
|
+
class Reload
|
|
56
|
+
attr_reader before: rope
|
|
57
|
+
attr_reader after: rope
|
|
58
|
+
def initialize: (rope before, rope after) -> void
|
|
59
|
+
def edits: () -> Array[Edit]
|
|
60
|
+
def map_offset: (Integer offset, ?bias: bias) -> Integer
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class Buffer
|
|
65
|
+
class Anchor < Data
|
|
66
|
+
attr_reader id: Integer
|
|
67
|
+
attr_reader bias: bias
|
|
68
|
+
end
|
|
69
|
+
class Transaction < Struct[untyped]
|
|
70
|
+
attr_reader before: rope
|
|
71
|
+
attr_reader after: rope
|
|
72
|
+
attr_reader before_selections: Array[Selection]
|
|
73
|
+
attr_reader after_selections: Array[Selection]
|
|
74
|
+
attr_reader patch: patch
|
|
75
|
+
attr_reader kind: Symbol
|
|
76
|
+
attr_reader time: Numeric
|
|
77
|
+
end
|
|
78
|
+
def self.open: (String path, ?large_file_threshold: Integer) -> instance
|
|
79
|
+
def self.decode_bytes: (String raw) -> [String, Encoding, String]
|
|
80
|
+
def initialize: (?String text, ?path: String?, ?encoding: Encoding, ?bom: String, ?disk_digest: String?, ?read_only: bool, ?draft: bool, ?rope: rope?) -> void
|
|
81
|
+
attr_reader rope: rope
|
|
82
|
+
attr_reader path: String?
|
|
83
|
+
attr_reader encoding: Encoding
|
|
84
|
+
attr_reader line_ending: String
|
|
85
|
+
attr_reader version: Integer
|
|
86
|
+
attr_reader history: Array[Transaction]
|
|
87
|
+
attr_reader notification_errors: Array[Error]
|
|
88
|
+
attr_reader read_only: bool
|
|
89
|
+
attr_reader disk_digest: String?
|
|
90
|
+
attr_reader bom: String
|
|
91
|
+
attr_accessor selections: Array[Selection]
|
|
92
|
+
def text: () -> String
|
|
93
|
+
def relocate: (String path) -> String
|
|
94
|
+
def close: () -> void
|
|
95
|
+
def line: (Integer row) -> String
|
|
96
|
+
def line_count: () -> Integer
|
|
97
|
+
def dirty?: () -> bool
|
|
98
|
+
def reload: (?force: bool) -> self
|
|
99
|
+
def on_edit: () { (patch) -> void } -> Zaniah::Subscription
|
|
100
|
+
def anchor: (Integer offset, ?bias: bias) -> Anchor
|
|
101
|
+
def resolve: (Anchor anchor) -> Integer
|
|
102
|
+
def release_anchor: (Anchor anchor) -> Integer?
|
|
103
|
+
def begin_undo_group: () -> self
|
|
104
|
+
def end_undo_group: () -> self
|
|
105
|
+
def edit: (changes changes, ?kind: Symbol, ?selections: Array[Selection]?, ?before_selections: Array[Selection], ?time: Numeric, ?group: bool) -> patch?
|
|
106
|
+
def undo: () -> bool
|
|
107
|
+
def redo: () -> bool
|
|
108
|
+
def save: (?String? path, ?force: bool) -> self
|
|
109
|
+
def trim_trailing_whitespace: () -> patch?
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
class LazyRope
|
|
113
|
+
PAGE_SIZE: Integer
|
|
114
|
+
def initialize: (String path, ?page_limit: Integer) -> void
|
|
115
|
+
attr_reader bytesize: Integer
|
|
116
|
+
attr_reader cached_bytes: Integer
|
|
117
|
+
attr_reader line_ending: String
|
|
118
|
+
def lazy?: () -> true
|
|
119
|
+
def line_count: () -> Integer
|
|
120
|
+
def length: () -> Integer
|
|
121
|
+
def utf16_length: () -> Integer
|
|
122
|
+
def empty?: () -> bool
|
|
123
|
+
def close: () -> void
|
|
124
|
+
def line_start: (Integer row) -> Integer
|
|
125
|
+
def line_end: (Integer row) -> Integer
|
|
126
|
+
def line: (Integer row) -> String
|
|
127
|
+
def line_window: (Integer row, ?from: Integer, ?max_bytes: Integer) -> [String, Integer]
|
|
128
|
+
def byteslice: (Integer offset, ?Integer? count) -> Denebola::Rope
|
|
129
|
+
| (Range[Integer] range) -> Denebola::Rope
|
|
130
|
+
def point_at: (Integer offset) -> Denebola::Point
|
|
131
|
+
def offset_at: (Denebola::Point point) -> Integer
|
|
132
|
+
def utf16_point_at: (Integer offset) -> Denebola::Point
|
|
133
|
+
def offset_at_utf16_point: (Denebola::Point point) -> Integer
|
|
134
|
+
def utf16_offset_at: (Integer offset) -> Integer
|
|
135
|
+
def offset_at_utf16: (Integer units) -> Integer
|
|
136
|
+
def each_chunk: () -> Enumerator[String, void]
|
|
137
|
+
| () { (String) -> void } -> void
|
|
138
|
+
def to_s: () -> String
|
|
139
|
+
def apply_edits: (changes changes) -> bot
|
|
140
|
+
def check_invariants!: () -> true
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
class DisplayPoint < Data
|
|
144
|
+
attr_reader row: Integer
|
|
145
|
+
attr_reader column: Integer
|
|
146
|
+
def self.new: (Integer row, Integer column) -> instance
|
|
147
|
+
end
|
|
148
|
+
class DisplayMap
|
|
149
|
+
class Row < Data
|
|
150
|
+
attr_reader text: String
|
|
151
|
+
attr_reader offsets: Array[Integer]
|
|
152
|
+
attr_reader kind: Symbol
|
|
153
|
+
attr_reader metadata: untyped
|
|
154
|
+
end
|
|
155
|
+
def initialize: (Buffer buffer, ?tab_size: Integer, ?wrap_width: Integer?, ?background_threshold: Integer?) -> void
|
|
156
|
+
attr_reader recomputed_lines: Integer
|
|
157
|
+
def dispose: () -> void
|
|
158
|
+
def pending?: () -> bool
|
|
159
|
+
def poll: (?max_lines: Integer) -> bool
|
|
160
|
+
def progress: () -> [Integer, Integer]
|
|
161
|
+
def row_count: () -> Integer
|
|
162
|
+
def wrap_width=: (Integer? width) -> void
|
|
163
|
+
def tab_size=: (Integer size) -> void
|
|
164
|
+
def fold: (Range[Integer] range) -> void
|
|
165
|
+
def unfold: (Integer offset) -> void
|
|
166
|
+
def insert_block: (untyped id, row: Integer, text: String, ?kind: Symbol) -> void
|
|
167
|
+
def remove_block: (untyped id) -> void
|
|
168
|
+
def row: (Integer index) -> Row
|
|
169
|
+
def source_row: (Integer index) -> Integer
|
|
170
|
+
def each_row: (?Range[Integer] range) { (Row, Integer) -> void } -> void
|
|
171
|
+
| (?Range[Integer] range) -> Enumerator[[Row, Integer], void]
|
|
172
|
+
def to_buffer: (DisplayPoint point, ?bias: bias) -> Integer
|
|
173
|
+
def to_display: (Integer offset, ?bias: bias) -> DisplayPoint
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
class Editor
|
|
177
|
+
def self.search_pattern: (String | Regexp pattern, ?case_sensitive: bool, ?whole_word: bool) -> Regexp
|
|
178
|
+
def initialize: (?Buffer buffer, ?wrap_width: Integer?, ?tab_size: Integer) -> void
|
|
179
|
+
attr_reader buffer: Buffer
|
|
180
|
+
attr_reader display_map: DisplayMap
|
|
181
|
+
attr_reader selections: Array[Selection]
|
|
182
|
+
attr_reader scroll_x: Numeric
|
|
183
|
+
attr_reader scroll_y: Numeric
|
|
184
|
+
attr_accessor tab_size: Integer
|
|
185
|
+
attr_accessor use_tabs: bool
|
|
186
|
+
attr_accessor auto_pairs: bool
|
|
187
|
+
attr_accessor viewport_rows: Integer
|
|
188
|
+
attr_accessor relative_line_numbers: bool?
|
|
189
|
+
attr_accessor composition: Zaniah::Input::Composition?
|
|
190
|
+
def dispose: () -> void
|
|
191
|
+
def language_document: () -> Language::Document
|
|
192
|
+
def language=: (Language::Definition definition) -> Language::Document
|
|
193
|
+
def primary: () -> Selection
|
|
194
|
+
def select: (Integer first, ?Integer last, ?add: bool) -> self
|
|
195
|
+
def set_selections: (Array[Selection] selections) -> Array[Selection]
|
|
196
|
+
def insert_text: (String text, ?auto_indent: bool) -> untyped
|
|
197
|
+
def edit: (Array[[Range[Integer], String]] changes, ?kind: Symbol) -> Array[Selection]?
|
|
198
|
+
def delete_backward: () -> untyped
|
|
199
|
+
def delete_forward: () -> untyped
|
|
200
|
+
def undo: () -> bool
|
|
201
|
+
def redo: () -> bool
|
|
202
|
+
def move: (Symbol direction, ?extend: bool, ?count: Integer) -> void
|
|
203
|
+
def select_all: () -> self
|
|
204
|
+
def select_next_occurrence: (?all: bool) -> untyped
|
|
205
|
+
def rectangle: (DisplayPoint first, DisplayPoint last) -> void
|
|
206
|
+
def indent: (?outdent: bool) -> untyped
|
|
207
|
+
def toggle_comment: (?prefix: String, ?suffix: String?) -> untyped
|
|
208
|
+
def duplicate_lines: () -> untyped
|
|
209
|
+
def move_lines: (Symbol direction) -> untyped
|
|
210
|
+
def search: (String | Regexp pattern, ?case_sensitive: bool, ?whole_word: bool, ?range: Range[Integer]?) -> Array[Range[Integer]]
|
|
211
|
+
def replace_all: (String | Regexp pattern, String replacement, ?case_sensitive: bool, ?whole_word: bool, ?range: Range[Integer]?) -> untyped
|
|
212
|
+
def replacement_edits: (String | Regexp pattern, String replacement, ?case_sensitive: bool, ?whole_word: bool, ?range: Range[Integer]?) -> Array[[Range[Integer], String]]
|
|
213
|
+
def scroll: (?dx: Numeric, ?dy: Numeric) -> Numeric
|
|
214
|
+
def reveal_cursor: () -> Numeric
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
module Language
|
|
218
|
+
class Definition < Data
|
|
219
|
+
attr_reader name: String
|
|
220
|
+
attr_reader lexer: String
|
|
221
|
+
attr_reader extensions: Array[String]
|
|
222
|
+
attr_reader comment: String
|
|
223
|
+
attr_reader indent_open: Regexp
|
|
224
|
+
attr_reader indent_close: Regexp
|
|
225
|
+
attr_reader servers: Array[Array[String]]
|
|
226
|
+
def self.new: (String name, String lexer, Array[String] extensions, String comment, Regexp indent_open, Regexp indent_close, Array[Array[String]] servers) -> instance
|
|
227
|
+
end
|
|
228
|
+
class Symbol < Data
|
|
229
|
+
attr_reader name: String
|
|
230
|
+
attr_reader kind: ::Symbol
|
|
231
|
+
attr_reader range: Range[Integer]
|
|
232
|
+
attr_reader selection: Range[Integer]
|
|
233
|
+
attr_reader depth: Integer
|
|
234
|
+
end
|
|
235
|
+
DEFINITIONS: Array[Definition]
|
|
236
|
+
PLAIN: Definition
|
|
237
|
+
def self.for_path: (String? path) -> Definition
|
|
238
|
+
def self.executable?: (String name) -> bool
|
|
239
|
+
class Document
|
|
240
|
+
def initialize: (Buffer buffer, ?definition: Definition, ?background: bool) -> void
|
|
241
|
+
attr_reader buffer: Buffer
|
|
242
|
+
attr_reader definition: Definition
|
|
243
|
+
def dispose: () -> void
|
|
244
|
+
def background?: () -> bool
|
|
245
|
+
def pending?: () -> bool
|
|
246
|
+
def analysis_error: () -> StandardError?
|
|
247
|
+
def poll: () -> bool
|
|
248
|
+
def request: (?first_line: Integer?, ?last_line: Integer?, ?rows: Array[Integer]?, ?syntax: bool) -> self
|
|
249
|
+
def syntax_ready?: () -> bool
|
|
250
|
+
def syntax_complete?: () -> bool
|
|
251
|
+
def tokens_current?: (Integer row) -> bool
|
|
252
|
+
def tokens_for: (Integer row) -> Array[[String | Class, String]]
|
|
253
|
+
def highlighter: (?strategy: (:auto | :incremental | :window | :full)?, ?window_context: Integer?) -> Antares::Highlighter
|
|
254
|
+
def outline: () -> Array[Symbol]
|
|
255
|
+
def diagnostics: () -> Array[{range: Range[Integer], message: String, severity: Integer}]
|
|
256
|
+
def fold_ranges: () -> Array[Range[Integer]]
|
|
257
|
+
def indent_for: (Integer offset, ?tab_size: Integer, ?use_tabs: bool) -> String
|
|
258
|
+
def bracket_at: (Integer offset) -> Range[Integer]?
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
class Settings
|
|
262
|
+
type values = Hash[String, json]
|
|
263
|
+
def self.schema: () -> values
|
|
264
|
+
def self.user_path: () -> String
|
|
265
|
+
def initialize: (*(String | values) layers) -> void
|
|
266
|
+
attr_reader values: values
|
|
267
|
+
attr_reader errors: Array[String]
|
|
268
|
+
attr_reader layers: Array[String | values]
|
|
269
|
+
def []: (String | Symbol key) -> json
|
|
270
|
+
def paths: () -> Array[String]
|
|
271
|
+
def reload: () -> instance
|
|
272
|
+
def for_language: (String language) -> instance
|
|
273
|
+
def merge!: (String | values layer) -> instance
|
|
274
|
+
def set_file: (String path, String key, json value) -> instance
|
|
275
|
+
end
|
|
276
|
+
class Theme
|
|
277
|
+
attr_reader name: String
|
|
278
|
+
attr_reader colors: Hash[Symbol, String]
|
|
279
|
+
attr_reader syntax: Hash[String, String]
|
|
280
|
+
def initialize: (?name: String, ?colors: Hash[Symbol, String], ?syntax: Hash[String, String]) -> void
|
|
281
|
+
def self.load: (String path) -> instance
|
|
282
|
+
def []: (Symbol key) -> String
|
|
283
|
+
def token_color: (untyped token) -> String
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
class Pane
|
|
287
|
+
def initialize: () -> void
|
|
288
|
+
attr_reader editors: Array[Editor]
|
|
289
|
+
attr_reader pinned: Array[Editor]
|
|
290
|
+
attr_accessor active_index: Integer
|
|
291
|
+
def active: () -> Editor?
|
|
292
|
+
def open: (Buffer buffer) -> Editor
|
|
293
|
+
def activate: (Integer index) -> void
|
|
294
|
+
def pin: (?Editor editor) -> untyped
|
|
295
|
+
def close: (?Editor editor, ?discard: bool) -> void
|
|
296
|
+
def detach: (Editor editor) -> void
|
|
297
|
+
def back: () -> untyped
|
|
298
|
+
def forward: () -> untyped
|
|
299
|
+
end
|
|
300
|
+
class Workspace
|
|
301
|
+
def initialize: (?root: String, ?settings: Settings?) -> void
|
|
302
|
+
attr_reader panes: Array[Pane]
|
|
303
|
+
attr_reader active_pane: Pane
|
|
304
|
+
attr_reader buffers: Hash[String | Integer, Buffer]
|
|
305
|
+
attr_reader settings: Settings
|
|
306
|
+
attr_reader theme: Theme
|
|
307
|
+
attr_reader root: String
|
|
308
|
+
attr_reader clients: Hash[String, LSP::Client]
|
|
309
|
+
attr_accessor message: String
|
|
310
|
+
def notify: (String text, ?now: Numeric) -> Integer
|
|
311
|
+
def notifications: () -> Array[{id: Integer, text: String, expires: Numeric}]
|
|
312
|
+
def dismiss_notification: (Integer id) -> void
|
|
313
|
+
def expire_notifications: (?Numeric now) -> bool
|
|
314
|
+
attr_accessor show_project: bool
|
|
315
|
+
attr_accessor terminal_visible: bool?
|
|
316
|
+
attr_accessor performance: PerformanceRecorder?
|
|
317
|
+
def editor: () -> Editor?
|
|
318
|
+
def files: () -> Array[String]
|
|
319
|
+
def refresh_files: () -> void
|
|
320
|
+
def vim: () -> Vim
|
|
321
|
+
def open: (String path) -> Editor
|
|
322
|
+
def canonical_path: (String path) -> String
|
|
323
|
+
def save_buffer: (?Buffer buffer, ?path: String?) -> Buffer
|
|
324
|
+
def new_buffer: () -> Editor
|
|
325
|
+
def focus: (Pane pane) -> void
|
|
326
|
+
def activate_tab: (Pane pane, Editor tab) -> void
|
|
327
|
+
def split: (?Symbol direction) -> Pane
|
|
328
|
+
def close_editor: (?Editor current, ?discard: bool) -> void
|
|
329
|
+
def clear_vim_states: () -> void
|
|
330
|
+
def move_tab: (from: Pane, to: Pane, ?editor: Editor, ?index: Integer?) -> void
|
|
331
|
+
def toggle_dock: (Symbol side) -> bool
|
|
332
|
+
def register_panel: (String name, ?side: Symbol) { () -> (Zaniah::Element | String) } -> untyped
|
|
333
|
+
def register_action: (String name, ?description: String) { (*untyped) -> untyped } -> untyped
|
|
334
|
+
def definition_for: (String? path) -> Language::Definition
|
|
335
|
+
def register_language: (String name, extensions: Array[String], ?lexer: String, ?comment: String, ?indent_open: String, ?indent_close: String, ?servers: Array[Array[String]]) -> untyped
|
|
336
|
+
def call: (String name, *untyped arguments) -> untyped
|
|
337
|
+
def save_session: (String path) -> void
|
|
338
|
+
def restore_session: (String path) -> self
|
|
339
|
+
def theme=: (Theme | String theme) -> void
|
|
340
|
+
def palette_open: (Symbol kind) -> void
|
|
341
|
+
def show_snippet_choices: (?Editor current) -> untyped
|
|
342
|
+
def update_palette: () -> void
|
|
343
|
+
def palette_accept: () -> void
|
|
344
|
+
def connect_server: (String language, Array[String] command) -> LSP::Client
|
|
345
|
+
def language_client: (?Buffer buffer) -> LSP::Client
|
|
346
|
+
def language_request: (Symbol kind, **json options) -> void
|
|
347
|
+
def diagnostics_for: (Buffer buffer) -> Array[LSP::object]
|
|
348
|
+
def apply_workspace_edit: (LSP::object edit, ?confirmed: bool) -> LSP::object
|
|
349
|
+
def resource_workspace_edit?: (LSP::object edit) -> bool
|
|
350
|
+
def confirm_workspace_edit: (LSP::object edit, ?label: String, ?response: LSP::Future?, ?on_applied: ^() -> void) -> untyped
|
|
351
|
+
def post: () { () -> void } -> void
|
|
352
|
+
def drain: () -> void
|
|
353
|
+
def close: () -> void
|
|
354
|
+
def plugins: () -> Plugins::Registry
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
module Plugins
|
|
358
|
+
class PermissionDenied < Error
|
|
359
|
+
end
|
|
360
|
+
class API
|
|
361
|
+
def text: () -> String
|
|
362
|
+
def replace: (Range[Integer] range, String text) -> patch?
|
|
363
|
+
def files: () -> Array[String]
|
|
364
|
+
def notify: (String message) -> String
|
|
365
|
+
def run: (Array[String] command) -> [String, String, Process::Status]
|
|
366
|
+
def http_get: (String url) -> String
|
|
367
|
+
end
|
|
368
|
+
class Registry
|
|
369
|
+
PERMISSIONS: Array[String]
|
|
370
|
+
def initialize: (Workspace workspace) -> void
|
|
371
|
+
def load: (String path, ?isolated: bool, ?permissions: Array[String], ?trusted: bool, ?timeout: Numeric) -> untyped
|
|
372
|
+
def close: () -> void
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
end
|
data/sig/controller.rbs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Canopus
|
|
2
|
+
class Controller
|
|
3
|
+
SHORTCUTS: Hash[String, String]
|
|
4
|
+
attr_reader workspace: Workspace
|
|
5
|
+
attr_reader view: Workspace::View
|
|
6
|
+
attr_reader window: Zaniah::Platform::Headless::Window
|
|
7
|
+
attr_reader keymap: Zaniah::Input::Keymap
|
|
8
|
+
def initialize: (Workspace workspace, Zaniah::Platform::Headless::Window window) -> void
|
|
9
|
+
def input: (Zaniah::Input::event event) -> void
|
|
10
|
+
def input_text: (String text) -> void
|
|
11
|
+
def key: (String stroke) -> void
|
|
12
|
+
def tick: () -> void
|
|
13
|
+
def cancel_scroll: () -> nil
|
|
14
|
+
def poll_scroll: (?now: Numeric) -> bool
|
|
15
|
+
def poll_display_maps: () -> void
|
|
16
|
+
def poll_language_documents: () -> void
|
|
17
|
+
def close_requested: () -> bool
|
|
18
|
+
end
|
|
19
|
+
class Workspace::View < Zaniah::Element
|
|
20
|
+
module TerminalPresentable
|
|
21
|
+
ANSI_COLORS: Array[String]
|
|
22
|
+
class Link < Data
|
|
23
|
+
attr_reader kind: :url | :file
|
|
24
|
+
attr_reader target: String
|
|
25
|
+
attr_reader line: Integer?
|
|
26
|
+
attr_reader column: Integer?
|
|
27
|
+
def self.new: (:url | :file kind, String target, Integer? line, Integer? column) -> instance
|
|
28
|
+
end
|
|
29
|
+
attr_reader terminal_bounds: Zaniah::Bounds?
|
|
30
|
+
attr_reader terminal_selection: [[Integer, Integer], [Integer, Integer]]?
|
|
31
|
+
def terminal_link_at: (Zaniah::Point point) -> Link?
|
|
32
|
+
def terminal_open_link: (Zaniah::Point point, modifiers: Array[String]) -> bool
|
|
33
|
+
def terminal_color: (Terminal::color value, Symbol fallback) -> String?
|
|
34
|
+
def terminal_point: (Zaniah::Point point) -> [Integer, Integer]
|
|
35
|
+
def terminal_scroll: (Numeric delta) -> nil
|
|
36
|
+
def terminal_select: (Zaniah::Point point, ?extend: bool) -> [[Integer, Integer], [Integer, Integer]]
|
|
37
|
+
def terminal_selected_text: () -> String
|
|
38
|
+
end
|
|
39
|
+
include TerminalPresentable
|
|
40
|
+
type action = Array[untyped]
|
|
41
|
+
attr_reader editor_bounds: Hash[Editor, Zaniah::Bounds]
|
|
42
|
+
attr_reader row_layouts: Hash[[Editor, Integer], Zaniah::TextSystem::LineLayout]
|
|
43
|
+
attr_reader regions: Array[[Zaniah::Bounds, action]]
|
|
44
|
+
attr_reader accessibility: Array[{role: Symbol, label: String, bounds: Zaniah::Bounds}]
|
|
45
|
+
attr_accessor keymap: Zaniah::Input::Keymap?
|
|
46
|
+
def initialize: (Workspace workspace) -> void
|
|
47
|
+
def reset_blink: (?Numeric now) -> void
|
|
48
|
+
def cursor_visible?: () -> bool
|
|
49
|
+
def tick: (?Numeric now) -> bool
|
|
50
|
+
def paint: (Zaniah::Bounds bounds, Object? state, Object? prepaint, Zaniah::FrameContext context) -> void
|
|
51
|
+
def hit: (Zaniah::Point point) -> action?
|
|
52
|
+
def offset_at: (Editor editor, Zaniah::Point point) -> Integer
|
|
53
|
+
def project_scroll: (Numeric delta) -> Numeric
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
module Canopus
|
|
2
|
+
class FoldMap
|
|
3
|
+
attr_reader ranges: Array[Range[Integer]]
|
|
4
|
+
def initialize: () -> void
|
|
5
|
+
def fold: (Range[Integer] range) -> Array[Range[Integer]]
|
|
6
|
+
def unfold: (Integer offset) -> Array[Range[Integer]]?
|
|
7
|
+
def apply: (patch patch) -> Array[Range[Integer]]
|
|
8
|
+
def transform: (rope rope, Integer row, ?max_bytes: Integer?, ?from: Integer, ?checkpoint: (^() -> void)?) -> [String, Array[Integer]]?
|
|
9
|
+
end
|
|
10
|
+
class TabMap
|
|
11
|
+
attr_reader tab_size: Integer
|
|
12
|
+
def initialize: (?tab_size: Integer) -> void
|
|
13
|
+
def transform: (String text, Array[Integer] offsets, ?checkpoint: (^() -> void)?) -> [String, Array[Integer]]
|
|
14
|
+
end
|
|
15
|
+
class WrapMap
|
|
16
|
+
attr_reader width: Numeric?
|
|
17
|
+
attr_reader font: Zaniah::TextSystem::_Font?
|
|
18
|
+
attr_reader font_size: Numeric
|
|
19
|
+
attr_reader font_paths: Array[String]?
|
|
20
|
+
attr_reader typesetter: Zaniah::TextSystem::Typesetter?
|
|
21
|
+
def initialize: (?width: Numeric?, ?font: Alhena::Font?, ?font_size: Numeric, ?font_paths: Array[String]?, ?typesetter: Zaniah::TextSystem::Typesetter?) -> void
|
|
22
|
+
def transform: (String text, Array[Integer] offsets, ?checkpoint: (^() -> void)?) -> Array[[String, Array[Integer]]]
|
|
23
|
+
def close: () -> void
|
|
24
|
+
end
|
|
25
|
+
class BlockMap
|
|
26
|
+
class Block < Data
|
|
27
|
+
attr_reader id: untyped
|
|
28
|
+
attr_reader row: Integer
|
|
29
|
+
attr_reader text: String
|
|
30
|
+
attr_reader kind: Symbol
|
|
31
|
+
def self.new: (untyped id, Integer row, String text, Symbol kind) -> instance
|
|
32
|
+
end
|
|
33
|
+
attr_reader blocks: Hash[untyped, Block]
|
|
34
|
+
def initialize: () -> void
|
|
35
|
+
def insert: (untyped id, row: Integer, text: String, ?kind: Symbol) -> Block
|
|
36
|
+
def remove: (untyped id) -> Block?
|
|
37
|
+
def at: (Integer row) -> Array[Block]
|
|
38
|
+
def apply: (patch patch) -> Hash[untyped, Block]
|
|
39
|
+
end
|
|
40
|
+
class DisplayMap
|
|
41
|
+
attr_reader layout_error: StandardError?
|
|
42
|
+
def wrap_pixels: (Numeric width, ?font: Alhena::Font?, font_size: Numeric, ?font_paths: Array[String]?, ?typesetter: Zaniah::TextSystem::Typesetter?) -> void
|
|
43
|
+
attr_reader fold_map: FoldMap
|
|
44
|
+
attr_reader tab_map: TabMap
|
|
45
|
+
attr_reader wrap_map: WrapMap
|
|
46
|
+
attr_reader block_map: BlockMap
|
|
47
|
+
attr_reader tree: Denebola::Tree?
|
|
48
|
+
end
|
|
49
|
+
end
|
data/sig/git.rbs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
module Canopus
|
|
2
|
+
module Git
|
|
3
|
+
type object = [String, String]
|
|
4
|
+
type lines = String | Array[String]
|
|
5
|
+
class CorruptObject < StandardError
|
|
6
|
+
end
|
|
7
|
+
class Commit < Struct[untyped]
|
|
8
|
+
attr_accessor oid: String
|
|
9
|
+
attr_accessor tree: String?
|
|
10
|
+
attr_accessor parents: Array[String]
|
|
11
|
+
attr_accessor author: String?
|
|
12
|
+
attr_accessor committer: String?
|
|
13
|
+
attr_accessor message: String
|
|
14
|
+
def self.new: (oid: String, ?tree: String?, parents: Array[String], ?author: String?, ?committer: String?, message: String) -> instance
|
|
15
|
+
end
|
|
16
|
+
class TreeEntry < Struct[untyped]
|
|
17
|
+
attr_accessor path: String
|
|
18
|
+
attr_accessor oid: String
|
|
19
|
+
attr_accessor mode: Integer
|
|
20
|
+
def self.new: (path: String, oid: String, mode: Integer) -> instance
|
|
21
|
+
end
|
|
22
|
+
class Repository
|
|
23
|
+
attr_reader root: String?
|
|
24
|
+
attr_reader git_dir: String
|
|
25
|
+
attr_reader common_dir: String
|
|
26
|
+
attr_reader odb: ObjectDatabase
|
|
27
|
+
def initialize: (String path) -> void
|
|
28
|
+
def object: (String oid) -> object
|
|
29
|
+
def index: () -> Index
|
|
30
|
+
def head: () -> String?
|
|
31
|
+
def branch: () -> String?
|
|
32
|
+
def refs: () -> Hash[String, String?]
|
|
33
|
+
def branches: () -> Array[String]
|
|
34
|
+
def resolve: (String name, ?Array[String] seen) -> String?
|
|
35
|
+
def commit: (?String reference) -> Commit?
|
|
36
|
+
def tree: (?String reference) -> Hash[String, TreeEntry]
|
|
37
|
+
def blob: (String path, ?reference: String) -> String?
|
|
38
|
+
def status: () -> Array[Status::Entry]
|
|
39
|
+
def blame: (String path, ?reference: String) -> Array[Blame::Line]
|
|
40
|
+
def diff: (String path, ?staged: bool, ?context: Integer) -> Array[Diff::Hunk]
|
|
41
|
+
def worktree_content: (String path) -> String?
|
|
42
|
+
def worktree_path: (String path, ?replacing: Array[String]) -> String
|
|
43
|
+
def revert_hunk: (String path, Diff::Hunk hunk) -> String
|
|
44
|
+
def checkout: (String name) -> String
|
|
45
|
+
end
|
|
46
|
+
class ObjectDatabase
|
|
47
|
+
attr_reader directory: String
|
|
48
|
+
def initialize: (String directory) -> void
|
|
49
|
+
def self.hash: (String type, String data) -> String
|
|
50
|
+
def read: (String oid, ?Array[String] seen) -> object
|
|
51
|
+
def packs: () -> Array[Pack]
|
|
52
|
+
end
|
|
53
|
+
class Pack
|
|
54
|
+
TYPES: Hash[Integer, String]
|
|
55
|
+
MAX_OBJECT_SIZE: Integer
|
|
56
|
+
attr_reader path: String
|
|
57
|
+
attr_reader offsets: Hash[String, Integer]
|
|
58
|
+
def initialize: (String index_path) -> void
|
|
59
|
+
def include?: (String oid) -> bool
|
|
60
|
+
def read: (String oid) ?{ (String) -> object } -> object
|
|
61
|
+
def self.apply_delta: (String base, String delta) -> String
|
|
62
|
+
end
|
|
63
|
+
class Index
|
|
64
|
+
include Enumerable[Entry]
|
|
65
|
+
class Entry < Struct[untyped]
|
|
66
|
+
attr_accessor path: String
|
|
67
|
+
attr_accessor oid: String
|
|
68
|
+
attr_accessor mode: Integer
|
|
69
|
+
attr_accessor size: Integer
|
|
70
|
+
attr_accessor mtime: Integer
|
|
71
|
+
attr_accessor mtime_nsec: Integer
|
|
72
|
+
attr_accessor ctime: Integer
|
|
73
|
+
attr_accessor ctime_nsec: Integer
|
|
74
|
+
attr_accessor dev: Integer
|
|
75
|
+
attr_accessor ino: Integer
|
|
76
|
+
attr_accessor uid: Integer
|
|
77
|
+
attr_accessor gid: Integer
|
|
78
|
+
attr_accessor stage: Integer
|
|
79
|
+
attr_accessor flags: Integer?
|
|
80
|
+
attr_accessor extended_flags: Integer?
|
|
81
|
+
def self.new: (path: String, oid: String, mode: Integer, size: Integer, mtime: Integer, mtime_nsec: Integer, ctime: Integer, ctime_nsec: Integer, dev: Integer, ino: Integer, uid: Integer, gid: Integer, stage: Integer, ?flags: Integer?, ?extended_flags: Integer?) -> instance
|
|
82
|
+
end
|
|
83
|
+
attr_reader entries: Array[Entry]
|
|
84
|
+
attr_reader version: Integer
|
|
85
|
+
attr_reader path: String
|
|
86
|
+
def initialize: (String path) -> void
|
|
87
|
+
def each: () -> Enumerator[Entry, Array[Entry]]
|
|
88
|
+
| () { (Entry) -> void } -> Array[Entry]
|
|
89
|
+
def []: (String path) -> Entry?
|
|
90
|
+
def self.encode: (Array[Entry] entries) -> String
|
|
91
|
+
end
|
|
92
|
+
module Diff
|
|
93
|
+
class Edit < Struct[untyped]
|
|
94
|
+
attr_accessor kind: :equal | :insert | :delete
|
|
95
|
+
attr_accessor old_line: Integer
|
|
96
|
+
attr_accessor new_line: Integer
|
|
97
|
+
attr_accessor text: String
|
|
98
|
+
def self.new: (kind: :equal | :insert | :delete, old_line: Integer, new_line: Integer, text: String) -> instance
|
|
99
|
+
end
|
|
100
|
+
class Hunk < Struct[untyped]
|
|
101
|
+
attr_accessor old_start: Integer
|
|
102
|
+
attr_accessor old_count: Integer
|
|
103
|
+
attr_accessor new_start: Integer
|
|
104
|
+
attr_accessor new_count: Integer
|
|
105
|
+
attr_accessor edits: Array[Edit]
|
|
106
|
+
def self.new: (old_start: Integer, old_count: Integer, new_start: Integer, new_count: Integer, edits: Array[Edit]) -> instance
|
|
107
|
+
def old_text: () -> String
|
|
108
|
+
def new_text: () -> String
|
|
109
|
+
end
|
|
110
|
+
def self.edits: (lines before, lines after) -> Array[Edit]
|
|
111
|
+
def self.hunks: (lines before, lines after, ?context: Integer) -> Array[Hunk]
|
|
112
|
+
def self.revert: (String text, Hunk hunk) -> String
|
|
113
|
+
def self.unified: (lines before, lines after, ?old_name: String, ?new_name: String, ?context: Integer) -> String
|
|
114
|
+
end
|
|
115
|
+
class Status
|
|
116
|
+
class Entry < Struct[untyped]
|
|
117
|
+
attr_accessor path: String
|
|
118
|
+
attr_accessor index: String
|
|
119
|
+
attr_accessor worktree: String
|
|
120
|
+
def self.new: (path: String, index: String, worktree: String) -> instance
|
|
121
|
+
def code: () -> String
|
|
122
|
+
end
|
|
123
|
+
def initialize: (Repository repository) -> void
|
|
124
|
+
def call: () -> Array[Entry]
|
|
125
|
+
end
|
|
126
|
+
class Blame
|
|
127
|
+
class Line < Struct[untyped]
|
|
128
|
+
attr_accessor line: Integer
|
|
129
|
+
attr_accessor text: String
|
|
130
|
+
attr_accessor commit: String
|
|
131
|
+
attr_accessor author: String?
|
|
132
|
+
attr_accessor original_line: Integer
|
|
133
|
+
attr_accessor path: String
|
|
134
|
+
def self.new: (line: Integer, text: String, commit: String, author: String?, original_line: Integer, path: String) -> instance
|
|
135
|
+
end
|
|
136
|
+
def initialize: (Repository repository) -> void
|
|
137
|
+
def call: (String path, ?reference: String) -> Array[Line]
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|