canopus 0.4.0 → 0.5.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.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +55 -0
  3. data/README.md +191 -19
  4. data/assets/keymaps/emacs.jsonc +5 -0
  5. data/assets/keymaps/jetbrains.jsonc +5 -0
  6. data/assets/keymaps/sublime.jsonc +5 -0
  7. data/assets/keymaps/vscode.jsonc +5 -0
  8. data/docs/debugging.md +143 -0
  9. data/docs/distribution.md +40 -9
  10. data/docs/lsp.md +131 -0
  11. data/docs/performance.md +18 -0
  12. data/docs/providers.md +36 -0
  13. data/docs/release-log.md +12 -0
  14. data/docs/tasks.md +64 -0
  15. data/docs/testing.md +49 -0
  16. data/docs/vim.md +3 -0
  17. data/exe/canopus +4 -1
  18. data/lib/canopus/buffer.rb +291 -50
  19. data/lib/canopus/cli.rb +5 -2
  20. data/lib/canopus/command.rb +13 -4
  21. data/lib/canopus/controller.rb +183 -40
  22. data/lib/canopus/debug/breakpoints.rb +550 -0
  23. data/lib/canopus/debug/configuration.rb +291 -0
  24. data/lib/canopus/debug/console.rb +243 -0
  25. data/lib/canopus/debug/panel.rb +487 -0
  26. data/lib/canopus/debug/session.rb +354 -0
  27. data/lib/canopus/decoration.rb +4 -2
  28. data/lib/canopus/denebola_compat.rb +27 -0
  29. data/lib/canopus/diagnostics.rb +173 -0
  30. data/lib/canopus/display_map/overlay_map.rb +6 -2
  31. data/lib/canopus/editor/snippet_expandable.rb +3 -2
  32. data/lib/canopus/editor.rb +122 -31
  33. data/lib/canopus/git/state.rb +100 -0
  34. data/lib/canopus/language/background_analysis.rb +93 -14
  35. data/lib/canopus/language/document.rb +70 -34
  36. data/lib/canopus/language/symbol.rb +1 -0
  37. data/lib/canopus/language/syntax_worker.rb +61 -9
  38. data/lib/canopus/language.rb +3 -0
  39. data/lib/canopus/minimap.rb +201 -0
  40. data/lib/canopus/patch.rb +3 -1
  41. data/lib/canopus/plugins/api.rb +4 -2
  42. data/lib/canopus/plugins/isolated_runtime.rb +64 -7
  43. data/lib/canopus/plugins/registry.rb +114 -3
  44. data/lib/canopus/plugins.rb +8 -7
  45. data/lib/canopus/project.rb +15 -6
  46. data/lib/canopus/provider.rb +192 -0
  47. data/lib/canopus/regexp_compat.rb +36 -4
  48. data/lib/canopus/selection.rb +12 -0
  49. data/lib/canopus/settings/schema.rb +201 -0
  50. data/lib/canopus/settings.rb +328 -49
  51. data/lib/canopus/task/configuration.rb +356 -0
  52. data/lib/canopus/task/problem_matcher.rb +264 -0
  53. data/lib/canopus/task/runner.rb +314 -0
  54. data/lib/canopus/test_runner/bounded_ignore.rb +144 -0
  55. data/lib/canopus/test_runner/discovery.rb +97 -0
  56. data/lib/canopus/test_runner/execution.rb +194 -0
  57. data/lib/canopus/test_runner/minitest.rb +116 -0
  58. data/lib/canopus/test_runner/rspec.rb +103 -0
  59. data/lib/canopus/test_runner/safe_walker.rb +37 -0
  60. data/lib/canopus/test_runner.rb +54 -0
  61. data/lib/canopus/theme/import.rb +131 -0
  62. data/lib/canopus/theme.rb +28 -4
  63. data/lib/canopus/version.rb +1 -1
  64. data/lib/canopus/vim/motionable.rb +1 -1
  65. data/lib/canopus/vim.rb +10 -16
  66. data/lib/canopus/workspace/auto_savable.rb +83 -0
  67. data/lib/canopus/workspace/debug_aware.rb +600 -0
  68. data/lib/canopus/workspace/edit/plan.rb +2 -2
  69. data/lib/canopus/workspace/editor_configurable.rb +113 -0
  70. data/lib/canopus/workspace/file_change_aware.rb +11 -3
  71. data/lib/canopus/workspace/git_aware.rb +80 -34
  72. data/lib/canopus/workspace/git_blame.rb +175 -0
  73. data/lib/canopus/workspace/git_conflict_resolution.rb +410 -0
  74. data/lib/canopus/workspace/git_diff_view.rb +641 -0
  75. data/lib/canopus/workspace/git_history.rb +171 -0
  76. data/lib/canopus/workspace/git_remote.rb +267 -0
  77. data/lib/canopus/workspace/git_staging.rb +583 -0
  78. data/lib/canopus/workspace/hierarchy_aware.rb +477 -0
  79. data/lib/canopus/workspace/keymap_aware.rb +66 -0
  80. data/lib/canopus/workspace/language_aware.rb +3721 -135
  81. data/lib/canopus/workspace/language_server_configurable.rb +287 -71
  82. data/lib/canopus/workspace/persistent_undo.rb +169 -0
  83. data/lib/canopus/workspace/problems_aware.rb +131 -0
  84. data/lib/canopus/workspace/project_searchable.rb +88 -11
  85. data/lib/canopus/workspace/project_tree_editable.rb +3 -1
  86. data/lib/canopus/workspace/recoverable.rb +204 -0
  87. data/lib/canopus/workspace/session_persistable.rb +85 -13
  88. data/lib/canopus/workspace/settings_aware.rb +76 -2
  89. data/lib/canopus/workspace/task_aware.rb +194 -0
  90. data/lib/canopus/workspace/test_aware.rb +394 -0
  91. data/lib/canopus/workspace/trust.rb +73 -0
  92. data/lib/canopus/workspace/view/terminal_presentable.rb +298 -47
  93. data/lib/canopus/workspace/view.rb +399 -74
  94. data/lib/canopus/workspace.rb +688 -44
  95. data/lib/canopus.rb +20 -2
  96. data/sig/canopus.rbs +138 -31
  97. data/sig/controller.rbs +10 -3
  98. data/sig/debug.rbs +121 -0
  99. data/sig/decoration.rbs +12 -2
  100. data/sig/diagnostics.rbs +26 -0
  101. data/sig/minimap.rbs +20 -0
  102. data/sig/provider.rbs +29 -0
  103. data/sig/services.rbs +1 -16
  104. data/sig/task.rbs +92 -0
  105. data/sig/test_runner.rbs +109 -0
  106. data/sig/trust.rbs +17 -0
  107. data/sig/workspace_edits.rbs +2 -2
  108. data/sig/workspace_services.rbs +234 -2
  109. data/tools/check_dependencies.rb +21 -2
  110. data/tools/package.rb +172 -14
  111. data/tools/package_signature_test.rb +33 -0
  112. data/tools/package_test.rb +29 -0
  113. data/tools/sign_package.rb +123 -0
  114. data/tools/update.rb +189 -0
  115. data/tools/update_test.rb +71 -0
  116. metadata +206 -31
  117. data/lib/canopus/lsp/client.rb +0 -307
  118. data/lib/canopus/lsp/error.rb +0 -7
  119. data/lib/canopus/lsp/future/subscription.rb +0 -9
  120. data/lib/canopus/lsp/future.rb +0 -87
  121. data/lib/canopus/lsp/protocol.rb +0 -83
  122. data/lib/canopus/lsp/server_error.rb +0 -13
  123. data/lib/canopus/lsp/timeout.rb +0 -7
  124. data/lib/canopus/lsp/transport.rb +0 -123
  125. data/lib/canopus/lsp.rb +0 -19
  126. data/lib/canopus/project/search.rb +0 -164
  127. data/lib/canopus/project/search_worker/cancelled.rb +0 -3
  128. data/lib/canopus/project/search_worker/runner.rb +0 -9
  129. data/lib/canopus/project/search_worker.rb +0 -108
  130. data/lib/canopus/terminal/cell.rb +0 -7
  131. data/lib/canopus/terminal/grid.rb +0 -321
  132. data/lib/canopus/terminal/pty.rb +0 -178
  133. data/lib/canopus/terminal/scrollback.rb +0 -38
  134. data/lib/canopus/terminal/vt.rb +0 -398
  135. data/lib/canopus/terminal.rb +0 -13
  136. data/sig/lsp.rbs +0 -99
  137. data/sig/terminal.rbs +0 -130
