sadr 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 +62 -0
- data/docs/adr/000-template.md +17 -0
- data/docs/adr/001-editor-independent-documents.md +20 -0
- data/docs/adr/README.md +3 -0
- data/lib/sadr/client.rb +529 -0
- data/lib/sadr/document_sync.rb +80 -0
- data/lib/sadr/future.rb +118 -0
- data/lib/sadr/protocol.rb +208 -0
- data/lib/sadr/transport.rb +166 -0
- data/lib/sadr/version.rb +5 -0
- data/lib/sadr.rb +55 -0
- data/sig/sadr.rbs +152 -0
- metadata +57 -0
data/sig/sadr.rbs
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
module Sadr
|
|
2
|
+
VERSION: String
|
|
3
|
+
|
|
4
|
+
type json = nil | bool | Integer | Float | String | Array[json] | Hash[String | Symbol, json]
|
|
5
|
+
type object = Hash[String | Symbol, json]
|
|
6
|
+
|
|
7
|
+
interface _Point
|
|
8
|
+
def row: () -> Integer
|
|
9
|
+
def column: () -> Integer
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
interface _TextIndex
|
|
13
|
+
def utf16_point_at: (Integer offset) -> _Point
|
|
14
|
+
def utf16_offset_at: (Integer offset) -> Integer
|
|
15
|
+
def offset_at_utf16: (Integer offset) -> Integer
|
|
16
|
+
def line_start: (Integer row) -> Integer
|
|
17
|
+
def line: (Integer row) -> String
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
module TextIndex
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class Error < StandardError
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
class Timeout < Error
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class ServerError < Error
|
|
30
|
+
attr_reader code: Integer
|
|
31
|
+
attr_reader data: json
|
|
32
|
+
def initialize: (Hash[String, json] error) -> void
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class Position
|
|
36
|
+
attr_reader line: Integer
|
|
37
|
+
attr_reader character: Integer
|
|
38
|
+
def self.new: (line: Integer, character: Integer) -> Position
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class Range_
|
|
42
|
+
attr_reader start: Position
|
|
43
|
+
attr_reader end: Position
|
|
44
|
+
def self.new: (start: Position, end: Position) -> Range_
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
class ContentChange
|
|
48
|
+
attr_reader range: Range_?
|
|
49
|
+
attr_reader text: String
|
|
50
|
+
def self.new: (range: Range_?, text: String) -> ContentChange
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class Document
|
|
54
|
+
attr_reader uri: String
|
|
55
|
+
attr_reader language_id: String
|
|
56
|
+
attr_reader version: Integer
|
|
57
|
+
attr_reader text: String
|
|
58
|
+
def self.new: (uri: String, language_id: String, version: Integer, text: String) -> Document
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class Token
|
|
62
|
+
attr_reader line: Integer
|
|
63
|
+
attr_reader character: Integer
|
|
64
|
+
attr_reader length: Integer
|
|
65
|
+
attr_reader type: Integer
|
|
66
|
+
attr_reader modifiers: Integer
|
|
67
|
+
def self.new: (line: Integer, character: Integer, length: Integer, type: Integer, modifiers: Integer) -> Token
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
module Protocol
|
|
71
|
+
def self.uri: (String path) -> String
|
|
72
|
+
def self.path: (String uri) -> String
|
|
73
|
+
def self.position: (_TextIndex index, Integer offset) -> Position
|
|
74
|
+
def self.offset: (_TextIndex index, Position | Hash[String | Symbol, Integer] position) -> Integer
|
|
75
|
+
def self.range: (_TextIndex index, ::Range[Integer] range) -> Range_
|
|
76
|
+
def self.text_edits: (_TextIndex index, Array[object] edits) -> Array[[::Range[Integer], String]]
|
|
77
|
+
def self.semantic_tokens: (Array[Integer] data, ?legend: Hash[String, Array[String]]?) -> Array[Token]
|
|
78
|
+
def self.semantic_delta: (Array[Integer] data, Array[Hash[String, json]] edits) -> Array[Integer]
|
|
79
|
+
def self.diagnostics: (Array[object] values) -> Array[object]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
class Future
|
|
83
|
+
class Subscription
|
|
84
|
+
def initialize: () { () -> untyped } -> void
|
|
85
|
+
def detach: () -> untyped
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
attr_reader id: Integer | String | nil
|
|
89
|
+
attr_reader callback_errors: Array[Error]
|
|
90
|
+
def initialize: (Integer | String | nil id, ?on_error: ^(Error) -> untyped) ?{ (Integer | String | nil) -> untyped } -> void
|
|
91
|
+
def fulfill: (?untyped value, ?error: Exception?) -> Future?
|
|
92
|
+
def then: () { (untyped, Exception?) -> untyped } -> Future
|
|
93
|
+
def done?: () -> bool
|
|
94
|
+
def on_complete: () { () -> untyped } -> Subscription
|
|
95
|
+
def await: (?timeout: Numeric?) -> untyped
|
|
96
|
+
def cancel: () -> bool
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
class Transport
|
|
100
|
+
MAX_MESSAGE: Integer
|
|
101
|
+
attr_reader stderr_lines: Array[String]
|
|
102
|
+
attr_reader pid: Integer
|
|
103
|
+
def initialize: (Array[String] command, ?cwd: String?, ?env: Hash[String, String?]) { (Hash[String, json]?, Exception?) -> untyped } -> void
|
|
104
|
+
def self.read_message: (IO | StringIO io) -> Hash[String, json]?
|
|
105
|
+
def self.validate_message: (untyped message) -> Hash[String, json]
|
|
106
|
+
def write: (object message) -> untyped
|
|
107
|
+
def alive?: () -> bool
|
|
108
|
+
def close: () -> untyped
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
class Client
|
|
112
|
+
attr_reader capabilities: Hash[String, json]
|
|
113
|
+
attr_reader transport: Transport?
|
|
114
|
+
attr_reader diagnostics: Hash[String, Array[object]]
|
|
115
|
+
attr_reader state: :stopped | :starting | :running | :failed
|
|
116
|
+
attr_reader errors: Array[Error]
|
|
117
|
+
attr_reader server_info: Hash[String, json]?
|
|
118
|
+
attr_reader position_encoding: String?
|
|
119
|
+
def initialize: (command: Array[String], ?root: String, ?dispatch: ^() { () -> untyped } -> untyped, ?restart: bool, ?env: Hash[String, String?], ?initialization_options: json, ?configuration: object) -> void
|
|
120
|
+
def start: (?timeout: Numeric) -> self
|
|
121
|
+
def stop: () -> untyped
|
|
122
|
+
def running?: () -> bool
|
|
123
|
+
def supports?: (String | Symbol capability) -> bool
|
|
124
|
+
def request: (String | Symbol method, ?json params) -> Future
|
|
125
|
+
def notify: (String | Symbol method, ?json params) -> untyped
|
|
126
|
+
def on: (String | Symbol method) { (untyped) -> untyped } -> Proc
|
|
127
|
+
def open: (Document document) -> String
|
|
128
|
+
def change: (String uri, Integer version, Array[ContentChange] changes) -> Document
|
|
129
|
+
def save: (String uri, ?text: String?) -> untyped
|
|
130
|
+
def close: (String uri) -> untyped
|
|
131
|
+
def completion: (String uri, Position position, **json params) -> Future
|
|
132
|
+
def hover: (String uri, Position position, **json params) -> Future
|
|
133
|
+
def definition: (String uri, Position position, **json params) -> Future
|
|
134
|
+
def type_definition: (String uri, Position position, **json params) -> Future
|
|
135
|
+
def implementation: (String uri, Position position, **json params) -> Future
|
|
136
|
+
def references: (String uri, Position position, ?include_declaration: bool) -> Future
|
|
137
|
+
def signature_help: (String uri, Position position, **json params) -> Future
|
|
138
|
+
def rename: (String uri, Position position, String new_name) -> Future
|
|
139
|
+
def document_symbol: (String uri) -> Future
|
|
140
|
+
def formatting: (String uri, object options) -> Future
|
|
141
|
+
def code_action: (String uri, Range_ range, object context) -> Future
|
|
142
|
+
def code_lens: (String uri) -> Future
|
|
143
|
+
def inlay_hint: (String uri, Range_ range) -> Future
|
|
144
|
+
def diagnostic: (String uri, ?previous_result_id: String?) -> Future
|
|
145
|
+
def semantic_tokens: (String uri, version: Integer) -> Array[Token]
|
|
146
|
+
def workspace_symbols: (String query) -> Future
|
|
147
|
+
def resolve_completion: (object item) -> Future
|
|
148
|
+
def resolve_code_action: (object action) -> Future
|
|
149
|
+
def resolve_code_lens: (object lens) -> Future
|
|
150
|
+
def execute_command: (String command, ?arguments: Array[json]) -> Future
|
|
151
|
+
end
|
|
152
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sadr
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Yudai Takada
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
email:
|
|
13
|
+
- t.yudai92@gmail.com
|
|
14
|
+
executables: []
|
|
15
|
+
extensions: []
|
|
16
|
+
extra_rdoc_files: []
|
|
17
|
+
files:
|
|
18
|
+
- CHANGELOG.md
|
|
19
|
+
- LICENSE.txt
|
|
20
|
+
- README.md
|
|
21
|
+
- docs/adr/000-template.md
|
|
22
|
+
- docs/adr/001-editor-independent-documents.md
|
|
23
|
+
- docs/adr/README.md
|
|
24
|
+
- lib/sadr.rb
|
|
25
|
+
- lib/sadr/client.rb
|
|
26
|
+
- lib/sadr/document_sync.rb
|
|
27
|
+
- lib/sadr/future.rb
|
|
28
|
+
- lib/sadr/protocol.rb
|
|
29
|
+
- lib/sadr/transport.rb
|
|
30
|
+
- lib/sadr/version.rb
|
|
31
|
+
- sig/sadr.rbs
|
|
32
|
+
homepage: https://github.com/noxdea/sadr
|
|
33
|
+
licenses:
|
|
34
|
+
- MIT
|
|
35
|
+
metadata:
|
|
36
|
+
source_code_uri: https://github.com/noxdea/sadr
|
|
37
|
+
changelog_uri: https://github.com/noxdea/sadr/blob/main/CHANGELOG.md
|
|
38
|
+
allowed_push_host: https://rubygems.org
|
|
39
|
+
rubygems_mfa_required: 'true'
|
|
40
|
+
rdoc_options: []
|
|
41
|
+
require_paths:
|
|
42
|
+
- lib
|
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.1'
|
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '0'
|
|
53
|
+
requirements: []
|
|
54
|
+
rubygems_version: 4.0.16
|
|
55
|
+
specification_version: 4
|
|
56
|
+
summary: A pure Ruby Language Server Protocol client
|
|
57
|
+
test_files: []
|