canopus 0.3.0 → 0.4.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +8 -2
- data/docs/adr/008-component-domain-boundaries.md +26 -0
- data/docs/adr/009-decoration-overlay-path.md +26 -0
- data/docs/adr/010-overlay-aware-display-map.md +32 -0
- data/lib/canopus/command.rb +109 -0
- data/lib/canopus/controller.rb +30 -39
- data/lib/canopus/decoration.rb +132 -0
- data/lib/canopus/display_map/line_builder.rb +25 -5
- data/lib/canopus/display_map/overlay_map.rb +123 -0
- data/lib/canopus/display_map.rb +25 -4
- data/lib/canopus/lsp/client.rb +19 -11
- data/lib/canopus/panel.rb +104 -0
- data/lib/canopus/settings.rb +29 -5
- data/lib/canopus/tab_map.rb +8 -3
- data/lib/canopus/version.rb +1 -1
- data/lib/canopus/workspace/git_aware.rb +17 -1
- data/lib/canopus/workspace/session_persistable.rb +16 -6
- data/lib/canopus/workspace/view.rb +177 -51
- data/lib/canopus/workspace.rb +90 -23
- data/lib/canopus/wrap_map.rb +27 -1
- data/lib/canopus.rb +3 -0
- data/sig/canopus.rbs +7 -5
- data/sig/command.rbs +30 -0
- data/sig/controller.rbs +0 -2
- data/sig/decoration.rbs +26 -0
- data/sig/display_stages.rbs +28 -2
- data/sig/panel.rbs +35 -0
- data/sig/workspace_services.rbs +5 -2
- metadata +15 -5
data/sig/canopus.rbs
CHANGED
|
@@ -161,6 +161,7 @@ module Canopus
|
|
|
161
161
|
def row_count: () -> Integer
|
|
162
162
|
def wrap_width=: (Integer? width) -> void
|
|
163
163
|
def tab_size=: (Integer size) -> void
|
|
164
|
+
def set_overlays: (Array[Decoration::Item] items, ?font: Alhena::Font?, ?font_size: Numeric, ?line_height: Numeric) -> bool
|
|
164
165
|
def fold: (Range[Integer] range) -> void
|
|
165
166
|
def unfold: (Integer offset) -> void
|
|
166
167
|
def insert_block: (untyped id, row: Integer, text: String, ?kind: Symbol) -> void
|
|
@@ -321,7 +322,7 @@ module Canopus
|
|
|
321
322
|
def dismiss_notification: (Integer id) -> void
|
|
322
323
|
def expire_notifications: (?Numeric now) -> bool
|
|
323
324
|
attr_accessor show_project: bool
|
|
324
|
-
attr_accessor terminal_visible: bool
|
|
325
|
+
attr_accessor terminal_visible: bool
|
|
325
326
|
attr_accessor terminal_composition: Zaniah::Input::Composition?
|
|
326
327
|
attr_reader terminals: Array[Terminal::PTY]
|
|
327
328
|
attr_reader active_terminal_index: Integer
|
|
@@ -356,15 +357,16 @@ module Canopus
|
|
|
356
357
|
def resize_terminal: (Integer columns, Integer rows, ?final: bool, ?now: Numeric) -> void
|
|
357
358
|
def flush_terminal_resize: () -> void
|
|
358
359
|
def toggle_dock: (Symbol side) -> bool
|
|
359
|
-
def register_panel: (String name, ?side:
|
|
360
|
-
def register_action: (String name, ?description: String) { (*untyped) -> untyped } ->
|
|
360
|
+
def register_panel: (String name, ?side: Panel::dock) { () -> (Zaniah::Element | String) } -> Panel::Definition
|
|
361
|
+
def register_action: (String name, ?description: String, ?category: String, ?condition: String, ?keybinding: Command::keybinding) { (*untyped) -> untyped } -> Command::Definition
|
|
361
362
|
def definition_for: (String? path) -> Language::Definition
|
|
362
363
|
def register_language: (String name, extensions: Array[String], ?lexer: String, ?comment: String, ?indent_open: String, ?indent_close: String, ?servers: Array[Array[String]]) -> untyped
|
|
363
|
-
def
|
|
364
|
+
def command_context: (?terminal: bool) -> Command::context
|
|
365
|
+
def call: (String name, *untyped arguments, ?context: Command::context?) -> untyped
|
|
364
366
|
def save_session: (String path) -> void
|
|
365
367
|
def restore_session: (String path) -> self
|
|
366
368
|
def theme=: (Theme | String theme) -> void
|
|
367
|
-
def palette_open: (Symbol kind) -> void
|
|
369
|
+
def palette_open: (Symbol kind, ?command_ids: Array[String]?, ?context: Command::context?) -> void
|
|
368
370
|
def show_snippet_choices: (?Editor current) -> untyped
|
|
369
371
|
def update_palette: () -> void
|
|
370
372
|
def palette_accept: () -> void
|
data/sig/command.rbs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Canopus
|
|
2
|
+
module Command
|
|
3
|
+
type context = Hash[String | Symbol, untyped]
|
|
4
|
+
type keybinding = String | Hash[String, String] | nil
|
|
5
|
+
|
|
6
|
+
DEFAULT_KEYBINDINGS: Hash[String, Hash[String, String]]
|
|
7
|
+
|
|
8
|
+
class Definition < Data
|
|
9
|
+
attr_reader id: String
|
|
10
|
+
attr_reader title: String
|
|
11
|
+
attr_reader category: String
|
|
12
|
+
attr_reader when: String
|
|
13
|
+
attr_reader run: ^(*untyped) -> untyped
|
|
14
|
+
attr_reader keybinding: keybinding
|
|
15
|
+
def self.new: (String id, String title, String category, String when, ^(*untyped) -> untyped run, keybinding keybinding) -> instance
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class Registry
|
|
19
|
+
attr_reader version: Integer
|
|
20
|
+
def initialize: () -> void
|
|
21
|
+
def register: (Definition definition) -> Definition
|
|
22
|
+
| (String id, ?description: String, ?category: String, ?condition: String, ?keybinding: keybinding) { (*untyped) -> untyped } -> Definition
|
|
23
|
+
def resolve: (String | Symbol id, ?context: context) -> Definition?
|
|
24
|
+
def call: (String | Symbol id, *untyped arguments, ?context: context) -> untyped
|
|
25
|
+
def each: (?context: context?) { (Definition) -> untyped } -> self
|
|
26
|
+
| (?context: context?) -> Enumerator[Definition, self]
|
|
27
|
+
def entries: (?context: context?) -> Hash[String, String]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/sig/controller.rbs
CHANGED
data/sig/decoration.rbs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Canopus
|
|
2
|
+
module Decoration
|
|
3
|
+
type kind = :inline | :block | :gutter | :highlight | :line
|
|
4
|
+
|
|
5
|
+
class Item < Data
|
|
6
|
+
attr_reader kind: kind
|
|
7
|
+
attr_reader range: Range[Integer]?
|
|
8
|
+
attr_reader row: Integer?
|
|
9
|
+
attr_reader content: untyped
|
|
10
|
+
attr_reader style: untyped
|
|
11
|
+
attr_reader priority: Numeric
|
|
12
|
+
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
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Registry
|
|
18
|
+
attr_reader version: Integer
|
|
19
|
+
def initialize: () -> void
|
|
20
|
+
def register: (Symbol source) { (Buffer, Range[Integer], ?Editor) -> Array[Item] } -> Symbol
|
|
21
|
+
def unregister: (Symbol source) -> Proc?
|
|
22
|
+
def items_for: (Buffer buffer, Range[Integer] row_range, ?context: Editor?) -> Array[Item]
|
|
23
|
+
def invalidate: (Symbol source, ?buffer: Buffer?, ?rows: Range[Integer]?) -> nil
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/sig/display_stages.rbs
CHANGED
|
@@ -10,7 +10,7 @@ module Canopus
|
|
|
10
10
|
class TabMap
|
|
11
11
|
attr_reader tab_size: Integer
|
|
12
12
|
def initialize: (?tab_size: Integer) -> void
|
|
13
|
-
def transform: (String text, Array[Integer] offsets, ?checkpoint: (^() -> void)?) -> [String, Array[Integer]]
|
|
13
|
+
def transform: (String text, Array[Integer] offsets, ?checkpoint: (^() -> void)?, ?overlays: Array[DisplayMap::OverlayMap::Inline]?) -> ([String, Array[Integer]] | [String, Array[Integer], Array[DisplayMap::OverlayMap::Inline]])
|
|
14
14
|
end
|
|
15
15
|
class WrapMap
|
|
16
16
|
attr_reader width: Numeric?
|
|
@@ -19,7 +19,7 @@ module Canopus
|
|
|
19
19
|
attr_reader font_paths: Array[String]?
|
|
20
20
|
attr_reader typesetter: Zaniah::TextSystem::Typesetter?
|
|
21
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]]]
|
|
22
|
+
def transform: (String text, Array[Integer] offsets, ?checkpoint: (^() -> void)?, ?overlays: Array[DisplayMap::OverlayMap::Inline], ?tab_map: TabMap?) -> Array[([String, Array[Integer]] | [String, Array[Integer], Array[DisplayMap::OverlayMap::Inline]])]
|
|
23
23
|
def close: () -> void
|
|
24
24
|
end
|
|
25
25
|
class BlockMap
|
|
@@ -38,9 +38,35 @@ module Canopus
|
|
|
38
38
|
def apply: (patch patch) -> Hash[untyped, Block]
|
|
39
39
|
end
|
|
40
40
|
class DisplayMap
|
|
41
|
+
class OverlayMap
|
|
42
|
+
class Inline < Data
|
|
43
|
+
attr_reader item: Decoration::Item
|
|
44
|
+
attr_reader offset: Integer
|
|
45
|
+
attr_reader width: Float
|
|
46
|
+
attr_reader cell_width: Float
|
|
47
|
+
attr_reader height: Float
|
|
48
|
+
attr_reader align: :before | :after
|
|
49
|
+
def self.new: (Decoration::Item item, Integer offset, Float width, Float cell_width, Float height, :before | :after align) -> instance
|
|
50
|
+
end
|
|
51
|
+
class Block < Data
|
|
52
|
+
attr_reader item: Decoration::Item
|
|
53
|
+
attr_reader row: Integer
|
|
54
|
+
attr_reader height: Float
|
|
55
|
+
attr_reader row_span: Integer
|
|
56
|
+
attr_reader position: :above | :below
|
|
57
|
+
def self.new: (Decoration::Item item, Integer row, Float height, Integer row_span, :above | :below position) -> instance
|
|
58
|
+
end
|
|
59
|
+
attr_reader line_height: Numeric
|
|
60
|
+
def initialize: () -> void
|
|
61
|
+
def replace: (Array[Decoration::Item] items, rope: rope, ?font: Alhena::Font?, ?font_size: Numeric, ?line_height: Numeric) -> Array[Integer]
|
|
62
|
+
def transform: (rope rope, Integer row, String text, Array[Integer] offsets) -> Array[Inline]
|
|
63
|
+
def blocks: (Integer row, :above | :below position) -> Array[Block]
|
|
64
|
+
def snapshot: () -> OverlayMap
|
|
65
|
+
end
|
|
41
66
|
attr_reader layout_error: StandardError?
|
|
42
67
|
def wrap_pixels: (Numeric width, ?font: Alhena::Font?, font_size: Numeric, ?font_paths: Array[String]?, ?typesetter: Zaniah::TextSystem::Typesetter?) -> void
|
|
43
68
|
attr_reader fold_map: FoldMap
|
|
69
|
+
attr_reader overlay_map: OverlayMap
|
|
44
70
|
attr_reader tab_map: TabMap
|
|
45
71
|
attr_reader wrap_map: WrapMap
|
|
46
72
|
attr_reader block_map: BlockMap
|
data/sig/panel.rbs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Canopus
|
|
2
|
+
module Panel
|
|
3
|
+
type dock = :left | :right | :bottom
|
|
4
|
+
type dock_state = { visible: bool, size: Numeric }
|
|
5
|
+
type saved_state = Hash[String, Hash[String, bool | Numeric]]
|
|
6
|
+
|
|
7
|
+
class Definition < Data
|
|
8
|
+
attr_reader id: String
|
|
9
|
+
attr_reader title: String
|
|
10
|
+
attr_reader icon: untyped
|
|
11
|
+
attr_reader dock: dock
|
|
12
|
+
attr_reader build: ^() -> untyped
|
|
13
|
+
attr_reader badge: untyped
|
|
14
|
+
def self.new: (String | Symbol id, String title, untyped icon, dock dock, ^() -> untyped build, untyped badge) -> instance
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Registry
|
|
18
|
+
DOCKS: Array[dock]
|
|
19
|
+
attr_reader docks: Hash[dock, dock_state]
|
|
20
|
+
def initialize: (Hash[dock, dock_state] docks) -> void
|
|
21
|
+
def register: (Definition definition, ?visible: bool, ?size: Numeric?) -> Definition
|
|
22
|
+
def fetch: (String | Symbol id) -> Definition
|
|
23
|
+
def key?: (String | Symbol id) -> bool
|
|
24
|
+
def visible?: (String | Symbol id) -> bool
|
|
25
|
+
def show: (String | Symbol id) -> Definition
|
|
26
|
+
def hide: (String | Symbol id) -> Definition
|
|
27
|
+
def toggle: (String | Symbol id) -> Definition
|
|
28
|
+
def active: (dock dock) -> Array[Definition]
|
|
29
|
+
def badge: (String | Symbol id, untyped value) -> Definition
|
|
30
|
+
def resize: (dock dock, Numeric size) -> Numeric
|
|
31
|
+
def state: () -> saved_state
|
|
32
|
+
def restore: (saved_state state, ?docks: Hash[dock, dock_state]?) -> self
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
data/sig/workspace_services.rbs
CHANGED
|
@@ -25,10 +25,12 @@ module Canopus
|
|
|
25
25
|
type palette_state = Hash[Symbol, untyped]
|
|
26
26
|
type search_options = { ?case_sensitive: bool, ?whole_word: bool, ?range: Range[Integer] }
|
|
27
27
|
type semantic_style = {line: Integer, character: Integer, length: Integer, type: Integer, modifiers: Integer, name: String?}
|
|
28
|
-
attr_reader actions:
|
|
28
|
+
attr_reader actions: Command::Registry
|
|
29
|
+
attr_reader commands: Command::Registry
|
|
29
30
|
attr_reader project: Project?
|
|
30
31
|
attr_reader docks: Hash[Symbol, {visible: bool, size: Numeric}]
|
|
31
|
-
attr_reader panels:
|
|
32
|
+
attr_reader panels: Panel::Registry
|
|
33
|
+
attr_reader decorations: Decoration::Registry
|
|
32
34
|
attr_accessor window: Zaniah::Platform::Headless::Window?
|
|
33
35
|
attr_reader palette: palette_state?
|
|
34
36
|
def palette=: (palette_state? value) -> void
|
|
@@ -68,6 +70,7 @@ module Canopus
|
|
|
68
70
|
def git_diff: (?Buffer buffer, ?async: bool) -> Porrima::Diff?
|
|
69
71
|
def git_hunks: (?Buffer buffer, ?async: bool) -> Array[Porrima::Hunk]
|
|
70
72
|
def git_gutter_marks: (?Buffer buffer) -> Array[Porrima::Mark]
|
|
73
|
+
def git_decorations: (Buffer buffer, Range[Integer] rows) -> Array[Decoration::Item]
|
|
71
74
|
def show_git_diff: () -> Language::Document
|
|
72
75
|
def toggle_git_hunk: (?Editor current, ?row: Integer?) -> bool
|
|
73
76
|
def show_git_blame: () -> String
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: canopus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yudai Takada
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.2.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.2.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: antares
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -155,14 +155,14 @@ dependencies:
|
|
|
155
155
|
requirements:
|
|
156
156
|
- - "~>"
|
|
157
157
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: 0.
|
|
158
|
+
version: 0.4.0
|
|
159
159
|
type: :runtime
|
|
160
160
|
prerelease: false
|
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
|
162
162
|
requirements:
|
|
163
163
|
- - "~>"
|
|
164
164
|
- !ruby/object:Gem::Version
|
|
165
|
-
version: 0.
|
|
165
|
+
version: 0.4.0
|
|
166
166
|
email:
|
|
167
167
|
- t.yudai92@gmail.com
|
|
168
168
|
executables:
|
|
@@ -183,6 +183,9 @@ files:
|
|
|
183
183
|
- docs/adr/005-windows-runtime.md
|
|
184
184
|
- docs/adr/006-tab-close-lifetime.md
|
|
185
185
|
- docs/adr/007-terminal-key-routing.md
|
|
186
|
+
- docs/adr/008-component-domain-boundaries.md
|
|
187
|
+
- docs/adr/009-decoration-overlay-path.md
|
|
188
|
+
- docs/adr/010-overlay-aware-display-map.md
|
|
186
189
|
- docs/adr/README.md
|
|
187
190
|
- docs/distribution.md
|
|
188
191
|
- docs/lsp.md
|
|
@@ -198,11 +201,14 @@ files:
|
|
|
198
201
|
- lib/canopus/block_map.rb
|
|
199
202
|
- lib/canopus/buffer.rb
|
|
200
203
|
- lib/canopus/cli.rb
|
|
204
|
+
- lib/canopus/command.rb
|
|
201
205
|
- lib/canopus/controller.rb
|
|
202
206
|
- lib/canopus/data_compat.rb
|
|
207
|
+
- lib/canopus/decoration.rb
|
|
203
208
|
- lib/canopus/display_map.rb
|
|
204
209
|
- lib/canopus/display_map/line_builder.rb
|
|
205
210
|
- lib/canopus/display_map/line_set.rb
|
|
211
|
+
- lib/canopus/display_map/overlay_map.rb
|
|
206
212
|
- lib/canopus/display_map/pending_line_set.rb
|
|
207
213
|
- lib/canopus/display_map/summary.rb
|
|
208
214
|
- lib/canopus/display_map/worker.rb
|
|
@@ -234,6 +240,7 @@ files:
|
|
|
234
240
|
- lib/canopus/match_data_compat.rb
|
|
235
241
|
- lib/canopus/multi_buffer.rb
|
|
236
242
|
- lib/canopus/pane.rb
|
|
243
|
+
- lib/canopus/panel.rb
|
|
237
244
|
- lib/canopus/patch.rb
|
|
238
245
|
- lib/canopus/patch/composite.rb
|
|
239
246
|
- lib/canopus/patch/reload.rb
|
|
@@ -290,10 +297,13 @@ files:
|
|
|
290
297
|
- lib/canopus/workspace/view/terminal_presentable.rb
|
|
291
298
|
- lib/canopus/wrap_map.rb
|
|
292
299
|
- sig/canopus.rbs
|
|
300
|
+
- sig/command.rbs
|
|
293
301
|
- sig/controller.rbs
|
|
302
|
+
- sig/decoration.rbs
|
|
294
303
|
- sig/display_stages.rbs
|
|
295
304
|
- sig/lsp.rbs
|
|
296
305
|
- sig/markdown.rbs
|
|
306
|
+
- sig/panel.rbs
|
|
297
307
|
- sig/performance_recorder.rbs
|
|
298
308
|
- sig/search_services.rbs
|
|
299
309
|
- sig/services.rbs
|