data/lib/canopus.rb CHANGED
@@ -14,6 +14,7 @@ require "thuban"
14
14
  require_relative "canopus/command"
15
15
  require_relative "canopus/panel"
16
16
  require_relative "canopus/decoration"
17
+ require_relative "canopus/provider"
17
18
  require_relative "canopus/patch"
18
19
  require_relative "canopus/buffer"
19
20
  require_relative "canopus/multi_buffer"
@@ -22,7 +23,24 @@ require_relative "canopus/editor"
22
23
  require_relative "canopus/language"
23
24
  require "spica"
24
25
  require_relative "canopus/project"
25
- require_relative "canopus/terminal"
26
+ require_relative "canopus/debug/configuration"
27
+ require_relative "canopus/debug/breakpoints"
28
+ megrez_path = ENV["MEGREZ_PATH"]
29
+ megrez_root = File.expand_path("..", __dir__)
30
+ megrez_path ? require(File.expand_path("lib/megrez", File.expand_path(megrez_path, megrez_root))) : require("megrez")
31
+ require_relative "canopus/debug/session"
32
+ require_relative "canopus/debug/panel"
33
+ require_relative "canopus/debug/console"
34
+ tarazed_path = ENV["TARAZED_PATH"]
35
+ tarazed_root = File.expand_path("..", __dir__)
36
+ tarazed_path ? require(File.expand_path("lib/tarazed", File.expand_path(tarazed_path, tarazed_root))) : require("tarazed")
37
+ require_relative "canopus/task/configuration"
38
+ require_relative "canopus/task/problem_matcher"
39
+ require_relative "canopus/task/runner"
40
+ require_relative "canopus/test_runner"
26
41
  require_relative "canopus/workspace"
27
- require_relative "canopus/plugins"
28
42
  require_relative "canopus/controller"
43
+
44
+ module Canopus
45
+ autoload :Plugins, "canopus/plugins"
46
+ end
data/sig/canopus.rbs CHANGED
@@ -1,7 +1,7 @@
1
1
  module Canopus
2
2
  VERSION: String
3
3
  type json = nil | bool | Integer | Float | String | Array[json] | Hash[String | Symbol, json]
4
- type rope = Denebola::Rope | LazyRope
4
+ type rope = Denebola::Rope | Denebola::LazyRope | LazyRope
5
5
  type patch = Patch | Patch::Composite | Patch::Reload
6
6
  type changes = Array[[Range[Integer], String]]
7
7
  type bias = :left | :right
@@ -28,6 +28,15 @@ module Canopus
28
28
  def reversed?: () -> bool
29
29
  end
30
30
 
31
+ class BlockSelection < Data
32
+ include Enumerable[[DisplayPoint, DisplayPoint]]
33
+ attr_reader anchor: DisplayPoint
34
+ attr_reader head: DisplayPoint
35
+ def self.new: (DisplayPoint anchor, DisplayPoint head) -> instance
36
+ def each: () { ([DisplayPoint, DisplayPoint]) -> void } -> self
37
+ | () -> Enumerator[[DisplayPoint, DisplayPoint], self]
38
+ end
39
+
31
40
  class Patch
32
41
  class Edit < Data
33
42
  attr_reader old_range: Range[Integer]
@@ -75,19 +84,21 @@ module Canopus
75
84
  attr_reader kind: Symbol
76
85
  attr_reader time: Numeric
77
86
  end
78
- def self.open: (String path, ?large_file_threshold: Integer) -> instance
87
+ def self.open: (String path, ?large_file_threshold: Integer, ?encoding: Encoding?) -> instance
79
88
  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
