sadr 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa9d3261b52e409bc33e40c02fbf3e3659d701a70115c6cd5784a106232f5669
4
- data.tar.gz: db606ffa6c2444b3ab23a38fdcefa285a80fa6fb6956590a369b30f628d316db
3
+ metadata.gz: 1a6bf397abf93fe02bb31c2e0ed4a8096e511489aeb47702806e0d9627549e02
4
+ data.tar.gz: 333d34cc9d7ef85fa3f41fb10a82c9fa15de4448ec8e56ea0096650847574745
5
5
  SHA512:
6
- metadata.gz: 457a517a32c63de12ab4a3461c36f34a6270e7e77ec05b7c4beb9545c0b3a31c1b01b43a41fbcbffd2fa93f08a2987541b830eda8195f9f60ae576c6b1b8c0b7
7
- data.tar.gz: 53313130ecb14ae934774fe9c8a442a53bb6791fc75896f9ead392b4c370e27ca3ecffdc819981e4503a94919b35a41984bd06581e469f7f9dc9354030ecc041
6
+ metadata.gz: f924801c48f7e53f11e0972c129e2c3fa74ef3ae10cc717bc084637188531bcc59bb263f062e2ac8332e6d53524e88a8e328efa20d2ac01f0dcef3c12ef99a66
7
+ data.tar.gz: ddc6b08e354a23d12c964a0def4db31f9b9d4eb61a2b05774e1a21a1ddec8069b751dbb9dbcfd250b5b808c3be6580e1c96348fb3f5191144eeeac70657ce684
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 - 2026-09-16
4
+
5
+ - Add document highlights, folding ranges, selection ranges, and rename preparation
6
+ - Add call and type hierarchy preparation and navigation, document links and resolution, and linked editing ranges
7
+ - Add range formatting and workspace configuration and watched-file notifications
8
+ - Validate all new request results and advertise their client capabilities
9
+
3
10
  ## 0.1.0 - 2026-09-16
4
11
 
5
12
  - Initial release
data/README.md CHANGED
@@ -15,7 +15,8 @@ gem "sadr"
15
15
  ```ruby
16
16
  require "sadr"
17
17
 
18
- client = Sadr::Client.new(command: ["ruby-lsp"]).start
18
+ client = Sadr::Client.new(command: ["ruby-lsp"])
19
+ capabilities = client.start
19
20
  document = Sadr::Document.new(
20
21
  uri: Sadr::Protocol.uri("example.rb"),
21
22
  language_id: "ruby",
@@ -29,6 +30,53 @@ completion = client.completion(document.uri, position).await
29
30
  client.stop
30
31
  ```
31
32
 
33
+ Document highlights, folding and selection ranges, rename preparation,
34
+ hierarchy preparation, document links, linked editing ranges, and range
35
+ formatting use the same URI and UTF-16 position values:
36
+
37
+ ```ruby
38
+ highlights = client.document_highlight(document.uri, position).await
39
+ folds = client.folding_range(document.uri).await
40
+ selection = client.selection_range(document.uri, [position]).await
41
+ rename_range = client.prepare_rename(document.uri, position).await
42
+ range = Sadr::Range_.new(start: position, end: position)
43
+ formatted = client.range_formatting(document.uri, range,
44
+ tabSize: 2, insertSpaces: true).await
45
+ ```
46
+
47
+ Prepared hierarchy items can be followed in either direction. Document links
48
+ can likewise be resolved after discovery. Sadr validates the supplied item and
49
+ every returned item, call range, URI, and opaque JSON `data` value before
50
+ crossing the client boundary:
51
+
52
+ ```ruby
53
+ call_item = client.prepare_call_hierarchy(document.uri, position).await&.first
54
+ incoming = client.call_hierarchy_incoming_calls(call_item).await if call_item
55
+ outgoing = client.call_hierarchy_outgoing_calls(call_item).await if call_item
56
+
57
+ type_item = client.prepare_type_hierarchy(document.uri, position).await&.first
58
+ supertypes = client.type_hierarchy_supertypes(type_item).await if type_item
59
+ subtypes = client.type_hierarchy_subtypes(type_item).await if type_item
60
+
61
+ link = client.document_link(document.uri).await&.first
62
+ resolved_link = client.resolve_document_link(link).await if link
63
+ ```
64
+
65
+ Workspace changes are notifications and return after the transport accepts the
66
+ message:
67
+
68
+ ```ruby
69
+ client.did_change_configuration("ruby" => {"lint" => true})
70
+ client.did_change_watched_files([{uri: document.uri, type: 2}])
71
+ ```
72
+
73
+ Watched-file types follow LSP: `1` created, `2` changed, and `3` deleted.
74
+ Configuration settings may be any JSON value, as required by LSP. Sadr snapshots
75
+ them before sending so later caller mutations do not alter configuration replies.
76
+
77
+ `Future#await` waits without a deadline by default. Pass `timeout:` in seconds
78
+ when the caller needs a bounded wait; expiry cancels the request best-effort.
79
+
32
80
  `Position#character` is measured in UTF-16 code units. Increment versions and
33
81
  send immutable changes when a document changes:
34
82
 
@@ -47,6 +95,24 @@ position = Sadr::Protocol.position(my_text_index, byte_offset)
47
95
  edits = Sadr::Protocol.text_edits(my_text_index, server_edits)
48
96
  ```
49
97
 
98
+ Tests can use the bundled child-process server or the in-memory transport:
99
+
100
+ ```ruby
101
+ require "sadr/testing"
102
+
103
+ client = Sadr::Client.new(command: Sadr::Testing::FakeServer.command)
104
+ server = Sadr::Testing::FakeServer.new(responses: {"custom/request" => {"ok" => true}})
105
+ fast_client = Sadr::Testing::FakeClient.new(server: server)
106
+ ```
107
+
108
+ The optional real-server test stays outside the normal bundle and CI. After
109
+ `bundle install`, run it with the same Ruby:
110
+
111
+ ```sh
112
+ gem install ruby-lsp
113
+ SADR_INTEGRATION=1 ruby -Ilib:test test/ruby_lsp_integration_test.rb
114
+ ```
115
+
50
116
  ## Development
51
117
 
52
118
  ```sh