89
+ def initialize: (?String text, ?path: String?, ?encoding: Encoding, ?bom: String, ?disk_digest: String?, ?read_only: bool, ?draft: bool, ?rope: rope?, ?detection: untyped) -> void
81
90
  attr_reader rope: rope
82
91
  attr_reader path: String?
83
92
  attr_reader encoding: Encoding
84
93
  attr_reader line_ending: String
94
+ attr_reader newline: Symbol?
85
95
  attr_reader version: Integer
86
96
  attr_reader history: Array[Transaction]
87
97
  attr_reader notification_errors: Array[Error]
88
98
  attr_reader read_only: bool
89
99
  attr_reader disk_digest: String?
90
100
  attr_reader bom: String
101
+ attr_reader detection: untyped
91
102
  attr_accessor selections: Array[Selection]
92
103
  def text: () -> String
93
104
  def relocate: (String path) -> String
@@ -95,7 +106,7 @@ module Canopus
95
106
  def line: (Integer row) -> String
96
107
  def line_count: () -> Integer
97
108
  def dirty?: () -> bool
98
- def reload: (?force: bool) -> self
109
+ def reload: (?force: bool, ?encoding: Encoding?) -> self
99
110
  def on_edit: () { (patch) -> void } -> Zaniah::Subscription
100
111
  def anchor: (Integer offset, ?bias: bias) -> Anchor
101
112
  def resolve: (Anchor anchor) -> Integer
@@ -105,8 +116,15 @@ module Canopus
105
116
  def edit: (changes changes, ?kind: Symbol, ?selections: Array[Selection]?, ?before_selections: Array[Selection], ?time: Numeric, ?group: bool) -> patch?
106
117
  def undo: () -> bool
107
118
  def redo: () -> bool
108
- def save: (?String? path, ?force: bool) -> self
119
+ def persistent_undo_record: (max_entries: Integer) -> Hash[String, untyped]?
120
+ def restore_persistent_undo!: (Hash[String, untyped] record) -> true
121
+ def save: (?String? path, ?force: bool, ?encoding: Encoding?) -> self
122
+ def roundtrip?: (?encoding: Encoding?) -> bool
123
+ def mixed_line_endings?: () -> bool
124
+ def convert_line_endings: (?to: :lf | :crlf | :cr) -> bool
125
+ def convert_newlines: (?to: :lf | :crlf | :cr) -> bool
109
126
  def trim_trailing_whitespace: () -> patch?
127
+ def ensure_final_newline: () -> bool
110
128
  end
111
129
 
112
130
  class LazyRope
@@ -175,6 +193,7 @@ module Canopus
175
193
  end
176
194
 
177
195
  class Editor
196
+ type closing_pairs = Hash[String, String]
178
197
  def self.search_pattern: (String | Regexp pattern, ?case_sensitive: bool, ?whole_word: bool) -> Regexp
179
198
  def initialize: (?Buffer buffer, ?wrap_width: Integer?, ?tab_size: Integer) -> void
180
199
  attr_reader buffer: Buffer
@@ -185,6 +204,7 @@ module Canopus
185
204
  attr_accessor tab_size: Integer
186
205
  attr_accessor use_tabs: bool
187
206
  attr_accessor auto_pairs: bool
207
+ attr_accessor closing_pairs: closing_pairs
188
208
  attr_accessor viewport_rows: Integer
189
209
  attr_accessor relative_line_numbers: bool?
190
210
  attr_accessor composition: Zaniah::Input::Composition?
@@ -193,8 +213,9 @@ module Canopus
193
213
  def language=: (Language::Definition definition) -> Language::Document
194
214
  def primary: () -> Selection
195
215
  def select: (Integer first, ?Integer last, ?add: bool) -> self
196
- def set_selections: (Array[Selection] selections) -> Array[Selection]
197
- def insert_text: (String text, ?auto_indent: bool) -> untyped
216
+ def on_selection: () { (Array[Selection]) -> void } -> Zaniah::Subscription
217
+ def set_selections: (Array[Selection] selections, ?merge: bool) -> Array[Selection]
218
+ def insert_text: (String text, ?auto_indent: bool, ?pair: bool) -> untyped
198
219
  def edit: (Array[[Range[Integer], String]] changes, ?kind: Symbol) -> Array[Selection]?
199
220
  def delete_backward: () -> untyped
200
221
  def delete_forward: () -> untyped
@@ -202,8 +223,11 @@ module Canopus
202
223
  def redo: () -> bool
203
224
  def move: (Symbol direction, ?extend: bool, ?count: Integer) -> void
204
225
  def select_all: () -> self
226
+ def select_matches: (String | Regexp pattern, ?case_sensitive: bool, ?whole_word: bool, ?range: Range[Integer]?) -> Array[Range[Integer]]
205
227
  def select_next_occurrence: (?all: bool) -> untyped
206
228
  def rectangle: (DisplayPoint first, DisplayPoint last) -> void
229
+ def add_cursor: (:up | :down direction) -> Array[Selection]?
230
+ def add_cursors_to_selected_lines: (:start | :end edge) -> Array[Selection]
207
231
  def indent: (?outdent: bool) -> untyped
208
232
  def toggle_comment: (?prefix: String, ?suffix: String?) -> untyped
209
233
  def duplicate_lines: () -> untyped
@@ -233,6 +257,22 @@ module Canopus
233
257
  attr_reader selection: Range[Integer]
234
258
  attr_reader depth: Integer
235
259
  end
260
+ class DocumentSymbol < Data
261
+ attr_reader id: Integer
262
+ attr_reader name: String
263
+ attr_reader kind: Integer | ::Symbol
264
+ attr_reader range: Range[Integer]
265
+ attr_reader selection: Range[Integer]
266
+ attr_reader depth: Integer
267
+ attr_reader parent_id: Integer?
268
+ end
269
+ class Bracket < Data
270
+ attr_reader open_range: Range[Integer]
271
+ attr_reader close_range: Range[Integer]
272
+ attr_reader open_row: Integer
273
+ attr_reader close_row: Integer
274
+ attr_reader depth: Integer
275
+ end
236
276
  DEFINITIONS: Array[Definition]
237
277
  PLAIN: Definition
238
278
  def self.for_path: (String? path) -> Definition
@@ -251,17 +291,23 @@ module Canopus
251
291
  def syntax_complete?: () -> bool
252
292
  def tokens_current?: (Integer row) -> bool
253
293
  def tokens_for: (Integer row) -> Array[[String | Class, String]]
254
- def highlighter: (?strategy: (:auto | :incremental | :window | :full)?, ?window_context: Integer?) -> Antares::Highlighter
294
+ def highlighter: (?strategy: (:auto | :incremental | :window | :full)?, ?window_context: Integer?, ?max_seconds: Numeric?) -> Antares::Highlighter
255
295
  def outline: () -> Array[Symbol]
256
296
  def diagnostics: () -> Array[{range: Range[Integer], message: String, severity: Integer}]
257
297
  def fold_ranges: () -> Array[Range[Integer]]
258
298
  def indent_for: (Integer offset, ?tab_size: Integer, ?use_tabs: bool) -> String
259
299
  def bracket_at: (Integer offset) -> Range[Integer]?
300
+ def brackets: (?Range[Integer]? rows) -> Array[Bracket]
301
+ def structure_regions: () -> Array[{start_line: Integer, end_line: Integer, kind: ::Symbol}]
302
+ def selection_ranges: (Array[Integer] offsets) -> Array[Array[Range[Integer]]]?
260
303
  end
261
304
  end
262
305
  class Settings
263
306
  type values = Hash[String, json]
264
307
  def self.schema: () -> values
308
+ def self.schema_model: () -> Kochab::Schema
309
+ def self.schema_metadata: () -> Kochab::Schema
310
+ def self.file_diagnostics: (String path) -> [Kochab::Document, Array[Kochab::Error | Kochab::Diagnostic]]?
265
311
  def self.user_path: () -> String
266
312
  def initialize: (*(String | values) layers) -> void
267
313
  attr_reader values: values
@@ -272,14 +318,14 @@ module Canopus
272
318
  def reload: () -> instance
273
319
  def for_language: (String language) -> instance
274
320
  def merge!: (String | values layer) -> instance
275
- def set_file: (String path, String key, json value) -> instance
321
+ def set_file: (String path, String | Array[String] key, json value) -> instance
276
322
  end
277
323
  class Theme
278
324
  attr_reader name: String
279
325
  attr_reader colors: Hash[Symbol, String]
280
326
  attr_reader syntax: Hash[String, String]
281
327
  def initialize: (?name: String, ?colors: Hash[Symbol, String], ?syntax: Hash[String, String]) -> void
282
- def self.load: (String path) -> instance
328
+ def self.load: (String path, ?warnings: Array[String]?) -> instance
283
329
  def []: (Symbol key) -> String
284
330
  def token_color: (untyped token) -> String
285
331
  end
@@ -299,6 +345,7 @@ module Canopus
299
345
  def forward: () -> untyped
300
346
  end
301
347
  class Workspace
348
+ type terminal_layout_node = {terminal: Tarazed::PTY} | {direction: :horizontal | :vertical, ratio: Numeric, children: Array[terminal_layout_node]}
302
349
  class ClosedTab < Data
303
350
  attr_reader path: String
304
351
  attr_reader selections: Array[[Integer, Integer]]
@@ -315,7 +362,8 @@ module Canopus
315
362
  attr_reader settings: Settings
316
363
  attr_reader theme: Theme
317
364
  attr_reader root: String
318
- attr_reader clients: Hash[String, LSP::Client]
365
+ attr_reader clients: Hash[String, Sadr::Client]
366
+ attr_reader minimap: Minimap
319
367
  attr_accessor message: String
320
368
  def notify: (String text, ?now: Numeric) -> Integer
321
369
  def notifications: () -> Array[{id: Integer, text: String, expires: Numeric}]
@@ -324,8 +372,9 @@ module Canopus
324
372
  attr_accessor show_project: bool
325
373
  attr_accessor terminal_visible: bool
326
374
  attr_accessor terminal_composition: Zaniah::Input::Composition?
327
- attr_reader terminals: Array[Terminal::PTY]
375
+ attr_reader terminals: Array[Tarazed::PTY]
328
376
  attr_reader active_terminal_index: Integer
377
+ attr_reader terminal_layout: terminal_layout_node?
329
378
  attr_accessor performance: PerformanceRecorder?
330
379
  def editor: () -> Editor?
331
380
  def files: () -> Array[String]
@@ -333,7 +382,7 @@ module Canopus
333
382
  def vim: () -> Vim
334
383
  def open: (String path) -> Editor
335
384
  def canonical_path: (String path) -> String
336
- def save_buffer: (?Buffer buffer, ?path: String?) -> Buffer
385
+ def save_buffer: (?Buffer buffer, ?path: String?, ?encoding: Encoding?, ?confirmed: bool) -> Buffer
337
386
  def new_buffer: () -> Editor
338
387
  def focus: (Pane pane) -> void
339
388
  def activate_tab: (Pane pane, Editor tab) -> void
@@ -345,39 +394,90 @@ module Canopus
345
394
  def buffer_refs: (String | Buffer path_or_buffer) -> Array[[Symbol, Integer]]
346
395
  def clear_vim_states: () -> void
347
396
  def move_tab: (from: Pane, to: Pane, ?editor: Editor, ?index: Integer?) -> void
348
- def new_terminal: (?cwd: String) -> Terminal::PTY
349
- def activate_terminal: (Integer index) -> Terminal::PTY
350
- def move_terminal: (Integer from, Integer to) -> Terminal::PTY
351
- def request_terminal_close: (?Integer index) -> (Terminal::PTY | false | nil)
352
- def close_terminal: (?Integer index) -> Terminal::PTY?
353
- def restart_terminal: (?Integer index) -> Terminal::PTY?
354
- def terminal_title: (?Terminal::PTY? current) -> String
355
- def rename_terminal: (String name, ?Terminal::PTY? current) -> String?
397
+ def new_terminal: (?cwd: String?, ?profile: String?) -> Tarazed::Session
398
+ def split_terminal: (:horizontal | :vertical direction, ?profile: String?) -> Tarazed::Session
399
+ def terminal_profile: (?Tarazed::PTY? current) -> String?
400
+ def activate_terminal: (Integer index) -> Tarazed::PTY
401
+ def move_terminal: (Integer from, Integer to) -> Tarazed::PTY
402
+ def request_terminal_close: (?Integer index) -> (Tarazed::PTY | false | nil)
403
+ def close_terminal: (?Integer index) -> Tarazed::PTY?
404
+ def restart_terminal: (?Integer index) -> Tarazed::PTY?
405
+ def terminal_title: (?Tarazed::PTY? current) -> String
406
+ def rename_terminal: (String name, ?Tarazed::PTY? current) -> String?
407
+ def show_terminal_commands: (?failed: bool) -> void
356
408
  def drain_terminals: (?now: Numeric) -> bool
357
- def resize_terminal: (Integer columns, Integer rows, ?final: bool, ?now: Numeric) -> void
409
+ def resize_terminal: (Integer columns, Integer rows, ?final: bool, ?now: Numeric, ?terminal: Tarazed::PTY?) -> void
358
410
  def flush_terminal_resize: () -> void
359
411
  def toggle_dock: (Symbol side) -> bool
360
412
  def register_panel: (String name, ?side: Panel::dock) { () -> (Zaniah::Element | String) } -> Panel::Definition
361
413
  def register_action: (String name, ?description: String, ?category: String, ?condition: String, ?keybinding: Command::keybinding) { (*untyped) -> untyped } -> Command::Definition
362
414
  def definition_for: (String? path) -> Language::Definition
363
415
  def register_language: (String name, extensions: Array[String], ?lexer: String, ?comment: String, ?indent_open: String, ?indent_close: String, ?servers: Array[Array[String]]) -> untyped
364
- def command_context: (?terminal: bool) -> Command::context
416
+ def command_context: (?terminal: bool, ?task_output: bool) -> Command::context
365
417
  def call: (String name, *untyped arguments, ?context: Command::context?) -> untyped
366
- def save_session: (String path) -> void
418
+ def save_session: (String path, ?max_draft_bytes: Integer?) -> void
367
419
  def restore_session: (String path) -> self
420
+ def recovery_directory: () -> String
421
+ def recovery_candidates: () -> Array[String]
422
+ def offer_recovery: () -> bool
423
+ def resolve_recovery: (:restore | :discard choice) -> bool
424
+ def poll_recovery: (?now: Numeric, ?force: bool) -> bool
425
+ def poll_auto_save: (?now: Numeric) -> bool
426
+ def close_recovery: (?clean: bool) -> void
427
+ def preserve_recovery!: () -> true
368
428
  def theme=: (Theme | String theme) -> void
369
429
  def palette_open: (Symbol kind, ?command_ids: Array[String]?, ?context: Command::context?) -> void
370
430
  def show_snippet_choices: (?Editor current) -> untyped
371
431
  def update_palette: () -> void
372
432
  def palette_accept: () -> void
373
- def connect_server: (String language, Array[String] command) -> LSP::Client
374
- def language_client: (?Buffer buffer) -> LSP::Client
433
+ def connect_server: (String language, Array[String] command) -> Sadr::Client
434
+ def language_clients: (?Buffer buffer, ?feature: String?, ?timeout: Numeric?) -> Array[Sadr::Client]
435
+ def language_client: (?Buffer buffer, ?feature: String?, ?timeout: Numeric?) -> Sadr::Client
436
+ def language_server_states: (String language) -> Array[Hash[Symbol, untyped]]
437
+ def show_language_server_restart: () -> void
438
+ def restart_language_server: (String language, Integer index) -> Sadr::Client
375
439
  def language_request: (Symbol kind, **json options) -> void
376
- def diagnostics_for: (Buffer buffer) -> Array[LSP::object]
377
- def apply_workspace_edit: (LSP::object edit, ?confirmed: bool) -> LSP::object
378
- def resource_workspace_edit?: (LSP::object edit) -> bool
379
- def confirm_workspace_edit: (LSP::object edit, ?label: String, ?response: LSP::Future?, ?on_applied: ^() -> void) -> untyped
440
+ def request_workspace_symbols: (String query) -> Thread
441
+ def cancel_workspace_symbol_search: () -> nil
442
+ def run_save_actions: (Buffer buffer) -> bool
443
+ def prepare_rename: (?Editor? current) -> bool?
444
+ def rename_prepared: (Hash[Symbol, untyped] snapshot, String name) -> bool?
445
+ def invalidate_prepare_rename: (?Buffer? buffer, ?client: Sadr::Client?, ?editor: Editor?) -> nil
446
+ def diagnostics_for: (Buffer buffer) -> Array[Sadr::object]
447
+ def document_highlight_decorations: (Buffer buffer, Range[Integer] rows, Editor? current) -> Array[Decoration::Item]
448
+ def request_document_highlights: (Editor current) -> bool
449
+ def invalidate_document_highlights: (?Buffer? buffer, ?client: Sadr::Client?, ?editor: Editor?) -> nil
450
+ def document_link_decorations: (Buffer buffer, Range[Integer] rows, Editor? current) -> Array[Decoration::Item]
451
+ def request_document_links: (Editor current) -> bool
452
+ def invalidate_document_links: (?Buffer? buffer, ?client: Sadr::Client?, ?editor: Editor?) -> nil
453
+ def linked_editing_range: (?Editor current) -> bool?
454
+ def invalidate_linked_editing_ranges: (?Buffer? buffer, ?client: Sadr::Client?, ?editor: Editor?) -> nil
455
+ def hierarchy_tree: () -> Zaniah::UI::TreeView
456
+ def show_call_hierarchy: (?Editor? current) -> bool?
457
+ def show_type_hierarchy: (?Editor? current) -> bool?
458
+ def invalidate_hierarchy: (?Buffer? buffer, ?client: Sadr::Client?, ?editor: Editor?) -> nil
459
+ def invalidate_folding_ranges: (?Buffer? buffer, ?client: Sadr::Client?, ?editor: Editor?) -> nil
460
+ def expand_selection: (?Editor current) -> bool?
461
+ def shrink_selection: (?Editor current) -> bool
462
+ def invalidate_selection_ranges: (?Buffer? buffer, ?client: Sadr::Client?, ?editor: Editor?) -> nil
463
+ def apply_workspace_edit: (Sadr::object edit, ?confirmed: bool) -> Sadr::object
464
+ def resource_workspace_edit?: (Sadr::object edit) -> bool
465
+ def confirm_workspace_edit: (Sadr::object edit, ?label: String, ?response: Sadr::Future?, ?on_applied: ^() -> void) -> untyped
380
466
  def post: () { () -> void } -> void
467
+ def bracket_decorations: (Buffer buffer, Range[Integer] rows, Editor? current) -> Array[Decoration::Item]
468
+ def invalidate_brackets: (?Buffer? buffer) -> nil
469
+ def sticky_scroll_enabled?: (Editor current) -> bool
470
+ def breadcrumbs_enabled?: (Editor current) -> bool
471
+ def sticky_context: (Editor current, Integer display_row) -> Array[Language::DocumentSymbol]
472
+ def document_symbol_chain: (Editor current, Integer offset) -> Array[Language::DocumentSymbol]
473
+ def document_symbol_siblings: (Editor current, Language::DocumentSymbol symbol, generation: Integer) -> Array[Language::DocumentSymbol]
474
+ def document_symbol_generation: (Editor current) -> Integer?
475
+ def breadcrumb_context: (Editor current) -> Hash[Symbol, untyped]?
476
+ def show_breadcrumb_menu: (Pane pane, Editor current, Hash[Symbol, untyped] item, Hash[Symbol, untyped] context) -> bool
477
+ def minimap_settings: (Editor current) -> Hash[String, untyped]
478
+ def refresh_sticky_fallback: (Editor current, ?Language::Document document) -> Array[Language::DocumentSymbol]
479
+ def request_sticky_symbols: (Editor current) -> bool
480
+ def invalidate_sticky_symbols: (?Buffer? buffer, ?client: Sadr::Client?) -> nil
381
481
  def drain: () -> void
382
482
  def close: () -> void
383
483
  def plugins: () -> Plugins::Registry
@@ -396,7 +496,14 @@ module Canopus
396
496
  end
397
497
  class Registry
398
498
  PERMISSIONS: Array[String]
399
- def initialize: (Workspace workspace) -> void
499
+ def initialize: (Workspace workspace, ?state_path: String?) -> void
500
+ def search: (String query, ?limit: Integer) -> Array[Hash[Symbol, untyped]]
501
+ def install: (String name, ?version: untyped) -> untyped
502
+ def update: (String name) -> untyped
503
+ def disable: (String name) -> true
504
+ def enable: (String name) -> true
505
+ def disabled?: (String name) -> bool
506
+ def load_gem: (String name, ?isolated: bool, ?permissions: Array[String], ?trusted: bool, ?timeout: Numeric) -> untyped
400
507
  def load: (String path, ?isolated: bool, ?permissions: Array[String], ?trusted: bool, ?timeout: Numeric) -> untyped
401
508
  def close: () -> void
402
509
  end
data/sig/controller.rbs CHANGED
@@ -5,6 +5,7 @@ module Canopus
5
5
  attr_reader window: Zaniah::Platform::Headless::Window
6
6
  attr_reader keymap: Zaniah::Input::Keymap
7
7
  def initialize: (Workspace workspace, Zaniah::Platform::Headless::Window window) -> void
8
+ def wait_for: (Array[String] paths) -> Array[String]
8
9
  def input: (Zaniah::Input::event event) -> void
9
10
  def input_text: (String text) -> void
10
11
  def key: (String stroke) -> void
@@ -27,17 +28,22 @@ module Canopus
27
28
  end
28
29
  attr_reader terminal_bounds: Zaniah::Bounds?
29
30
  attr_reader terminal_selection: [[Integer, Integer], [Integer, Integer]]?
31
+ def focus_terminal: (Tarazed::PTY? terminal) -> Tarazed::PTY?
30
32
  def terminal_link_at: (Zaniah::Point point) -> Link?
31
33
  def terminal_open_link: (Zaniah::Point point, modifiers: Array[String]) -> bool
32
- def terminal_color: (Terminal::color value, Symbol fallback) -> String?
33
- def terminal_point: (Zaniah::Point point) -> [Integer, Integer]
34
+ def terminal_color: (Tarazed::color value, Symbol fallback) -> String?
35
+ def terminal_point: (Zaniah::Point point) -> [Integer, Integer]?
34
36
  def terminal_scroll: (Numeric delta) -> nil
35
- def terminal_select: (Zaniah::Point point, ?extend: bool) -> [[Integer, Integer], [Integer, Integer]]
37
+ def terminal_select: (Zaniah::Point point, ?extend: bool) -> [[Integer, Integer], [Integer, Integer]]?
36
38
  def terminal_selected_text: () -> String
39
+ def terminal_command: (:previous | :next direction) -> bool
40
+ def terminal_command_jump: (Tarazed::Command? command) -> bool
41
+ def terminal_toggle_command: (?Tarazed::Command? command) -> bool
37
42
  end
38
43
  include TerminalPresentable
39
44
  type action = Array[untyped]
40
45
  attr_reader editor_bounds: Hash[Editor, Zaniah::Bounds]
46
+ attr_reader minimap_bounds: Hash[Editor, Hash[Symbol, untyped]]
41
47
  attr_reader row_layouts: Hash[[Editor, Integer], Zaniah::TextSystem::LineLayout]
42
48
  attr_reader regions: Array[[Zaniah::Bounds, action]]
43
49
  attr_reader accessibility: Array[{role: Symbol, label: String, bounds: Zaniah::Bounds}]
@@ -50,5 +56,6 @@ module Canopus
50
56
  def hit: (Zaniah::Point point) -> action?
51
57
  def offset_at: (Editor editor, Zaniah::Point point) -> Integer
52
58
  def project_scroll: (Numeric delta) -> Numeric
59
+ def minimap_scroll: (Editor editor, Zaniah::Point point) -> bool
53
60
  end
54
61
  end
data/sig/debug.rbs ADDED
@@ -0,0 +1,121 @@
1
+ module Canopus::Debug
2
+ class Configuration
3
+ RELATIVE_PATH: String
4
+ MAX_BYTES: Integer
5
+ MAX_CONFIGURATIONS: Integer
6
+ MAX_DEPTH: Integer
7
+ MAX_COLLECTION_SIZE: Integer
8
+ MAX_STRING_BYTES: Integer
9
+ MAX_EXPANDED_STRING_BYTES: Integer
10
+ MAX_TOTAL_EXPANDED_BYTES: Integer
11
+ MAX_ENVIRONMENT_ENTRY_BYTES: Integer
12
+ MAX_ENVIRONMENT_BYTES: Integer
13
+ VARIABLE: Regexp
14
+
15
+ attr_reader root: String
16
+ attr_reader configurations: Array[Hash[String, Canopus::json]]
17
+
18
+ def initialize: (root: String, ?settings: Canopus::Settings, ?environment: untyped) -> void
19
+ def resolve: (String | Hash[String, Canopus::json] configuration, ?file: String?, ?line_number: Integer?, ?selected_text: String?) -> Hash[String, Canopus::json]
20
+ def adapter: (String type, ?file: String?, ?line_number: Integer?, ?selected_text: String?) -> Hash[String, Canopus::json]
21
+ end
22
+
23
+ class Breakpoints
24
+ class Entry < Data
25
+ attr_reader path: String
26
+ attr_reader line: Integer
27
+ attr_reader condition: String?
28
+ attr_reader hit_condition: String?
29
+ attr_reader log_message: String?
30
+ attr_reader enabled: bool
31
+ def self.new: (String path, Integer line, String? condition, String? hit_condition, String? log_message, bool enabled) -> instance
32
+ end
33
+
34
+ VERSION: Integer
35
+ RELATIVE_PATH: String
36
+ MAX_BYTES: Integer
37
+ MAX_ENTRIES: Integer
38
+ MAX_PATH_BYTES: Integer
39
+ MAX_CONDITION_BYTES: Integer
40
+ MAX_HIT_CONDITION_BYTES: Integer
41
+ MAX_LOG_MESSAGE_BYTES: Integer
42
+ MAX_LINE: Integer
43
+
44
+ attr_reader root: String
45
+ attr_reader entries: Array[Entry]
46
+
47
+ def initialize: (root: String) ?{ (String) -> void } -> void
48
+ def for_path: (String path) -> Array[Entry]
49
+ def add: (String path, Integer line, ?condition: String?, ?hit_condition: String?, ?log_message: String?, ?enabled: bool) -> Entry
50
+ def remove: (String path, Integer line) -> bool
51
+ def toggle: (String path, Integer line, ?condition: String?, ?hit_condition: String?, ?log_message: String?, ?enabled: bool) -> Entry?
52
+ def update: (String path, Integer line, ?new_line: Integer, ?condition: String?, ?hit_condition: String?, ?log_message: String?, ?enabled: bool) -> Entry
53
+ def attach: (Canopus::Buffer buffer) -> self
54
+ def detach: (Canopus::Buffer buffer) -> bool
55
+ def close: () -> nil
56
+ def flush: () -> self
57
+ def error: () -> StandardError?
58
+ end
59
+
60
+ class Session
61
+ DEFAULT_TIMEOUT: Integer
62
+ CONNECT_INTERVAL: Float
63
+
64
+ attr_reader client: Megrez::Session?
65
+ def stopped_thread_id: () -> Integer?
66
+ def initialize: (root: String, configuration: Hash[String, Canopus::json],
67
+ adapter: Hash[String, Canopus::json], breakpoints: Breakpoints,
68
+ ?client: Megrez::Session?, ?timeout: Numeric) -> void
69
+ def on: (Symbol | String event) { (untyped) -> untyped } -> Proc
70
+ def start: () -> self
71
+ def stack_frames: (?levels: Integer) -> Megrez::Future
72
+ def scopes: (Integer frame_id) -> Megrez::Future
73
+ def variables: (Integer reference) -> Megrez::Future
74
+ def evaluate: (String expression, frame_id: Integer, ?context: String) -> Megrez::Future
75
+ def close: () -> nil
76
+ end
77
+
78
+ class Panel
79
+ ITEM_LIMIT: Integer
80
+ WATCH_LIMIT: Integer
81
+ TEXT_LIMIT: Integer
82
+ DEPTH_LIMIT: Integer
83
+ ROOT_STACK: Array[Symbol]
84
+ ROOT_VARIABLES: Array[Symbol]
85
+ ROOT_WATCHES: Array[Symbol]
86
+ ROOT_BREAKPOINTS: Array[Symbol]
87
+ ROOTS: Array[Array[Symbol]]
88
+
89
+ attr_reader tree: Zaniah::UI::TreeView
90
+ attr_reader watches: Array[String]
91
+ attr_reader expanded_paths: Set[Array[untyped]]
92
+ attr_reader selected_frame: Megrez::StackFrame?
93
+ def initialize: (breakpoints: Breakpoints, post: untyped, select_frame: untyped,
94
+ select_breakpoint: untyped, report: untyped, request_frame: untyped) -> void
95
+ def stopped: (Session session, Megrez::StackFrame frame) -> self
96
+ def continued: (Session session) -> bool
97
+ def clear: () -> nil
98
+ def refresh_breakpoints: () -> nil
99
+ def add_watch: (String expression) -> bool
100
+ def remove_watch: (String expression) -> bool
101
+ end
102
+
103
+ class Console
104
+ ITEM_LIMIT: Integer
105
+ TEXT_LIMIT: Integer
106
+ PENDING_LIMIT: Integer
107
+ OUTPUT_QUEUE_LIMIT: Integer
108
+
109
+ attr_reader tree: Zaniah::UI::TreeView
110
+ attr_reader entries: Array[{id: Integer, label: String}]
111
+ attr_reader selected_frame: Megrez::StackFrame?
112
+ def initialize: (post: untyped, request_frame: untyped) -> void
113
+ def attach: (Session session) -> self
114
+ def stopped: (Session session, Megrez::StackFrame frame) -> bool
115
+ def continued: (Session session) -> bool
116
+ def clear: () -> nil
117
+ def detach: () -> nil
118
+ def output: (Session session, Hash[String | Symbol, untyped] event) -> bool
119
+ def evaluate: (String expression) -> Megrez::Future
120
+ end
121
+ end
data/sig/decoration.rbs CHANGED
@@ -1,6 +1,16 @@
1
1
  module Canopus
2
2
  module Decoration
3
3
  type kind = :inline | :block | :gutter | :highlight | :line
4
+ type click_handler = _ClickHandler | _ContextClickHandler
5
+
6
+ interface _ClickHandler
7
+ def call: (Editor, Integer) -> untyped
8
+ end
9
+
10
+ interface _ContextClickHandler
11
+ def call: (Editor, Integer) -> untyped
12
+ def right_click: (Editor, Integer) -> untyped
13
+ end
4
14
 
5
15
  class Item < Data
6
16
  attr_reader kind: kind
@@ -10,8 +20,8 @@ module Canopus
10
20
  attr_reader style: untyped
11
21
  attr_reader priority: Numeric
12
22
  attr_reader source: Symbol?
13
- attr_reader on_click: (^(Editor, Integer) -> untyped)?
14
- def self.new: (kind kind, Range[Integer]? range, Integer? row, untyped content, untyped style, Numeric priority, Symbol? source, (^(Editor, Integer) -> untyped)? on_click) -> instance
23
+ attr_reader on_click: click_handler?
24
+ def self.new: (kind kind, Range[Integer]? range, Integer? row, untyped content, untyped style, Numeric priority, Symbol? source, click_handler? on_click) -> instance
15
25
  end
16
26
 
17
27
  class Registry
@@ -0,0 +1,26 @@
1
+ module Canopus
2
+ module Diagnostics
3
+ type source = :lsp | :settings | :task | :test
4
+ type severity = :error | :warning | :information | :hint
5
+
6
+ SOURCES: Array[source]
7
+ SEVERITIES: Hash[severity, Integer]
8
+
9
+ class Entry < Data
10
+ attr_reader source: source
11
+ attr_reader uri: String
12
+ attr_reader diagnostic: Sadr::object
13
+ def self.new: (source source, String uri, Sadr::object diagnostic) -> instance
14
+ end
15
+
16
+ class Registry
17
+ attr_reader version: Integer
18
+ def initialize: () -> void
19
+ | () { (String) -> void } -> void
20
+ def publish: (source source, String uri, Array[Sadr::object] diagnostics, ?notify: bool) -> Array[Sadr::object]
21
+ def for_uri: (String uri) -> Array[Entry]
22
+ def all: (?severity: Integer | severity?, ?source: source?) -> Array[Entry]
23
+ def counts: () -> {error: Integer, warning: Integer, information: Integer, hint: Integer}
24
+ end
25
+ end
26
+ end
data/sig/minimap.rbs ADDED
@@ -0,0 +1,20 @@
1
+ module Canopus
2
+ class Minimap
3
+ GENERATION_LIMIT: Integer
4
+ ENTRY_LIMIT: Integer
5
+ VARIANT_LIMIT: Integer
6
+ LINE_BYTES: Integer
7
+
8
+ attr_reader generated: Integer
9
+ def initialize: () -> void
10
+ def begin_frame: (Integer frame, text_system: untyped, font_size: Numeric, font_family: String?, scale_factor: Numeric) -> untyped
11
+ def texture: (Buffer buffer, Integer row, width: Numeric) -> Zaniah::GPU::Texture?
12
+ def pending?: () -> bool
13
+ def cache_size: () -> Integer
14
+ def cached_rows: (Buffer buffer) -> Array[Integer]
15
+ def record_search: (Buffer buffer, Integer version, Array[Range[Integer]] ranges) -> Hash[Symbol, untyped]
16
+ def search_rows: (Buffer buffer, Integer version) -> Array[Integer]
17
+ def release: (Buffer buffer) -> nil
18
+ def close: () -> nil
19
+ end
20
+ end
data/sig/provider.rbs ADDED
@@ -0,0 +1,29 @@
1
+ module Canopus
2
+ module Provider
3
+ class Completion < Data
4
+ attr_reader label: String
5
+ attr_reader insert_text: String?
6
+ attr_reader kind: untyped
7
+ attr_reader detail: String?
8
+ attr_reader documentation: String?
9
+ attr_reader sort_text: String?
10
+ attr_reader filter_text: String?
11
+ attr_reader additional_edits: Array[untyped]?
12
+ attr_reader source: Symbol?
13
+ def self.new: (String label, String? insert_text, untyped kind, String? detail, String? documentation,
14
+ String? sort_text, String? filter_text, Array[untyped]? additional_edits, Symbol? source) -> instance
15
+ end
16
+
17
+ class Registry
18
+ MAX_PROVIDERS: Integer
19
+ MAX_ITEMS: Integer
20
+ MAX_STRING: Integer
21
+ PROVIDER_TIMEOUT: Integer
22
+ def initialize: () -> void
23
+ def register_completion: (Symbol source, priority: Numeric) { (Buffer, Integer, untyped) -> untyped } -> Symbol
24
+ def complete: (Buffer buffer, Integer offset, untyped context) -> Array[Completion]
25
+ def register_inline_completion: (Symbol source) { (Buffer, Integer) -> untyped } -> Symbol
26
+ def inline_completion: (Buffer buffer, Integer offset) -> String?
27
+ end
28
+ end
29
+ end