ruby-lsp-rspec 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby_lsp_rspec/version.rb +1 -1
  3. metadata +1 -45
  4. data/misc/example.gif +0 -0
  5. data/sorbet/config +0 -4
  6. data/sorbet/rbi/annotations/rainbow.rbi +0 -269
  7. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -584
  8. data/sorbet/rbi/gems/base64@0.1.1.rbi +0 -172
  9. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1083
  10. data/sorbet/rbi/gems/erubi@1.12.0.rbi +0 -145
  11. data/sorbet/rbi/gems/io-console@0.6.0.rbi +0 -8
  12. data/sorbet/rbi/gems/json@2.6.3.rbi +0 -1533
  13. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +0 -14237
  14. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -158
  15. data/sorbet/rbi/gems/parallel@1.23.0.rbi +0 -273
  16. data/sorbet/rbi/gems/parser@3.2.2.3.rbi +0 -7253
  17. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +0 -951
  18. data/sorbet/rbi/gems/psych@5.1.0.rbi +0 -1760
  19. data/sorbet/rbi/gems/racc@1.7.1.rbi +0 -161
  20. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -402
  21. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -3024
  22. data/sorbet/rbi/gems/rbi@0.0.17.rbi +0 -2972
  23. data/sorbet/rbi/gems/regexp_parser@2.8.1.rbi +0 -3749
  24. data/sorbet/rbi/gems/reline@0.3.8.rbi +0 -2260
  25. data/sorbet/rbi/gems/rexml@3.2.6.rbi +0 -4781
  26. data/sorbet/rbi/gems/rspec-core@3.12.2.rbi +0 -10805
  27. data/sorbet/rbi/gems/rspec-expectations@3.12.3.rbi +0 -8100
  28. data/sorbet/rbi/gems/rspec-mocks@3.12.5.rbi +0 -5305
  29. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +0 -1611
  30. data/sorbet/rbi/gems/rspec@3.12.0.rbi +0 -82
  31. data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +0 -6985
  32. data/sorbet/rbi/gems/rubocop@1.56.2.rbi +0 -56538
  33. data/sorbet/rbi/gems/ruby-lsp@0.10.1.rbi +0 -2903
  34. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +0 -1317
  35. data/sorbet/rbi/gems/spoom@1.2.3.rbi +0 -3203
  36. data/sorbet/rbi/gems/stringio@3.0.8.rbi +0 -8
  37. data/sorbet/rbi/gems/syntax_tree@6.1.1.rbi +0 -22855
  38. data/sorbet/rbi/gems/tapioca@0.11.8.rbi +0 -3349
  39. data/sorbet/rbi/gems/thor@1.2.2.rbi +0 -3965
  40. data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +0 -65
  41. data/sorbet/rbi/gems/unparser@0.6.8.rbi +0 -4525
  42. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +0 -428
  43. data/sorbet/rbi/gems/yard@0.9.34.rbi +0 -18219
  44. data/sorbet/rbi/gems/yarp@0.11.0.rbi +0 -15141
  45. data/sorbet/rbi/shims/uri.rbi +0 -14
  46. data/sorbet/tapioca/config.yml +0 -13
  47. data/sorbet/tapioca/require.rb +0 -8
@@ -1,2903 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `ruby-lsp` gem.
5
- # Please instead update this file by running `bin/tapioca gem ruby-lsp`.
6
-
7
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#4
8
- module RubyIndexer
9
- class << self
10
- # source://ruby-lsp/lib/ruby_indexer/ruby_indexer.rb#18
11
- sig { returns(::RubyIndexer::Configuration) }
12
- def configuration; end
13
- end
14
- end
15
-
16
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#5
17
- class RubyIndexer::Configuration
18
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#20
19
- sig { void }
20
- def initialize; end
21
-
22
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#65
23
- sig { returns(T::Array[::RubyIndexer::IndexablePath]) }
24
- def indexables; end
25
-
26
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#51
27
- sig { void }
28
- def load_config; end
29
-
30
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#148
31
- sig { returns(::Regexp) }
32
- def magic_comment_regex; end
33
-
34
- private
35
-
36
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#170
37
- sig { params(config: T::Hash[::String, T.untyped]).void }
38
- def apply_config(config); end
39
-
40
- # @raise [ArgumentError]
41
- #
42
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#155
43
- sig { params(config: T::Hash[::String, T.untyped]).void }
44
- def validate_config!(config); end
45
- end
46
-
47
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/configuration.rb#8
48
- RubyIndexer::Configuration::CONFIGURATION_SCHEMA = T.let(T.unsafe(nil), Hash)
49
-
50
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#5
51
- class RubyIndexer::Index
52
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#12
53
- sig { void }
54
- def initialize; end
55
-
56
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#63
57
- sig { params(entry: ::RubyIndexer::Index::Entry).void }
58
- def <<(entry); end
59
-
60
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#72
61
- sig { params(fully_qualified_name: ::String).returns(T.nilable(T::Array[::RubyIndexer::Index::Entry])) }
62
- def [](fully_qualified_name); end
63
-
64
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#35
65
- sig { params(indexable: ::RubyIndexer::IndexablePath).void }
66
- def delete(indexable); end
67
-
68
- # Fuzzy searches index entries based on Jaro-Winkler similarity. If no query is provided, all entries are returned
69
- #
70
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#108
71
- sig { params(query: T.nilable(::String)).returns(T::Array[::RubyIndexer::Index::Entry]) }
72
- def fuzzy_search(query); end
73
-
74
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#139
75
- sig { params(indexable_paths: T::Array[::RubyIndexer::IndexablePath]).void }
76
- def index_all(indexable_paths: T.unsafe(nil)); end
77
-
78
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#144
79
- sig { params(indexable_path: ::RubyIndexer::IndexablePath, source: T.nilable(::String)).void }
80
- def index_single(indexable_path, source = T.unsafe(nil)); end
81
-
82
- # Searches entries in the index based on an exact prefix, intended for providing autocomplete. All possible matches
83
- # to the prefix are returned. The return is an array of arrays, where each entry is the array of entries for a given
84
- # name match. For example:
85
- # ## Example
86
- # ```ruby
87
- # # If the index has two entries for `Foo::Bar` and one for `Foo::Baz`, then:
88
- # index.prefix_search("Foo::B")
89
- # # Will return:
90
- # [
91
- # [#<Entry::Class name="Foo::Bar">, #<Entry::Class name="Foo::Bar">],
92
- # [#<Entry::Class name="Foo::Baz">],
93
- # ]
94
- # ```
95
- #
96
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#95
97
- sig { params(query: ::String, nesting: T::Array[::String]).returns(T::Array[T::Array[::RubyIndexer::Index::Entry]]) }
98
- def prefix_search(query, nesting); end
99
-
100
- # Try to find the entry based on the nesting from the most specific to the least specific. For example, if we have
101
- # the nesting as ["Foo", "Bar"] and the name as "Baz", we will try to find it in this order:
102
- # 1. Foo::Bar::Baz
103
- # 2. Foo::Baz
104
- # 3. Baz
105
- #
106
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#127
107
- sig { params(name: ::String, nesting: T::Array[::String]).returns(T.nilable(T::Array[::RubyIndexer::Index::Entry])) }
108
- def resolve(name, nesting); end
109
-
110
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#77
111
- sig { params(query: ::String).returns(T::Array[::RubyIndexer::IndexablePath]) }
112
- def search_require_paths(query); end
113
- end
114
-
115
- # The minimum Jaro-Winkler similarity score for an entry to be considered a match for a given fuzzy search query
116
- #
117
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#9
118
- RubyIndexer::Index::ENTRY_SIMILARITY_THRESHOLD = T.let(T.unsafe(nil), Float)
119
-
120
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#155
121
- class RubyIndexer::Index::Entry
122
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#171
123
- sig { params(name: ::String, file_path: ::String, location: ::YARP::Location, comments: T::Array[::String]).void }
124
- def initialize(name, file_path, location, comments); end
125
-
126
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#168
127
- sig { returns(T::Array[::String]) }
128
- def comments; end
129
-
130
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#179
131
- sig { returns(::String) }
132
- def file_name; end
133
-
134
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#162
135
- sig { returns(::String) }
136
- def file_path; end
137
-
138
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#165
139
- sig { returns(::YARP::Location) }
140
- def location; end
141
-
142
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#159
143
- sig { returns(::String) }
144
- def name; end
145
- end
146
-
147
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#193
148
- class RubyIndexer::Index::Entry::Class < ::RubyIndexer::Index::Entry::Namespace; end
149
-
150
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#196
151
- class RubyIndexer::Index::Entry::Constant < ::RubyIndexer::Index::Entry; end
152
-
153
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#190
154
- class RubyIndexer::Index::Entry::Module < ::RubyIndexer::Index::Entry::Namespace; end
155
-
156
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#183
157
- class RubyIndexer::Index::Entry::Namespace < ::RubyIndexer::Index::Entry
158
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/index.rb#185
159
- sig { returns(::String) }
160
- def short_name; end
161
- end
162
-
163
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#5
164
- class RubyIndexer::IndexVisitor < ::YARP::Visitor
165
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#9
166
- sig { params(index: ::RubyIndexer::Index, parse_result: ::YARP::ParseResult, file_path: ::String).void }
167
- def initialize(index, parse_result, file_path); end
168
-
169
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#25
170
- sig { void }
171
- def run; end
172
-
173
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#30
174
- sig { params(node: T.nilable(::YARP::Node)).void }
175
- def visit(node); end
176
-
177
- # Override to avoid using `map` instead of `each`
178
- #
179
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#47
180
- sig { params(nodes: T::Array[T.nilable(::YARP::Node)]).void }
181
- def visit_all(nodes); end
182
-
183
- private
184
-
185
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#58
186
- sig { params(node: T.any(::YARP::ConstantOrWriteNode, ::YARP::ConstantWriteNode)).void }
187
- def add_constant(node); end
188
-
189
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#68
190
- sig { params(node: T.any(::YARP::ConstantPathOrWriteNode, ::YARP::ConstantPathWriteNode)).void }
191
- def add_constant_with_path(node); end
192
-
193
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#78
194
- sig { params(node: T.any(::YARP::ClassNode, ::YARP::ModuleNode), klass: T.class_of(RubyIndexer::Index::Entry)).void }
195
- def add_index_entry(node, klass); end
196
-
197
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#93
198
- sig { params(node: ::YARP::Node).returns(T::Array[::String]) }
199
- def collect_comments(node); end
200
-
201
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/visitor.rb#115
202
- sig { params(name: ::String).returns(::String) }
203
- def fully_qualify_name(name); end
204
- end
205
-
206
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#5
207
- class RubyIndexer::IndexablePath
208
- # An IndexablePath is instantiated with a load_path_entry and a full_path. The load_path_entry is where the file can
209
- # be found in the $LOAD_PATH, which we use to determine the require_path. The load_path_entry may be `nil` if the
210
- # indexer is configured to go through files that do not belong in the $LOAD_PATH. For example,
211
- # `sorbet/tapioca/require.rb` ends up being a part of the paths to be indexed because it's a Ruby file inside the
212
- # project, but the `sorbet` folder is not a part of the $LOAD_PATH. That means that both its load_path_entry and
213
- # require_path will be `nil`, since it cannot be required by the project
214
- #
215
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#21
216
- sig { params(load_path_entry: T.nilable(::String), full_path: ::String).void }
217
- def initialize(load_path_entry, full_path); end
218
-
219
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#12
220
- sig { returns(::String) }
221
- def full_path; end
222
-
223
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/indexable_path.rb#9
224
- sig { returns(T.nilable(::String)) }
225
- def require_path; end
226
- end
227
-
228
- # A PrefixTree is a data structure that allows searching for partial strings fast. The tree is similar to a nested
229
- # hash structure, where the keys are the characters of the inserted strings.
230
- #
231
- # ## Example
232
- # ```ruby
233
- # tree = PrefixTree[String].new
234
- # # Insert entries using the same key and value
235
- # tree.insert("bar", "bar")
236
- # tree.insert("baz", "baz")
237
- # # Internally, the structure is analogous to this, but using nodes:
238
- # # {
239
- # # "b" => {
240
- # # "a" => {
241
- # # "r" => "bar",
242
- # # "z" => "baz"
243
- # # }
244
- # # }
245
- # # }
246
- # # When we search it, it finds all possible values based on partial (or complete matches):
247
- # tree.search("") # => ["bar", "baz"]
248
- # tree.search("b") # => ["bar", "baz"]
249
- # tree.search("ba") # => ["bar", "baz"]
250
- # tree.search("bar") # => ["bar"]
251
- # ```
252
- #
253
- # A PrefixTree is useful for autocomplete, since we always want to find all alternatives while the developer hasn't
254
- # finished typing yet. This PrefixTree implementation allows for string keys and any arbitrary value using the generic
255
- # `Value` type.
256
- #
257
- # See https://en.wikipedia.org/wiki/Trie for more information
258
- #
259
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#35
260
- class RubyIndexer::PrefixTree
261
- extend T::Generic
262
-
263
- Value = type_member
264
-
265
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#42
266
- sig { void }
267
- def initialize; end
268
-
269
- # Deletes the entry identified by `key` from the tree. Notice that a partial match will still delete all entries
270
- # that match it. For example, if the tree contains `foo` and we ask to delete `fo`, then `foo` will be deleted
271
- #
272
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#77
273
- sig { params(key: ::String).void }
274
- def delete(key); end
275
-
276
- # Inserts a `value` using the given `key`
277
- #
278
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#60
279
- sig { params(key: ::String, value: Value).void }
280
- def insert(key, value); end
281
-
282
- # Search the PrefixTree based on a given `prefix`. If `foo` is an entry in the tree, then searching for `fo` will
283
- # return it as a result. The result is always an array of the type of value attribute to the generic `Value` type.
284
- # Notice that if the `Value` is an array, this method will return an array of arrays, where each entry is the array
285
- # of values for a given match
286
- #
287
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#51
288
- sig { params(prefix: ::String).returns(T::Array[Value]) }
289
- def search(prefix); end
290
-
291
- private
292
-
293
- # Find a node that matches the given `key`
294
- #
295
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#97
296
- sig { params(key: ::String).returns(T.nilable(RubyIndexer::PrefixTree::Node[Value])) }
297
- def find_node(key); end
298
- end
299
-
300
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#110
301
- class RubyIndexer::PrefixTree::Node
302
- extend T::Generic
303
-
304
- Value = type_member
305
-
306
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#132
307
- sig { params(key: ::String, value: Value, parent: T.nilable(RubyIndexer::PrefixTree::Node[Value])).void }
308
- def initialize(key, value, parent = T.unsafe(nil)); end
309
-
310
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#117
311
- sig { returns(T::Hash[::String, RubyIndexer::PrefixTree::Node[Value]]) }
312
- def children; end
313
-
314
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#141
315
- sig { returns(T::Array[Value]) }
316
- def collect; end
317
-
318
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#120
319
- sig { returns(::String) }
320
- def key; end
321
-
322
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#126
323
- sig { returns(T::Boolean) }
324
- def leaf; end
325
-
326
- # @return [Boolean]
327
- #
328
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#126
329
- def leaf=(_arg0); end
330
-
331
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#129
332
- sig { returns(T.nilable(RubyIndexer::PrefixTree::Node[Value])) }
333
- def parent; end
334
-
335
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#123
336
- sig { returns(Value) }
337
- def value; end
338
-
339
- # @return [Value]
340
- #
341
- # source://ruby-lsp/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb#123
342
- def value=(_arg0); end
343
- end
344
-
345
- # source://ruby-lsp/lib/ruby-lsp.rb#4
346
- module RubyLsp; end
347
-
348
- # source://ruby-lsp/lib/ruby_lsp/server.rb#7
349
- RubyLsp::Constant = LanguageServer::Protocol::Constant
350
-
351
- # source://ruby-lsp/lib/ruby_lsp/requests/support/dependency_detector.rb#5
352
- module RubyLsp::DependencyDetector
353
- class << self
354
- # source://ruby-lsp/lib/ruby_lsp/requests/support/dependency_detector.rb#10
355
- sig { returns(::String) }
356
- def detected_formatter; end
357
-
358
- # source://ruby-lsp/lib/ruby_lsp/requests/support/dependency_detector.rb#22
359
- sig { returns(::String) }
360
- def detected_test_library; end
361
-
362
- # source://ruby-lsp/lib/ruby_lsp/requests/support/dependency_detector.rb#45
363
- sig { params(gem_pattern: ::Regexp).returns(T::Boolean) }
364
- def direct_dependency?(gem_pattern); end
365
-
366
- # source://ruby-lsp/lib/ruby_lsp/requests/support/dependency_detector.rb#40
367
- sig { returns(T::Boolean) }
368
- def typechecker?; end
369
- end
370
- end
371
-
372
- # source://ruby-lsp/lib/ruby_lsp/requests/support/dependency_detector.rb#53
373
- RubyLsp::DependencyDetector::HAS_TYPECHECKER = T.let(T.unsafe(nil), TrueClass)
374
-
375
- # source://ruby-lsp/lib/ruby_lsp/document.rb#5
376
- class RubyLsp::Document
377
- # source://ruby-lsp/lib/ruby_lsp/document.rb#25
378
- sig { params(source: ::String, version: ::Integer, uri: ::URI::Generic, encoding: ::String).void }
379
- def initialize(source:, version:, uri:, encoding: T.unsafe(nil)); end
380
-
381
- # source://ruby-lsp/lib/ruby_lsp/document.rb#39
382
- sig { params(other: ::RubyLsp::Document).returns(T::Boolean) }
383
- def ==(other); end
384
-
385
- # TODO: remove this method once all nonpositional requests have been migrated to the listener pattern
386
- #
387
- # source://ruby-lsp/lib/ruby_lsp/document.rb#51
388
- sig do
389
- type_parameters(:T)
390
- .params(
391
- request_name: ::String,
392
- block: T.proc.params(document: ::RubyLsp::Document).returns(T.type_parameter(:T))
393
- ).returns(T.type_parameter(:T))
394
- end
395
- def cache_fetch(request_name, &block); end
396
-
397
- # source://ruby-lsp/lib/ruby_lsp/document.rb#66
398
- sig { params(request_name: ::String).returns(T.untyped) }
399
- def cache_get(request_name); end
400
-
401
- # source://ruby-lsp/lib/ruby_lsp/document.rb#61
402
- sig { type_parameters(:T).params(request_name: ::String, value: T.type_parameter(:T)).returns(T.type_parameter(:T)) }
403
- def cache_set(request_name, value); end
404
-
405
- # source://ruby-lsp/lib/ruby_lsp/document.rb#109
406
- sig { returns(::RubyLsp::Document::Scanner) }
407
- def create_scanner; end
408
-
409
- # source://ruby-lsp/lib/ruby_lsp/document.rb#132
410
- sig do
411
- params(
412
- node: ::SyntaxTree::Node,
413
- char_position: ::Integer,
414
- node_types: T::Array[T.class_of(SyntaxTree::Node)]
415
- ).returns([T.nilable(::SyntaxTree::Node), T.nilable(::SyntaxTree::Node), T::Array[::String]])
416
- end
417
- def locate(node, char_position, node_types: T.unsafe(nil)); end
418
-
419
- # source://ruby-lsp/lib/ruby_lsp/document.rb#119
420
- sig do
421
- params(
422
- position: {line: ::Integer, character: ::Integer},
423
- node_types: T::Array[T.class_of(SyntaxTree::Node)]
424
- ).returns([T.nilable(::SyntaxTree::Node), T.nilable(::SyntaxTree::Node), T::Array[::String]])
425
- end
426
- def locate_node(position, node_types: T.unsafe(nil)); end
427
-
428
- # source://ruby-lsp/lib/ruby_lsp/document.rb#88
429
- sig { void }
430
- def parse; end
431
-
432
- # source://ruby-lsp/lib/ruby_lsp/document.rb#104
433
- sig { returns(T::Boolean) }
434
- def parsed?; end
435
-
436
- # source://ruby-lsp/lib/ruby_lsp/document.rb#71
437
- sig do
438
- params(
439
- edits: T::Array[{range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}}, text: ::String}],
440
- version: ::Integer
441
- ).void
442
- end
443
- def push_edits(edits, version:); end
444
-
445
- # source://ruby-lsp/lib/ruby_lsp/document.rb#16
446
- sig { returns(::String) }
447
- def source; end
448
-
449
- # source://ruby-lsp/lib/ruby_lsp/document.rb#99
450
- sig { returns(T::Boolean) }
451
- def syntax_error?; end
452
-
453
- # source://ruby-lsp/lib/ruby_lsp/document.rb#13
454
- sig { returns(T.nilable(::SyntaxTree::Node)) }
455
- def tree; end
456
-
457
- # source://ruby-lsp/lib/ruby_lsp/document.rb#22
458
- sig { returns(::URI::Generic) }
459
- def uri; end
460
-
461
- # source://ruby-lsp/lib/ruby_lsp/document.rb#19
462
- sig { returns(::Integer) }
463
- def version; end
464
- end
465
-
466
- # source://ruby-lsp/lib/ruby_lsp/document.rb#10
467
- RubyLsp::Document::EditShape = T.type_alias { {range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}}, text: ::String} }
468
-
469
- # source://ruby-lsp/lib/ruby_lsp/document.rb#8
470
- RubyLsp::Document::PositionShape = T.type_alias { {line: ::Integer, character: ::Integer} }
471
-
472
- # source://ruby-lsp/lib/ruby_lsp/document.rb#9
473
- RubyLsp::Document::RangeShape = T.type_alias { {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}} }
474
-
475
- # source://ruby-lsp/lib/ruby_lsp/document.rb#182
476
- class RubyLsp::Document::Scanner
477
- # source://ruby-lsp/lib/ruby_lsp/document.rb#190
478
- sig { params(source: ::String, encoding: ::String).void }
479
- def initialize(source, encoding); end
480
-
481
- # Finds the character index inside the source string for a given line and column
482
- #
483
- # source://ruby-lsp/lib/ruby_lsp/document.rb#199
484
- sig { params(position: {line: ::Integer, character: ::Integer}).returns(::Integer) }
485
- def find_char_position(position); end
486
-
487
- # Subtract 1 for each character after 0xFFFF in the current line from the column position, so that we hit the
488
- # right character in the UTF-8 representation
489
- #
490
- # source://ruby-lsp/lib/ruby_lsp/document.rb#221
491
- sig { params(current_position: ::Integer, requested_position: ::Integer).returns(::Integer) }
492
- def utf_16_character_position_correction(current_position, requested_position); end
493
- end
494
-
495
- # source://ruby-lsp/lib/ruby_lsp/document.rb#185
496
- RubyLsp::Document::Scanner::LINE_BREAK = T.let(T.unsafe(nil), Integer)
497
-
498
- # After character 0xFFFF, UTF-16 considers characters to have length 2 and we have to account for that
499
- #
500
- # source://ruby-lsp/lib/ruby_lsp/document.rb#187
501
- RubyLsp::Document::Scanner::SURROGATE_PAIR_START = T.let(T.unsafe(nil), Integer)
502
-
503
- # EventEmitter is an intermediary between our requests and Syntax Tree visitors. It's used to visit the document's AST
504
- # and emit events that the requests can listen to for providing functionality. Usages:
505
- #
506
- # - For positional requests, locate the target node and use `emit_for_target` to fire events for each listener
507
- # - For nonpositional requests, use `visit` to go through the AST, which will fire events for each listener as nodes
508
- # are found
509
- #
510
- # # Example
511
- #
512
- # ```ruby
513
- # target_node = document.locate_node(position)
514
- # emitter = EventEmitter.new
515
- # listener = Requests::Hover.new(emitter, @message_queue)
516
- # emitter.emit_for_target(target_node)
517
- # listener.response
518
- # ```
519
- #
520
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#21
521
- class RubyLsp::EventEmitter < ::SyntaxTree::Visitor
522
- include ::SyntaxTree::WithScope
523
-
524
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#26
525
- sig { void }
526
- def initialize; end
527
-
528
- # Emit events for a specific node. This is similar to the regular `visit` method, but avoids going deeper into the
529
- # tree for performance
530
- #
531
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#39
532
- sig { params(node: T.nilable(::SyntaxTree::Node)).void }
533
- def emit_for_target(node); end
534
-
535
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#32
536
- sig { params(listener: RubyLsp::Listener[T.untyped], events: ::Symbol).void }
537
- def register(listener, *events); end
538
-
539
- # Visit dispatchers are below. Notice that for nodes that create a new scope (e.g.: classes, modules, method defs)
540
- # we need both an `on_*` and `after_*` event. This is because some requests must know when we exit the scope
541
- #
542
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#59
543
- sig { override.params(node: T.nilable(::SyntaxTree::Node)).void }
544
- def visit(node); end
545
-
546
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#178
547
- sig { override.params(node: ::SyntaxTree::Binary).void }
548
- def visit_binary(node); end
549
-
550
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#166
551
- sig { override.params(node: ::SyntaxTree::BlockVar).void }
552
- def visit_block_var(node); end
553
-
554
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#92
555
- sig { override.params(node: ::SyntaxTree::CallNode).void }
556
- def visit_call(node); end
557
-
558
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#65
559
- sig { override.params(node: ::SyntaxTree::ClassDeclaration).void }
560
- def visit_class(node); end
561
-
562
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#79
563
- sig { override.params(node: ::SyntaxTree::Command).void }
564
- def visit_command(node); end
565
-
566
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#86
567
- sig { override.params(node: ::SyntaxTree::CommandCall).void }
568
- def visit_command_call(node); end
569
-
570
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#130
571
- sig { override.params(node: ::SyntaxTree::Comment).void }
572
- def visit_comment(node); end
573
-
574
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#184
575
- sig { override.params(node: ::SyntaxTree::Const).void }
576
- def visit_const(node); end
577
-
578
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#105
579
- sig { override.params(node: ::SyntaxTree::ConstPathField).void }
580
- def visit_const_path_field(node); end
581
-
582
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#117
583
- sig { override.params(node: ::SyntaxTree::DefNode).void }
584
- def visit_def(node); end
585
-
586
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#154
587
- sig { override.params(node: ::SyntaxTree::Field).void }
588
- def visit_field(node); end
589
-
590
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#142
591
- sig { override.params(node: ::SyntaxTree::Kw).void }
592
- def visit_kw(node); end
593
-
594
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#172
595
- sig { override.params(node: ::SyntaxTree::LambdaVar).void }
596
- def visit_lambda_var(node); end
597
-
598
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#72
599
- sig { override.params(node: ::SyntaxTree::ModuleDeclaration).void }
600
- def visit_module(node); end
601
-
602
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#148
603
- sig { override.params(node: ::SyntaxTree::Params).void }
604
- def visit_params(node); end
605
-
606
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#136
607
- sig { override.params(node: ::SyntaxTree::Rescue).void }
608
- def visit_rescue(node); end
609
-
610
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#111
611
- sig { override.params(node: ::SyntaxTree::TopConstField).void }
612
- def visit_top_const_field(node); end
613
-
614
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#124
615
- sig { override.params(node: ::SyntaxTree::VarField).void }
616
- def visit_var_field(node); end
617
-
618
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#160
619
- sig { override.params(node: ::SyntaxTree::VarRef).void }
620
- def visit_var_ref(node); end
621
-
622
- # source://ruby-lsp/lib/ruby_lsp/event_emitter.rb#99
623
- sig { override.params(node: ::SyntaxTree::VCall).void }
624
- def visit_vcall(node); end
625
- end
626
-
627
- # This class dispatches a request execution to the right request class. No IO should happen anywhere here!
628
- #
629
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#8
630
- class RubyLsp::Executor
631
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#12
632
- sig { params(store: ::RubyLsp::Store, message_queue: ::Thread::Queue).void }
633
- def initialize(store, message_queue); end
634
-
635
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#22
636
- sig { params(request: T::Hash[::Symbol, T.untyped]).returns(::RubyLsp::Result) }
637
- def execute(request); end
638
-
639
- private
640
-
641
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#527
642
- sig { params(id: ::String, title: ::String).void }
643
- def begin_progress(id, title); end
644
-
645
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#721
646
- sig { void }
647
- def check_formatter_is_available; end
648
-
649
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#404
650
- sig do
651
- params(
652
- uri: ::URI::Generic,
653
- range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}},
654
- context: T::Hash[::Symbol, T.untyped]
655
- ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::CodeAction]))
656
- end
657
- def code_action(uri, range, context); end
658
-
659
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#411
660
- sig { params(params: T::Hash[::Symbol, T.untyped]).returns(::LanguageServer::Protocol::Interface::CodeAction) }
661
- def code_action_resolve(params); end
662
-
663
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#472
664
- sig do
665
- params(
666
- uri: ::URI::Generic,
667
- position: {line: ::Integer, character: ::Integer}
668
- ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::CompletionItem]))
669
- end
670
- def completion(uri, position); end
671
-
672
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#247
673
- sig do
674
- params(
675
- uri: ::URI::Generic,
676
- position: {line: ::Integer, character: ::Integer}
677
- ).returns(T.nilable(T.any(::LanguageServer::Protocol::Interface::Location, T::Array[::LanguageServer::Protocol::Interface::Location])))
678
- end
679
- def definition(uri, position); end
680
-
681
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#441
682
- sig do
683
- params(
684
- uri: ::URI::Generic
685
- ).returns(T.nilable(::LanguageServer::Protocol::Interface::FullDocumentDiagnosticReport))
686
- end
687
- def diagnostic(uri); end
688
-
689
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#184
690
- sig { params(changes: T::Array[{uri: ::String, type: ::Integer}]).returns(::Object) }
691
- def did_change_watched_files(changes); end
692
-
693
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#372
694
- sig do
695
- params(
696
- uri: ::URI::Generic,
697
- position: {line: ::Integer, character: ::Integer}
698
- ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::DocumentHighlight]))
699
- end
700
- def document_highlight(uri, position); end
701
-
702
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#545
703
- sig { params(id: ::String).void }
704
- def end_progress(id); end
705
-
706
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#265
707
- sig { params(uri: ::URI::Generic).returns(T::Array[::LanguageServer::Protocol::Interface::FoldingRange]) }
708
- def folding_range(uri); end
709
-
710
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#348
711
- sig { params(uri: ::URI::Generic).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::TextEdit])) }
712
- def formatting(uri); end
713
-
714
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#277
715
- sig do
716
- params(
717
- uri: ::URI::Generic,
718
- position: {line: ::Integer, character: ::Integer}
719
- ).returns(T.nilable(::LanguageServer::Protocol::Interface::Hover))
720
- end
721
- def hover(uri, position); end
722
-
723
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#558
724
- sig do
725
- params(
726
- options: T::Hash[::Symbol, T.untyped]
727
- ).returns(::LanguageServer::Protocol::Interface::InitializeResult)
728
- end
729
- def initialize_request(options); end
730
-
731
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#384
732
- sig do
733
- params(
734
- uri: ::URI::Generic,
735
- range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}}
736
- ).returns(T.nilable(T::Array[::LanguageServer::Protocol::Interface::InlayHint]))
737
- end
738
- def inlay_hint(uri, range); end
739
-
740
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#362
741
- sig do
742
- params(
743
- uri: ::URI::Generic,
744
- position: {line: ::Integer, character: ::Integer},
745
- character: ::String
746
- ).returns(T::Array[::LanguageServer::Protocol::Interface::TextEdit])
747
- end
748
- def on_type_formatting(uri, position, character); end
749
-
750
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#209
751
- sig { void }
752
- def perform_initial_indexing; end
753
-
754
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#38
755
- sig { params(request: T::Hash[::Symbol, T.untyped]).returns(T.untyped) }
756
- def run(request); end
757
-
758
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#328
759
- sig do
760
- params(
761
- uri: ::URI::Generic,
762
- positions: T::Array[{line: ::Integer, character: ::Integer}]
763
- ).returns(T.nilable(T::Array[T.nilable(::RubyLsp::Requests::Support::SelectionRange)]))
764
- end
765
- def selection_range(uri, positions); end
766
-
767
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#450
768
- sig do
769
- params(
770
- uri: ::URI::Generic,
771
- range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}}
772
- ).returns(::LanguageServer::Protocol::Interface::SemanticTokens)
773
- end
774
- def semantic_tokens_range(uri, range); end
775
-
776
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#237
777
- sig do
778
- params(
779
- uri: ::URI::Generic,
780
- range: T.nilable({start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}})
781
- ).returns({ast: ::String})
782
- end
783
- def show_syntax_tree(uri, range); end
784
-
785
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#305
786
- sig do
787
- params(
788
- uri: ::URI::Generic,
789
- content_changes: T::Array[{range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}}, text: ::String}],
790
- version: ::Integer
791
- ).returns(::Object)
792
- end
793
- def text_document_did_change(uri, content_changes, version); end
794
-
795
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#317
796
- sig { params(uri: ::URI::Generic).returns(::Object) }
797
- def text_document_did_close(uri); end
798
-
799
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#311
800
- sig { params(uri: ::URI::Generic, text: ::String, version: ::Integer).returns(::Object) }
801
- def text_document_did_open(uri, text, version); end
802
-
803
- # source://ruby-lsp/lib/ruby_lsp/executor.rb#232
804
- sig { params(query: T.nilable(::String)).returns(T::Array[::LanguageServer::Protocol::Interface::WorkspaceSymbol]) }
805
- def workspace_symbol(query); end
806
- end
807
-
808
- # ExtensibleListener is an abstract class to be used by requests that accept extensions.
809
- #
810
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
811
- #
812
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#35
813
- class RubyLsp::ExtensibleListener < ::RubyLsp::Listener
814
- extend T::Generic
815
-
816
- abstract!
817
-
818
- ResponseType = type_member
819
-
820
- # When inheriting from ExtensibleListener, the `super` of constructor must be called **after** the subclass's own
821
- # ivars have been initialized. This is because the constructor of ExtensibleListener calls
822
- # `initialize_external_listener` which may depend on the subclass's ivars.
823
- #
824
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#47
825
- sig { params(emitter: ::RubyLsp::EventEmitter, message_queue: ::Thread::Queue).void }
826
- def initialize(emitter, message_queue); end
827
-
828
- # @abstract
829
- #
830
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#74
831
- sig { abstract.params(extension: ::RubyLsp::Extension).returns(T.nilable(RubyLsp::Listener[ResponseType])) }
832
- def initialize_external_listener(extension); end
833
-
834
- # Merge responses from all external listeners into the base listener's response. We do this to return a single
835
- # response to the editor including the results of all extensions
836
- #
837
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#61
838
- sig { void }
839
- def merge_external_listeners_responses!; end
840
-
841
- # Does nothing by default. Requests that accept extensions should override this method to define how to merge
842
- # responses coming from external listeners
843
- #
844
- # @abstract
845
- #
846
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#79
847
- sig { abstract.params(other: RubyLsp::Listener[T.untyped]).returns(T.self_type) }
848
- def merge_response!(other); end
849
-
850
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#66
851
- sig { returns(ResponseType) }
852
- def response; end
853
- end
854
-
855
- # To register an extension, inherit from this class and implement both `name` and `activate`
856
- #
857
- # # Example
858
- #
859
- # ```ruby
860
- # module MyGem
861
- # class MyExtension < Extension
862
- # def activate
863
- # # Perform any relevant initialization
864
- # end
865
- #
866
- # def name
867
- # "My extension name"
868
- # end
869
- # end
870
- # end
871
- # ```
872
- #
873
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
874
- #
875
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#22
876
- class RubyLsp::Extension
877
- abstract!
878
-
879
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#67
880
- sig { void }
881
- def initialize; end
882
-
883
- # Each extension should implement `MyExtension#activate` and use to perform any sort of initialization, such as
884
- # reading information into memory or even spawning a separate process
885
- #
886
- # @abstract
887
- #
888
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#98
889
- sig { abstract.void }
890
- def activate; end
891
-
892
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#72
893
- sig { params(error: ::StandardError).returns(T.self_type) }
894
- def add_error(error); end
895
-
896
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#91
897
- sig { returns(::String) }
898
- def backtraces; end
899
-
900
- # Creates a new CodeLens listener. This method is invoked on every CodeLens request
901
- #
902
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#117
903
- sig do
904
- overridable
905
- .params(
906
- uri: ::URI::Generic,
907
- emitter: ::RubyLsp::EventEmitter,
908
- message_queue: ::Thread::Queue
909
- ).returns(T.nilable(RubyLsp::Listener[T::Array[::LanguageServer::Protocol::Interface::CodeLens]]))
910
- end
911
- def create_code_lens_listener(uri, emitter, message_queue); end
912
-
913
- # Creates a new Definition listener. This method is invoked on every Definition request
914
- #
915
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#147
916
- sig do
917
- overridable
918
- .params(
919
- uri: ::URI::Generic,
920
- nesting: T::Array[::String],
921
- index: ::RubyIndexer::Index,
922
- emitter: ::RubyLsp::EventEmitter,
923
- message_queue: ::Thread::Queue
924
- ).returns(T.nilable(RubyLsp::Listener[T.nilable(T.any(::LanguageServer::Protocol::Interface::Location, T::Array[::LanguageServer::Protocol::Interface::Location]))]))
925
- end
926
- def create_definition_listener(uri, nesting, index, emitter, message_queue); end
927
-
928
- # Creates a new DocumentSymbol listener. This method is invoked on every DocumentSymbol request
929
- #
930
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#135
931
- sig do
932
- overridable
933
- .params(
934
- emitter: ::RubyLsp::EventEmitter,
935
- message_queue: ::Thread::Queue
936
- ).returns(T.nilable(RubyLsp::Listener[T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol]]))
937
- end
938
- def create_document_symbol_listener(emitter, message_queue); end
939
-
940
- # Creates a new Hover listener. This method is invoked on every Hover request
941
- #
942
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#126
943
- sig do
944
- overridable
945
- .params(
946
- emitter: ::RubyLsp::EventEmitter,
947
- message_queue: ::Thread::Queue
948
- ).returns(T.nilable(RubyLsp::Listener[T.nilable(::LanguageServer::Protocol::Interface::Hover)]))
949
- end
950
- def create_hover_listener(emitter, message_queue); end
951
-
952
- # Each extension should implement `MyExtension#deactivate` and use to perform any clean up, like shutting down a
953
- # child process
954
- #
955
- # @abstract
956
- #
957
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#103
958
- sig { abstract.void }
959
- def deactivate; end
960
-
961
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#78
962
- sig { returns(T::Boolean) }
963
- def error?; end
964
-
965
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#83
966
- sig { returns(::String) }
967
- def formatted_errors; end
968
-
969
- # Extensions should override the `name` method to return the extension name
970
- #
971
- # @abstract
972
- #
973
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#107
974
- sig { abstract.returns(::String) }
975
- def name; end
976
-
977
- class << self
978
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#39
979
- sig { returns(T::Array[::RubyLsp::Extension]) }
980
- def extensions; end
981
-
982
- # Automatically track and instantiate extension classes
983
- #
984
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#33
985
- sig { params(child_class: T.class_of(RubyLsp::Extension)).void }
986
- def inherited(child_class); end
987
-
988
- # Discovers and loads all extensions. Returns the list of activated extensions
989
- #
990
- # source://ruby-lsp/lib/ruby_lsp/extension.rb#45
991
- sig { returns(T::Array[::RubyLsp::Extension]) }
992
- def load_extensions; end
993
- end
994
- end
995
-
996
- # source://ruby-lsp/lib/ruby_lsp/server.rb#6
997
- RubyLsp::Interface = LanguageServer::Protocol::Interface
998
-
999
- # A request that will sit in the queue until it's executed
1000
- #
1001
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#62
1002
- class RubyLsp::Job
1003
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#72
1004
- sig { params(request: T::Hash[::Symbol, T.untyped], cancelled: T::Boolean).void }
1005
- def initialize(request:, cancelled:); end
1006
-
1007
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#78
1008
- sig { void }
1009
- def cancel; end
1010
-
1011
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#69
1012
- sig { returns(T::Boolean) }
1013
- def cancelled; end
1014
-
1015
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#66
1016
- sig { returns(T::Hash[::Symbol, T.untyped]) }
1017
- def request; end
1018
- end
1019
-
1020
- # Listener is an abstract class to be used by requests for listening to events emitted when visiting an AST using the
1021
- # EventEmitter.
1022
- #
1023
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
1024
- #
1025
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#7
1026
- class RubyLsp::Listener
1027
- extend T::Generic
1028
- include ::RubyLsp::Requests::Support::Common
1029
-
1030
- abstract!
1031
-
1032
- ResponseType = type_member
1033
-
1034
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#18
1035
- sig { params(emitter: ::RubyLsp::EventEmitter, message_queue: ::Thread::Queue).void }
1036
- def initialize(emitter, message_queue); end
1037
-
1038
- # Override this method with an attr_reader that returns the response of your listener. The listener should
1039
- # accumulate results in a @response variable and then provide the reader so that it is accessible
1040
- #
1041
- # @abstract
1042
- #
1043
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#31
1044
- sig { abstract.returns(ResponseType) }
1045
- def _response; end
1046
-
1047
- # source://ruby-lsp/lib/ruby_lsp/listener.rb#24
1048
- sig { returns(ResponseType) }
1049
- def response; end
1050
- end
1051
-
1052
- # A notification to be sent to the client
1053
- #
1054
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
1055
- #
1056
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#12
1057
- class RubyLsp::Message
1058
- abstract!
1059
-
1060
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#25
1061
- sig { params(message: ::String, params: ::Object).void }
1062
- def initialize(message:, params:); end
1063
-
1064
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#19
1065
- sig { returns(::String) }
1066
- def message; end
1067
-
1068
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#22
1069
- sig { returns(::Object) }
1070
- def params; end
1071
- end
1072
-
1073
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#31
1074
- class RubyLsp::Notification < ::RubyLsp::Message; end
1075
-
1076
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#32
1077
- class RubyLsp::Request < ::RubyLsp::Message; end
1078
-
1079
- # Supported features
1080
- #
1081
- # - [DocumentSymbol](rdoc-ref:RubyLsp::Requests::DocumentSymbol)
1082
- # - [DocumentLink](rdoc-ref:RubyLsp::Requests::DocumentLink)
1083
- # - [Hover](rdoc-ref:RubyLsp::Requests::Hover)
1084
- # - [FoldingRange](rdoc-ref:RubyLsp::Requests::FoldingRanges)
1085
- # - [SelectionRange](rdoc-ref:RubyLsp::Requests::SelectionRanges)
1086
- # - [SemanticHighlighting](rdoc-ref:RubyLsp::Requests::SemanticHighlighting)
1087
- # - [Formatting](rdoc-ref:RubyLsp::Requests::Formatting)
1088
- # - [OnTypeFormatting](rdoc-ref:RubyLsp::Requests::OnTypeFormatting)
1089
- # - [Diagnostic](rdoc-ref:RubyLsp::Requests::Diagnostics)
1090
- # - [CodeAction](rdoc-ref:RubyLsp::Requests::CodeActions)
1091
- # - [CodeActionResolve](rdoc-ref:RubyLsp::Requests::CodeActionResolve)
1092
- # - [DocumentHighlight](rdoc-ref:RubyLsp::Requests::DocumentHighlight)
1093
- # - [InlayHint](rdoc-ref:RubyLsp::Requests::InlayHints)
1094
- # - [Completion](rdoc-ref:RubyLsp::Requests::Completion)
1095
- # - [CodeLens](rdoc-ref:RubyLsp::Requests::CodeLens)
1096
- # - [Definition](rdoc-ref:RubyLsp::Requests::Definition)
1097
- # - [ShowSyntaxTree](rdoc-ref:RubyLsp::Requests::ShowSyntaxTree)
1098
- # - [WorkspaceSymbol](rdoc-ref:RubyLsp::Requests::WorkspaceSymbol)
1099
- #
1100
- # source://ruby-lsp/lib/ruby_lsp/requests.rb#26
1101
- module RubyLsp::Requests; end
1102
-
1103
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
1104
- #
1105
- # source://ruby-lsp/lib/ruby_lsp/requests/base_request.rb#7
1106
- class RubyLsp::Requests::BaseRequest < ::SyntaxTree::Visitor
1107
- include ::RubyLsp::Requests::Support::Common
1108
-
1109
- abstract!
1110
-
1111
- # source://ruby-lsp/lib/ruby_lsp/requests/base_request.rb#15
1112
- sig { params(document: ::RubyLsp::Document).void }
1113
- def initialize(document); end
1114
-
1115
- # @abstract
1116
- #
1117
- # source://ruby-lsp/lib/ruby_lsp/requests/base_request.rb#21
1118
- sig { abstract.returns(::Object) }
1119
- def run; end
1120
-
1121
- # Syntax Tree implements `visit_all` using `map` instead of `each` for users who want to use the pattern
1122
- # `result = visitor.visit(tree)`. However, we don't use that pattern and should avoid producing a new array for
1123
- # every single node visited
1124
- #
1125
- # source://ruby-lsp/lib/ruby_lsp/requests/base_request.rb#27
1126
- sig { params(nodes: T::Array[T.nilable(::SyntaxTree::Node)]).void }
1127
- def visit_all(nodes); end
1128
- end
1129
-
1130
- # ![Code action resolve demo](../../code_action_resolve.gif)
1131
- #
1132
- # The [code action resolve](https://microsoft.github.io/language-server-protocol/specification#codeAction_resolve)
1133
- # request is used to to resolve the edit field for a given code action, if it is not already provided in the
1134
- # textDocument/codeAction response. We can use it for scenarios that require more computation such as refactoring.
1135
- #
1136
- # # Example: Extract to variable
1137
- #
1138
- # ```ruby
1139
- # # Before:
1140
- # 1 + 1 # Select the text and use Refactor: Extract Variable
1141
- #
1142
- # # After:
1143
- # new_variable = 1 + 1
1144
- # new_variable
1145
- #
1146
- # ```
1147
- #
1148
- # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#24
1149
- class RubyLsp::Requests::CodeActionResolve < ::RubyLsp::Requests::BaseRequest
1150
- # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#38
1151
- sig { params(document: ::RubyLsp::Document, code_action: T::Hash[::Symbol, T.untyped]).void }
1152
- def initialize(document, code_action); end
1153
-
1154
- # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#45
1155
- sig do
1156
- override
1157
- .returns(T.any(::LanguageServer::Protocol::Interface::CodeAction, ::RubyLsp::Requests::CodeActionResolve::Error))
1158
- end
1159
- def run; end
1160
-
1161
- private
1162
-
1163
- # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#137
1164
- sig do
1165
- params(
1166
- range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}},
1167
- new_text: ::String
1168
- ).returns(::LanguageServer::Protocol::Interface::TextEdit)
1169
- end
1170
- def create_text_edit(range, new_text); end
1171
- end
1172
-
1173
- # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#28
1174
- class RubyLsp::Requests::CodeActionResolve::CodeActionError < ::StandardError; end
1175
-
1176
- # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#30
1177
- class RubyLsp::Requests::CodeActionResolve::Error < ::T::Enum
1178
- enums do
1179
- EmptySelection = new
1180
- InvalidTargetRange = new
1181
- end
1182
- end
1183
-
1184
- # source://ruby-lsp/lib/ruby_lsp/requests/code_action_resolve.rb#26
1185
- RubyLsp::Requests::CodeActionResolve::NEW_VARIABLE_NAME = T.let(T.unsafe(nil), String)
1186
-
1187
- # ![Code actions demo](../../code_actions.gif)
1188
- #
1189
- # The [code actions](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeAction)
1190
- # request informs the editor of RuboCop quick fixes that can be applied. These are accessible by hovering over a
1191
- # specific diagnostic.
1192
- #
1193
- # # Example
1194
- #
1195
- # ```ruby
1196
- # def say_hello
1197
- # puts "Hello" # --> code action: quick fix indentation
1198
- # end
1199
- # ```
1200
- #
1201
- # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#19
1202
- class RubyLsp::Requests::CodeActions < ::RubyLsp::Requests::BaseRequest
1203
- # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#29
1204
- sig do
1205
- params(
1206
- document: ::RubyLsp::Document,
1207
- range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}},
1208
- context: T::Hash[::Symbol, T.untyped]
1209
- ).void
1210
- end
1211
- def initialize(document, range, context); end
1212
-
1213
- # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#38
1214
- sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::CodeAction]))) }
1215
- def run; end
1216
-
1217
- private
1218
-
1219
- # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#59
1220
- sig do
1221
- params(
1222
- range: T.nilable({start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}})
1223
- ).returns(T::Boolean)
1224
- end
1225
- def cover?(range); end
1226
-
1227
- # source://ruby-lsp/lib/ruby_lsp/requests/code_actions.rb#67
1228
- sig do
1229
- params(
1230
- range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}},
1231
- uri: ::URI::Generic
1232
- ).returns(::LanguageServer::Protocol::Interface::CodeAction)
1233
- end
1234
- def refactor_code_action(range, uri); end
1235
- end
1236
-
1237
- # ![Code lens demo](../../code_lens.gif)
1238
- #
1239
- # The
1240
- # [code lens](https://microsoft.github.io/language-server-protocol/specification#textDocument_codeLens)
1241
- # request informs the editor of runnable commands such as tests
1242
- #
1243
- # # Example
1244
- #
1245
- # ```ruby
1246
- # # Run
1247
- # class Test < Minitest::Test
1248
- # end
1249
- # ```
1250
- #
1251
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#21
1252
- class RubyLsp::Requests::CodeLens < ::RubyLsp::ExtensibleListener
1253
- extend T::Generic
1254
-
1255
- ResponseType = type_member { { fixed: T::Array[::LanguageServer::Protocol::Interface::CodeLens] } }
1256
-
1257
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#35
1258
- sig do
1259
- params(
1260
- uri: ::URI::Generic,
1261
- emitter: ::RubyLsp::EventEmitter,
1262
- message_queue: ::Thread::Queue,
1263
- test_library: ::String
1264
- ).void
1265
- end
1266
- def initialize(uri, emitter, message_queue, test_library); end
1267
-
1268
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#32
1269
- sig { override.returns(ResponseType) }
1270
- def _response; end
1271
-
1272
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#134
1273
- sig { params(node: ::SyntaxTree::CallNode).void }
1274
- def after_call(node); end
1275
-
1276
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#76
1277
- sig { params(node: ::SyntaxTree::ClassDeclaration).void }
1278
- def after_class(node); end
1279
-
1280
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#115
1281
- sig { params(node: ::SyntaxTree::Command).void }
1282
- def after_command(node); end
1283
-
1284
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#150
1285
- sig { override.params(extension: ::RubyLsp::Extension).returns(T.nilable(RubyLsp::Listener[ResponseType])) }
1286
- def initialize_external_listener(extension); end
1287
-
1288
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#155
1289
- sig { override.params(other: RubyLsp::Listener[ResponseType]).returns(T.self_type) }
1290
- def merge_response!(other); end
1291
-
1292
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#121
1293
- sig { params(node: ::SyntaxTree::CallNode).void }
1294
- def on_call(node); end
1295
-
1296
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#60
1297
- sig { params(node: ::SyntaxTree::ClassDeclaration).void }
1298
- def on_class(node); end
1299
-
1300
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#101
1301
- sig { params(node: ::SyntaxTree::Command).void }
1302
- def on_command(node); end
1303
-
1304
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#82
1305
- sig { params(node: ::SyntaxTree::DefNode).void }
1306
- def on_def(node); end
1307
-
1308
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#140
1309
- sig { params(node: ::SyntaxTree::VCall).void }
1310
- def on_vcall(node); end
1311
-
1312
- private
1313
-
1314
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#243
1315
- sig { params(node: ::SyntaxTree::Command, remote: ::String).void }
1316
- def add_open_gem_remote_code_lens(node, remote); end
1317
-
1318
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#163
1319
- sig { params(node: ::SyntaxTree::Node, name: ::String, command: ::String, kind: ::Symbol).void }
1320
- def add_test_code_lens(node, name:, command:, kind:); end
1321
-
1322
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#221
1323
- sig { params(class_name: ::String, method_name: T.nilable(::String)).returns(::String) }
1324
- def generate_test_command(class_name:, method_name: T.unsafe(nil)); end
1325
-
1326
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#205
1327
- sig { params(node: ::SyntaxTree::Command).returns(T.nilable(::String)) }
1328
- def resolve_gem_remote(node); end
1329
- end
1330
-
1331
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#28
1332
- RubyLsp::Requests::CodeLens::ACCESS_MODIFIERS = T.let(T.unsafe(nil), Array)
1333
-
1334
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#27
1335
- RubyLsp::Requests::CodeLens::BASE_COMMAND = T.let(T.unsafe(nil), String)
1336
-
1337
- # source://ruby-lsp/lib/ruby_lsp/requests/code_lens.rb#29
1338
- RubyLsp::Requests::CodeLens::SUPPORTED_TEST_LIBRARIES = T.let(T.unsafe(nil), Array)
1339
-
1340
- # ![Completion demo](../../completion.gif)
1341
- #
1342
- # The [completion](https://microsoft.github.io/language-server-protocol/specification#textDocument_completion)
1343
- # suggests possible completions according to what the developer is typing. Currently, completion is support for
1344
- # - require paths
1345
- # - classes, modules and constant names
1346
- #
1347
- # # Example
1348
- #
1349
- # ```ruby
1350
- # require "ruby_lsp/requests" # --> completion: suggests `base_request`, `code_actions`, ...
1351
- #
1352
- # RubyLsp::Requests:: # --> completion: suggests `Completion`, `Hover`, ...
1353
- # ```
1354
- #
1355
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#20
1356
- class RubyLsp::Requests::Completion < ::RubyLsp::Listener
1357
- extend T::Generic
1358
-
1359
- ResponseType = type_member { { fixed: T::Array[::LanguageServer::Protocol::Interface::CompletionItem] } }
1360
-
1361
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#37
1362
- sig do
1363
- params(
1364
- index: ::RubyIndexer::Index,
1365
- nesting: T::Array[::String],
1366
- emitter: ::RubyLsp::EventEmitter,
1367
- message_queue: ::Thread::Queue
1368
- ).void
1369
- end
1370
- def initialize(index, nesting, emitter, message_queue); end
1371
-
1372
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#27
1373
- sig { override.returns(ResponseType) }
1374
- def _response; end
1375
-
1376
- # Handle completion on regular constant references (e.g. `Bar`)
1377
- #
1378
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#55
1379
- sig { params(node: ::SyntaxTree::Const).void }
1380
- def on_const(node); end
1381
-
1382
- # Handle completion on namespaced constant references (e.g. `Foo::Bar`)
1383
- #
1384
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#67
1385
- sig { params(node: ::SyntaxTree::ConstPathRef).void }
1386
- def on_const_path_ref(node); end
1387
-
1388
- # Handle completion on top level constant references (e.g. `::Bar`)
1389
- #
1390
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#79
1391
- sig { params(node: ::SyntaxTree::TopConstRef).void }
1392
- def on_top_const_ref(node); end
1393
-
1394
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#47
1395
- sig { params(node: ::SyntaxTree::TStringContent).void }
1396
- def on_tstring_content(node); end
1397
-
1398
- private
1399
-
1400
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#90
1401
- sig do
1402
- params(
1403
- label: ::String,
1404
- node: ::SyntaxTree::TStringContent
1405
- ).returns(::LanguageServer::Protocol::Interface::CompletionItem)
1406
- end
1407
- def build_completion(label, node); end
1408
-
1409
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#109
1410
- sig do
1411
- params(
1412
- name: ::String,
1413
- node: ::SyntaxTree::Node,
1414
- entries: T::Array[::RubyIndexer::Index::Entry],
1415
- top_level: T::Boolean
1416
- ).returns(::LanguageServer::Protocol::Interface::CompletionItem)
1417
- end
1418
- def build_entry_completion(name, node, entries, top_level); end
1419
-
1420
- # Check if the `entry_name` has potential conflicts in `candidates`, so that we use a top level reference instead
1421
- # of a short name
1422
- #
1423
- # source://ruby-lsp/lib/ruby_lsp/requests/completion.rb#163
1424
- sig { params(entry_name: ::String, candidates: T::Array[T::Array[::RubyIndexer::Index::Entry]]).returns(T::Boolean) }
1425
- def top_level?(entry_name, candidates); end
1426
- end
1427
-
1428
- # ![Definition demo](../../definition.gif)
1429
- #
1430
- # The [definition
1431
- # request](https://microsoft.github.io/language-server-protocol/specification#textDocument_definition) jumps to the
1432
- # definition of the symbol under the cursor.
1433
- #
1434
- # Currently, only jumping to classes, modules and required files is supported.
1435
- #
1436
- # # Example
1437
- #
1438
- # ```ruby
1439
- # require "some_gem/file" # <- Request go to definition on this string will take you to the file
1440
- # Product.new # <- Request go to definition on this class name will take you to its declaration.
1441
- # ```
1442
- #
1443
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#20
1444
- class RubyLsp::Requests::Definition < ::RubyLsp::ExtensibleListener
1445
- extend T::Generic
1446
-
1447
- ResponseType = type_member { { fixed: T.nilable(T.any(::LanguageServer::Protocol::Interface::Location, T::Array[::LanguageServer::Protocol::Interface::Location])) } }
1448
-
1449
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#38
1450
- sig do
1451
- params(
1452
- uri: ::URI::Generic,
1453
- nesting: T::Array[::String],
1454
- index: ::RubyIndexer::Index,
1455
- emitter: ::RubyLsp::EventEmitter,
1456
- message_queue: ::Thread::Queue
1457
- ).void
1458
- end
1459
- def initialize(uri, nesting, index, emitter, message_queue); end
1460
-
1461
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#27
1462
- sig { override.returns(ResponseType) }
1463
- def _response; end
1464
-
1465
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#50
1466
- sig { override.params(ext: ::RubyLsp::Extension).returns(T.nilable(RubyLsp::Listener[ResponseType])) }
1467
- def initialize_external_listener(ext); end
1468
-
1469
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#55
1470
- sig { override.params(other: RubyLsp::Listener[ResponseType]).returns(T.self_type) }
1471
- def merge_response!(other); end
1472
-
1473
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#82
1474
- sig { params(node: ::SyntaxTree::Command).void }
1475
- def on_command(node); end
1476
-
1477
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#77
1478
- sig { params(node: ::SyntaxTree::Const).void }
1479
- def on_const(node); end
1480
-
1481
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#71
1482
- sig { params(node: ::SyntaxTree::ConstPathRef).void }
1483
- def on_const_path_ref(node); end
1484
-
1485
- private
1486
-
1487
- # source://ruby-lsp/lib/ruby_lsp/requests/definition.rb#128
1488
- sig { params(value: ::String).void }
1489
- def find_in_index(value); end
1490
- end
1491
-
1492
- # ![Diagnostics demo](../../diagnostics.gif)
1493
- #
1494
- # The
1495
- # [diagnostics](https://microsoft.github.io/language-server-protocol/specification#textDocument_publishDiagnostics)
1496
- # request informs the editor of RuboCop offenses for a given file.
1497
- #
1498
- # # Example
1499
- #
1500
- # ```ruby
1501
- # def say_hello
1502
- # puts "Hello" # --> diagnostics: incorrect indentation
1503
- # end
1504
- # ```
1505
- #
1506
- # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#21
1507
- class RubyLsp::Requests::Diagnostics < ::RubyLsp::Requests::BaseRequest
1508
- # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#25
1509
- sig { params(document: ::RubyLsp::Document).void }
1510
- def initialize(document); end
1511
-
1512
- # source://ruby-lsp/lib/ruby_lsp/requests/diagnostics.rb#32
1513
- sig { override.returns(T.nilable(T.all(::Object, T::Array[::RubyLsp::Requests::Support::RuboCopDiagnostic]))) }
1514
- def run; end
1515
- end
1516
-
1517
- # ![Document highlight demo](../../document_highlight.gif)
1518
- #
1519
- # The [document highlight](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentHighlight)
1520
- # informs the editor all relevant elements of the currently pointed item for highlighting. For example, when
1521
- # the cursor is on the `F` of the constant `FOO`, the editor should identify other occurrences of `FOO`
1522
- # and highlight them.
1523
- #
1524
- # For writable elements like constants or variables, their read/write occurrences should be highlighted differently.
1525
- # This is achieved by sending different "kind" attributes to the editor (2 for read and 3 for write).
1526
- #
1527
- # # Example
1528
- #
1529
- # ```ruby
1530
- # FOO = 1 # should be highlighted as "write"
1531
- #
1532
- # def foo
1533
- # FOO # should be highlighted as "read"
1534
- # end
1535
- # ```
1536
- #
1537
- # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#25
1538
- class RubyLsp::Requests::DocumentHighlight < ::RubyLsp::Listener
1539
- extend T::Generic
1540
-
1541
- ResponseType = type_member { { fixed: T::Array[::LanguageServer::Protocol::Interface::DocumentHighlight] } }
1542
-
1543
- # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#41
1544
- sig do
1545
- params(
1546
- target: T.nilable(::SyntaxTree::Node),
1547
- parent: T.nilable(::SyntaxTree::Node),
1548
- emitter: ::RubyLsp::EventEmitter,
1549
- message_queue: ::Thread::Queue
1550
- ).void
1551
- end
1552
- def initialize(target, parent, emitter, message_queue); end
1553
-
1554
- # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#31
1555
- sig { override.returns(ResponseType) }
1556
- def _response; end
1557
-
1558
- # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#63
1559
- sig { params(node: T.nilable(::SyntaxTree::Node)).void }
1560
- def on_node(node); end
1561
-
1562
- private
1563
-
1564
- # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#84
1565
- sig { params(match: ::RubyLsp::Requests::Support::HighlightTarget::HighlightMatch).void }
1566
- def add_highlight(match); end
1567
- end
1568
-
1569
- # source://ruby-lsp/lib/ruby_lsp/requests/document_highlight.rb#72
1570
- RubyLsp::Requests::DocumentHighlight::DIRECT_HIGHLIGHTS = T.let(T.unsafe(nil), Array)
1571
-
1572
- # ![Document link demo](../../document_link.gif)
1573
- #
1574
- # The [document link](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentLink)
1575
- # makes `# source://PATH_TO_FILE#line` comments in a Ruby/RBI file clickable if the file exists.
1576
- # When the user clicks the link, it'll open that location.
1577
- #
1578
- # # Example
1579
- #
1580
- # ```ruby
1581
- # # source://syntax_tree/3.2.1/lib/syntax_tree.rb#51 <- it will be clickable and will take the user to that location
1582
- # def format(source, maxwidth = T.unsafe(nil))
1583
- # end
1584
- # ```
1585
- #
1586
- # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#21
1587
- class RubyLsp::Requests::DocumentLink < ::RubyLsp::Listener
1588
- extend T::Generic
1589
-
1590
- ResponseType = type_member { { fixed: T::Array[::LanguageServer::Protocol::Interface::DocumentLink] } }
1591
-
1592
- # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#79
1593
- sig { params(uri: ::URI::Generic, emitter: ::RubyLsp::EventEmitter, message_queue: ::Thread::Queue).void }
1594
- def initialize(uri, emitter, message_queue); end
1595
-
1596
- # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#76
1597
- sig { override.returns(ResponseType) }
1598
- def _response; end
1599
-
1600
- # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#93
1601
- sig { params(node: ::SyntaxTree::Comment).void }
1602
- def on_comment(node); end
1603
-
1604
- private
1605
-
1606
- # Try to figure out the gem version for a source:// link. The order of precedence is:
1607
- # 1. The version in the URI
1608
- # 2. The version in the RBI file name
1609
- # 3. The version from the gemspec
1610
- #
1611
- # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#118
1612
- sig { params(uri: ::URI::Source).returns(T.nilable(::String)) }
1613
- def resolve_version(uri); end
1614
-
1615
- class << self
1616
- # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#38
1617
- sig { returns(T::Hash[::String, T::Hash[::String, T::Hash[::String, ::String]]]) }
1618
- def gem_paths; end
1619
- end
1620
- end
1621
-
1622
- # source://ruby-lsp/lib/ruby_lsp/requests/document_link.rb#27
1623
- RubyLsp::Requests::DocumentLink::GEM_TO_VERSION_MAP = T.let(T.unsafe(nil), Hash)
1624
-
1625
- # ![Document symbol demo](../../document_symbol.gif)
1626
- #
1627
- # The [document
1628
- # symbol](https://microsoft.github.io/language-server-protocol/specification#textDocument_documentSymbol) request
1629
- # informs the editor of all the important symbols, such as classes, variables, and methods, defined in a file. With
1630
- # this information, the editor can populate breadcrumbs, file outline and allow for fuzzy symbol searches.
1631
- #
1632
- # In VS Code, fuzzy symbol search can be accessed by opening the command palette and inserting an `@` symbol.
1633
- #
1634
- # # Example
1635
- #
1636
- # ```ruby
1637
- # class Person # --> document symbol: class
1638
- # attr_reader :age # --> document symbol: field
1639
- #
1640
- # def initialize
1641
- # @age = 0 # --> document symbol: variable
1642
- # end
1643
- #
1644
- # def age # --> document symbol: method
1645
- # end
1646
- # end
1647
- # ```
1648
- #
1649
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#29
1650
- class RubyLsp::Requests::DocumentSymbol < ::RubyLsp::ExtensibleListener
1651
- extend T::Generic
1652
-
1653
- ResponseType = type_member { { fixed: T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol] } }
1654
-
1655
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#53
1656
- sig { params(emitter: ::RubyLsp::EventEmitter, message_queue: ::Thread::Queue).void }
1657
- def initialize(emitter, message_queue); end
1658
-
1659
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#50
1660
- sig { override.returns(T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol]) }
1661
- def _response; end
1662
-
1663
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#101
1664
- sig { params(node: ::SyntaxTree::ClassDeclaration).void }
1665
- def after_class(node); end
1666
-
1667
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#154
1668
- sig { params(node: ::SyntaxTree::DefNode).void }
1669
- def after_def(node); end
1670
-
1671
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#169
1672
- sig { params(node: ::SyntaxTree::ModuleDeclaration).void }
1673
- def after_module(node); end
1674
-
1675
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#79
1676
- sig { override.params(extension: ::RubyLsp::Extension).returns(T.nilable(RubyLsp::Listener[ResponseType])) }
1677
- def initialize_external_listener(extension); end
1678
-
1679
- # Merges responses from other listeners
1680
- #
1681
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#85
1682
- sig { override.params(other: RubyLsp::Listener[ResponseType]).returns(T.self_type) }
1683
- def merge_response!(other); end
1684
-
1685
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#91
1686
- sig { params(node: ::SyntaxTree::ClassDeclaration).void }
1687
- def on_class(node); end
1688
-
1689
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#106
1690
- sig { params(node: ::SyntaxTree::Command).void }
1691
- def on_command(node); end
1692
-
1693
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#122
1694
- sig { params(node: ::SyntaxTree::ConstPathField).void }
1695
- def on_const_path_field(node); end
1696
-
1697
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#132
1698
- sig { params(node: ::SyntaxTree::DefNode).void }
1699
- def on_def(node); end
1700
-
1701
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#159
1702
- sig { params(node: ::SyntaxTree::ModuleDeclaration).void }
1703
- def on_module(node); end
1704
-
1705
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#174
1706
- sig { params(node: ::SyntaxTree::TopConstField).void }
1707
- def on_top_const_field(node); end
1708
-
1709
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#184
1710
- sig { params(node: ::SyntaxTree::VarField).void }
1711
- def on_var_field(node); end
1712
-
1713
- private
1714
-
1715
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#213
1716
- sig do
1717
- params(
1718
- name: ::String,
1719
- kind: ::Integer,
1720
- range_node: ::SyntaxTree::Node,
1721
- selection_range_node: ::SyntaxTree::Node
1722
- ).returns(::LanguageServer::Protocol::Interface::DocumentSymbol)
1723
- end
1724
- def create_document_symbol(name:, kind:, range_node:, selection_range_node:); end
1725
- end
1726
-
1727
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#35
1728
- RubyLsp::Requests::DocumentSymbol::ATTR_ACCESSORS = T.let(T.unsafe(nil), Array)
1729
-
1730
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#37
1731
- class RubyLsp::Requests::DocumentSymbol::SymbolHierarchyRoot
1732
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#44
1733
- sig { void }
1734
- def initialize; end
1735
-
1736
- # source://ruby-lsp/lib/ruby_lsp/requests/document_symbol.rb#41
1737
- sig { returns(T::Array[::LanguageServer::Protocol::Interface::DocumentSymbol]) }
1738
- def children; end
1739
- end
1740
-
1741
- # ![Folding ranges demo](../../folding_ranges.gif)
1742
- #
1743
- # The [folding ranges](https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange)
1744
- # request informs the editor of the ranges where and how code can be folded.
1745
- #
1746
- # # Example
1747
- #
1748
- # ```ruby
1749
- # def say_hello # <-- folding range start
1750
- # puts "Hello"
1751
- # end # <-- folding range end
1752
- # ```
1753
- #
1754
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#18
1755
- class RubyLsp::Requests::FoldingRanges < ::RubyLsp::Requests::BaseRequest
1756
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#64
1757
- sig { params(document: ::RubyLsp::Document).void }
1758
- def initialize(document); end
1759
-
1760
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#72
1761
- sig { override.returns(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::FoldingRange])) }
1762
- def run; end
1763
-
1764
- private
1765
-
1766
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#223
1767
- sig { params(node: T.any(::SyntaxTree::CallNode, ::SyntaxTree::CommandCall)).void }
1768
- def add_call_range(node); end
1769
-
1770
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#257
1771
- sig { params(node: ::SyntaxTree::DefNode).void }
1772
- def add_def_range(node); end
1773
-
1774
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#296
1775
- sig { params(start_line: ::Integer, end_line: ::Integer).void }
1776
- def add_lines_range(start_line, end_line); end
1777
-
1778
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#281
1779
- sig { params(node: ::SyntaxTree::Node, statements: ::SyntaxTree::Statements).void }
1780
- def add_statements_range(node, statements); end
1781
-
1782
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#288
1783
- sig { params(node: ::SyntaxTree::StringConcat).void }
1784
- def add_string_concat(node); end
1785
-
1786
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#215
1787
- sig { void }
1788
- def emit_partial_range; end
1789
-
1790
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#181
1791
- sig { params(node: T.nilable(::SyntaxTree::Node)).returns(T::Boolean) }
1792
- def handle_partial_range(node); end
1793
-
1794
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#203
1795
- sig { params(node: T.nilable(::SyntaxTree::Node)).returns(T.nilable(::String)) }
1796
- def partial_range_kind(node); end
1797
-
1798
- # This is to prevent duplicate ranges
1799
- #
1800
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#120
1801
- sig { params(node: T.any(::SyntaxTree::Command, ::SyntaxTree::CommandCall)).returns(T::Boolean) }
1802
- def same_lines_for_command_and_block?(node); end
1803
-
1804
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#84
1805
- sig { override.params(node: T.nilable(::SyntaxTree::Node)).void }
1806
- def visit(node); end
1807
- end
1808
-
1809
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#42
1810
- RubyLsp::Requests::FoldingRanges::NODES_WITH_STATEMENTS = T.let(T.unsafe(nil), Array)
1811
-
1812
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#129
1813
- class RubyLsp::Requests::FoldingRanges::PartialRange
1814
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#148
1815
- sig { params(start_line: ::Integer, end_line: ::Integer, kind: ::String).void }
1816
- def initialize(start_line, end_line, kind); end
1817
-
1818
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#136
1819
- sig { returns(::Integer) }
1820
- def end_line; end
1821
-
1822
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#155
1823
- sig { params(node: ::SyntaxTree::Node).returns(::RubyLsp::Requests::FoldingRanges::PartialRange) }
1824
- def extend_to(node); end
1825
-
1826
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#133
1827
- sig { returns(::String) }
1828
- def kind; end
1829
-
1830
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#175
1831
- sig { returns(T::Boolean) }
1832
- def multiline?; end
1833
-
1834
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#161
1835
- sig { params(node: ::SyntaxTree::Node).returns(T::Boolean) }
1836
- def new_section?(node); end
1837
-
1838
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#166
1839
- sig { returns(::LanguageServer::Protocol::Interface::FoldingRange) }
1840
- def to_range; end
1841
-
1842
- class << self
1843
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#142
1844
- sig { params(node: ::SyntaxTree::Node, kind: ::String).returns(::RubyLsp::Requests::FoldingRanges::PartialRange) }
1845
- def from(node, kind); end
1846
- end
1847
- end
1848
-
1849
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#21
1850
- RubyLsp::Requests::FoldingRanges::SIMPLE_FOLDABLES = T.let(T.unsafe(nil), Array)
1851
-
1852
- # source://ruby-lsp/lib/ruby_lsp/requests/folding_ranges.rb#53
1853
- RubyLsp::Requests::FoldingRanges::StatementNode = T.type_alias { T.any(::SyntaxTree::Elsif, ::SyntaxTree::IfNode, ::SyntaxTree::In, ::SyntaxTree::Rescue, ::SyntaxTree::When) }
1854
-
1855
- # ![Formatting symbol demo](../../formatting.gif)
1856
- #
1857
- # The [formatting](https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting)
1858
- # request uses RuboCop to fix auto-correctable offenses in the document. This requires enabling format on save and
1859
- # registering the ruby-lsp as the Ruby formatter.
1860
- #
1861
- # The `rubyLsp.formatter` setting specifies which formatter to use.
1862
- # If set to `auto` then it behaves as follows:
1863
- # * It will use RuboCop if it is part of the bundle.
1864
- # * If RuboCop is not available, and `syntax_tree` is a direct dependency, it will use that.
1865
- # * Otherwise, no formatting will be applied.
1866
- #
1867
- # # Example
1868
- #
1869
- # ```ruby
1870
- # def say_hello
1871
- # puts "Hello" # --> formatting: fixes the indentation on save
1872
- # end
1873
- # ```
1874
- #
1875
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#28
1876
- class RubyLsp::Requests::Formatting < ::RubyLsp::Requests::BaseRequest
1877
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#58
1878
- sig { params(document: ::RubyLsp::Document, formatter: ::String).void }
1879
- def initialize(document, formatter: T.unsafe(nil)); end
1880
-
1881
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#66
1882
- sig { override.returns(T.nilable(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::TextEdit]))) }
1883
- def run; end
1884
-
1885
- private
1886
-
1887
- # @raise [InvalidFormatter]
1888
- #
1889
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#95
1890
- sig { returns(T.nilable(::String)) }
1891
- def formatted_file; end
1892
-
1893
- class << self
1894
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#43
1895
- sig { returns(T::Hash[::String, ::RubyLsp::Requests::Support::FormatterRunner]) }
1896
- def formatters; end
1897
-
1898
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#46
1899
- sig { params(identifier: ::String, instance: ::RubyLsp::Requests::Support::FormatterRunner).void }
1900
- def register_formatter(identifier, instance); end
1901
- end
1902
- end
1903
-
1904
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#29
1905
- class RubyLsp::Requests::Formatting::Error < ::StandardError; end
1906
-
1907
- # source://ruby-lsp/lib/ruby_lsp/requests/formatting.rb#30
1908
- class RubyLsp::Requests::Formatting::InvalidFormatter < ::StandardError; end
1909
-
1910
- # ![Hover demo](../../hover.gif)
1911
- #
1912
- # The [hover request](https://microsoft.github.io/language-server-protocol/specification#textDocument_hover)
1913
- # displays the documentation for the symbol currently under the cursor.
1914
- #
1915
- # # Example
1916
- #
1917
- # ```ruby
1918
- # String # -> Hovering over the class reference will show all declaration locations and the documentation
1919
- # ```
1920
- #
1921
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#16
1922
- class RubyLsp::Requests::Hover < ::RubyLsp::ExtensibleListener
1923
- extend T::Generic
1924
-
1925
- ResponseType = type_member { { fixed: T.nilable(::LanguageServer::Protocol::Interface::Hover) } }
1926
-
1927
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#43
1928
- sig do
1929
- params(
1930
- index: ::RubyIndexer::Index,
1931
- nesting: T::Array[::String],
1932
- emitter: ::RubyLsp::EventEmitter,
1933
- message_queue: ::Thread::Queue
1934
- ).void
1935
- end
1936
- def initialize(index, nesting, emitter, message_queue); end
1937
-
1938
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#33
1939
- sig { override.returns(ResponseType) }
1940
- def _response; end
1941
-
1942
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#53
1943
- sig { override.params(extension: ::RubyLsp::Extension).returns(T.nilable(RubyLsp::Listener[ResponseType])) }
1944
- def initialize_external_listener(extension); end
1945
-
1946
- # Merges responses from other hover listeners
1947
- #
1948
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#59
1949
- sig { override.params(other: RubyLsp::Listener[ResponseType]).returns(T.self_type) }
1950
- def merge_response!(other); end
1951
-
1952
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#81
1953
- sig { params(node: ::SyntaxTree::Const).void }
1954
- def on_const(node); end
1955
-
1956
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#73
1957
- sig { params(node: ::SyntaxTree::ConstPathRef).void }
1958
- def on_const_path_ref(node); end
1959
-
1960
- private
1961
-
1962
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#90
1963
- sig { params(name: ::String, node: ::SyntaxTree::Node).void }
1964
- def generate_hover(name, node); end
1965
- end
1966
-
1967
- # source://ruby-lsp/lib/ruby_lsp/requests/hover.rb#22
1968
- RubyLsp::Requests::Hover::ALLOWED_TARGETS = T.let(T.unsafe(nil), Array)
1969
-
1970
- # ![Inlay hint demo](../../inlay_hints.gif)
1971
- #
1972
- # [Inlay hints](https://microsoft.github.io/language-server-protocol/specification#textDocument_inlayHint)
1973
- # are labels added directly in the code that explicitly show the user something that might
1974
- # otherwise just be implied.
1975
- #
1976
- # # Example
1977
- #
1978
- # ```ruby
1979
- # begin
1980
- # puts "do something that might raise"
1981
- # rescue # Label "StandardError" goes here as a bare rescue implies rescuing StandardError
1982
- # puts "handle some rescue"
1983
- # end
1984
- # ```
1985
- #
1986
- # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#21
1987
- class RubyLsp::Requests::InlayHints < ::RubyLsp::Listener
1988
- extend T::Generic
1989
-
1990
- ResponseType = type_member { { fixed: T::Array[::LanguageServer::Protocol::Interface::InlayHint] } }
1991
-
1992
- # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#33
1993
- sig { params(range: T::Range[::Integer], emitter: ::RubyLsp::EventEmitter, message_queue: ::Thread::Queue).void }
1994
- def initialize(range, emitter, message_queue); end
1995
-
1996
- # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#30
1997
- sig { override.returns(ResponseType) }
1998
- def _response; end
1999
-
2000
- # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#43
2001
- sig { params(node: ::SyntaxTree::Rescue).void }
2002
- def on_rescue(node); end
2003
- end
2004
-
2005
- # source://ruby-lsp/lib/ruby_lsp/requests/inlay_hints.rb#27
2006
- RubyLsp::Requests::InlayHints::RESCUE_STRING_LENGTH = T.let(T.unsafe(nil), Integer)
2007
-
2008
- # ![On type formatting demo](../../on_type_formatting.gif)
2009
- #
2010
- # The [on type formatting](https://microsoft.github.io/language-server-protocol/specification#textDocument_onTypeFormatting)
2011
- # request formats code as the user is typing. For example, automatically adding `end` to class definitions.
2012
- #
2013
- # # Example
2014
- #
2015
- # ```ruby
2016
- # class Foo # <-- upon adding a line break, on type formatting is triggered
2017
- # # <-- cursor ends up here
2018
- # end # <-- end is automatically added
2019
- # ```
2020
- #
2021
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#18
2022
- class RubyLsp::Requests::OnTypeFormatting < ::RubyLsp::Requests::BaseRequest
2023
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#30
2024
- sig do
2025
- params(
2026
- document: ::RubyLsp::Document,
2027
- position: {line: ::Integer, character: ::Integer},
2028
- trigger_character: ::String
2029
- ).void
2030
- end
2031
- def initialize(document, position, trigger_character); end
2032
-
2033
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#44
2034
- sig { override.returns(T.all(::Object, T::Array[::LanguageServer::Protocol::Interface::TextEdit])) }
2035
- def run; end
2036
-
2037
- private
2038
-
2039
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#131
2040
- sig { params(text: ::String, position: {line: ::Integer, character: ::Integer}).void }
2041
- def add_edit_with_text(text, position = T.unsafe(nil)); end
2042
-
2043
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#163
2044
- sig { params(line: ::String).returns(::Integer) }
2045
- def find_indentation(line); end
2046
-
2047
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#125
2048
- sig { params(spaces: ::String).void }
2049
- def handle_comment_line(spaces); end
2050
-
2051
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#95
2052
- sig { void }
2053
- def handle_curly_brace; end
2054
-
2055
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#64
2056
- sig { void }
2057
- def handle_pipe; end
2058
-
2059
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#103
2060
- sig { void }
2061
- def handle_statement_end; end
2062
-
2063
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#144
2064
- sig { params(line: ::Integer, character: ::Integer).void }
2065
- def move_cursor_to(line, character); end
2066
- end
2067
-
2068
- # source://ruby-lsp/lib/ruby_lsp/requests/on_type_formatting.rb#21
2069
- RubyLsp::Requests::OnTypeFormatting::END_REGEXES = T.let(T.unsafe(nil), Array)
2070
-
2071
- # ![Selection ranges demo](../../selection_ranges.gif)
2072
- #
2073
- # The [selection ranges](https://microsoft.github.io/language-server-protocol/specification#textDocument_selectionRange)
2074
- # request informs the editor of ranges that the user may want to select based on the location(s)
2075
- # of their cursor(s).
2076
- #
2077
- # Trigger this request with: Ctrl + Shift + -> or Ctrl + Shift + <-
2078
- #
2079
- # Note that if using VSCode Neovim, you will need to be in Insert mode for this to work correctly.
2080
- #
2081
- # # Example
2082
- #
2083
- # ```ruby
2084
- # def foo # --> The next selection range encompasses the entire method definition.
2085
- # puts "Hello, world!" # --> Cursor is on this line
2086
- # end
2087
- # ```
2088
- #
2089
- # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#23
2090
- class RubyLsp::Requests::SelectionRanges < ::RubyLsp::Requests::BaseRequest
2091
- # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#66
2092
- sig { params(document: ::RubyLsp::Document).void }
2093
- def initialize(document); end
2094
-
2095
- # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#74
2096
- sig { override.returns(T.all(::Object, T::Array[::RubyLsp::Requests::Support::SelectionRange])) }
2097
- def run; end
2098
-
2099
- private
2100
-
2101
- # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#101
2102
- sig do
2103
- params(
2104
- location: ::SyntaxTree::Location,
2105
- parent: T.nilable(::RubyLsp::Requests::Support::SelectionRange)
2106
- ).returns(::RubyLsp::Requests::Support::SelectionRange)
2107
- end
2108
- def create_selection_range(location, parent = T.unsafe(nil)); end
2109
-
2110
- # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#82
2111
- sig { override.params(node: T.nilable(::SyntaxTree::Node)).void }
2112
- def visit(node); end
2113
- end
2114
-
2115
- # source://ruby-lsp/lib/ruby_lsp/requests/selection_ranges.rb#26
2116
- RubyLsp::Requests::SelectionRanges::NODES_THAT_CAN_BE_PARENTS = T.let(T.unsafe(nil), Array)
2117
-
2118
- # ![Semantic highlighting demo](../../semantic_highlighting.gif)
2119
- #
2120
- # The [semantic
2121
- # highlighting](https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens)
2122
- # request informs the editor of the correct token types to provide consistent and accurate highlighting for themes.
2123
- #
2124
- # # Example
2125
- #
2126
- # ```ruby
2127
- # def foo
2128
- # var = 1 # --> semantic highlighting: local variable
2129
- # some_invocation # --> semantic highlighting: method invocation
2130
- # var # --> semantic highlighting: local variable
2131
- # end
2132
- # ```
2133
- #
2134
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#21
2135
- class RubyLsp::Requests::SemanticHighlighting < ::RubyLsp::Listener
2136
- extend T::Generic
2137
-
2138
- ResponseType = type_member { { fixed: T::Array[::RubyLsp::Requests::SemanticHighlighting::SemanticToken] } }
2139
-
2140
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#117
2141
- sig do
2142
- params(
2143
- emitter: ::RubyLsp::EventEmitter,
2144
- message_queue: ::Thread::Queue,
2145
- range: T.nilable(T::Range[::Integer])
2146
- ).void
2147
- end
2148
- def initialize(emitter, message_queue, range: T.unsafe(nil)); end
2149
-
2150
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#108
2151
- sig { override.returns(ResponseType) }
2152
- def _response; end
2153
-
2154
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#327
2155
- sig { params(location: ::SyntaxTree::Location, type: ::Symbol, modifiers: T::Array[::Symbol]).void }
2156
- def add_token(location, type, modifiers = T.unsafe(nil)); end
2157
-
2158
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#286
2159
- sig { params(node: ::SyntaxTree::Binary).void }
2160
- def after_binary(node); end
2161
-
2162
- # All block locals are variables. E.g.: [].each do |x; block_local|
2163
- #
2164
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#254
2165
- sig { params(node: ::SyntaxTree::BlockVar).void }
2166
- def on_block_var(node); end
2167
-
2168
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#146
2169
- sig { params(node: ::SyntaxTree::CallNode).void }
2170
- def on_call(node); end
2171
-
2172
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#310
2173
- sig { params(node: ::SyntaxTree::ClassDeclaration).void }
2174
- def on_class(node); end
2175
-
2176
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#157
2177
- sig { params(node: ::SyntaxTree::Command).void }
2178
- def on_command(node); end
2179
-
2180
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#164
2181
- sig { params(node: ::SyntaxTree::CommandCall).void }
2182
- def on_command_call(node); end
2183
-
2184
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#172
2185
- sig { params(node: ::SyntaxTree::Const).void }
2186
- def on_const(node); end
2187
-
2188
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#183
2189
- sig { params(node: ::SyntaxTree::DefNode).void }
2190
- def on_def(node); end
2191
-
2192
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#220
2193
- sig { params(node: ::SyntaxTree::Field).void }
2194
- def on_field(node); end
2195
-
2196
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#190
2197
- sig { params(node: ::SyntaxTree::Kw).void }
2198
- def on_kw(node); end
2199
-
2200
- # All lambda locals are variables. E.g.: ->(x; lambda_local) {}
2201
- #
2202
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#260
2203
- sig { params(node: ::SyntaxTree::LambdaVar).void }
2204
- def on_lambda_var(node); end
2205
-
2206
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#320
2207
- sig { params(node: ::SyntaxTree::ModuleDeclaration).void }
2208
- def on_module(node); end
2209
-
2210
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#200
2211
- sig { params(node: ::SyntaxTree::Params).void }
2212
- def on_params(node); end
2213
-
2214
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#227
2215
- sig { params(node: ::SyntaxTree::VarField).void }
2216
- def on_var_field(node); end
2217
-
2218
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#240
2219
- sig { params(node: ::SyntaxTree::VarRef).void }
2220
- def on_var_ref(node); end
2221
-
2222
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#265
2223
- sig { params(node: ::SyntaxTree::VCall).void }
2224
- def on_vcall(node); end
2225
-
2226
- private
2227
-
2228
- # Exclude the ":" symbol at the end of a location
2229
- # We use it on keyword parameters to be consistent
2230
- # with the rest of the parameters
2231
- #
2232
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#346
2233
- sig { params(location: T.untyped).returns(::SyntaxTree::Location) }
2234
- def location_without_colon(location); end
2235
-
2236
- # Textmate provides highlighting for a subset
2237
- # of these special Ruby-specific methods.
2238
- # We want to utilize that highlighting, so we
2239
- # avoid making a semantic token for it.
2240
- #
2241
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#362
2242
- sig { params(method_name: ::String).returns(T::Boolean) }
2243
- def special_method?(method_name); end
2244
-
2245
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#367
2246
- sig { params(value: ::SyntaxTree::Ident).returns(::Symbol) }
2247
- def type_for_local(value); end
2248
- end
2249
-
2250
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#72
2251
- RubyLsp::Requests::SemanticHighlighting::SPECIAL_RUBY_METHODS = T.let(T.unsafe(nil), Array)
2252
-
2253
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#83
2254
- class RubyLsp::Requests::SemanticHighlighting::SemanticToken
2255
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#99
2256
- sig do
2257
- params(
2258
- location: ::SyntaxTree::Location,
2259
- length: ::Integer,
2260
- type: ::Integer,
2261
- modifier: T::Array[::Integer]
2262
- ).void
2263
- end
2264
- def initialize(location:, length:, type:, modifier:); end
2265
-
2266
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#90
2267
- sig { returns(::Integer) }
2268
- def length; end
2269
-
2270
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#87
2271
- sig { returns(::SyntaxTree::Location) }
2272
- def location; end
2273
-
2274
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#96
2275
- sig { returns(T::Array[::Integer]) }
2276
- def modifier; end
2277
-
2278
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#93
2279
- sig { returns(::Integer) }
2280
- def type; end
2281
- end
2282
-
2283
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#56
2284
- RubyLsp::Requests::SemanticHighlighting::TOKEN_MODIFIERS = T.let(T.unsafe(nil), Hash)
2285
-
2286
- # source://ruby-lsp/lib/ruby_lsp/requests/semantic_highlighting.rb#27
2287
- RubyLsp::Requests::SemanticHighlighting::TOKEN_TYPES = T.let(T.unsafe(nil), Hash)
2288
-
2289
- # ![Show syntax tree demo](../../show_syntax_tree.gif)
2290
- #
2291
- # Show syntax tree is a custom [LSP
2292
- # request](https://microsoft.github.io/language-server-protocol/specification#requestMessage) that displays the AST
2293
- # for the current document or for the current selection in a new tab.
2294
- #
2295
- # # Example
2296
- #
2297
- # ```ruby
2298
- # # Executing the Ruby LSP: Show syntax tree command will display the AST for the document
2299
- # 1 + 1
2300
- # # (program (statements ((binary (int "1") + (int "1")))))
2301
- # ```
2302
- #
2303
- # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#20
2304
- class RubyLsp::Requests::ShowSyntaxTree < ::RubyLsp::Requests::BaseRequest
2305
- # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#24
2306
- sig do
2307
- params(
2308
- document: ::RubyLsp::Document,
2309
- range: T.nilable({start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}})
2310
- ).void
2311
- end
2312
- def initialize(document, range); end
2313
-
2314
- # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#31
2315
- sig { override.returns(::String) }
2316
- def run; end
2317
-
2318
- private
2319
-
2320
- # source://ruby-lsp/lib/ruby_lsp/requests/show_syntax_tree.rb#43
2321
- sig { returns(::String) }
2322
- def ast_for_range; end
2323
- end
2324
-
2325
- # source://ruby-lsp/lib/ruby_lsp/requests.rb#48
2326
- module RubyLsp::Requests::Support; end
2327
-
2328
- # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#7
2329
- class RubyLsp::Requests::Support::Annotation
2330
- # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#15
2331
- sig { params(arity: T.any(::Integer, T::Range[::Integer]), receiver: T::Boolean).void }
2332
- def initialize(arity:, receiver: T.unsafe(nil)); end
2333
-
2334
- # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#21
2335
- sig { returns(T.any(::Integer, T::Range[::Integer])) }
2336
- def arity; end
2337
-
2338
- # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#24
2339
- sig { returns(T::Boolean) }
2340
- def receiver; end
2341
-
2342
- # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#27
2343
- sig { params(arity: T.any(::Integer, T::Range[::Integer])).returns(T::Boolean) }
2344
- def supports_arity?(arity); end
2345
-
2346
- # source://ruby-lsp/lib/ruby_lsp/requests/support/annotation.rb#38
2347
- sig { params(receiver: T.nilable(::String)).returns(T::Boolean) }
2348
- def supports_receiver?(receiver); end
2349
- end
2350
-
2351
- # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#7
2352
- module RubyLsp::Requests::Support::Common
2353
- # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#64
2354
- sig do
2355
- params(
2356
- node: ::SyntaxTree::Node,
2357
- title: ::String,
2358
- command_name: ::String,
2359
- arguments: T.nilable(T::Array[T.untyped]),
2360
- data: T.nilable(T::Hash[T.untyped, T.untyped])
2361
- ).returns(::LanguageServer::Protocol::Interface::CodeLens)
2362
- end
2363
- def create_code_lens(node, title:, command_name:, arguments:, data:); end
2364
-
2365
- # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#28
2366
- sig do
2367
- params(
2368
- node: T.any(::SyntaxTree::ConstPathRef, ::SyntaxTree::ConstRef, ::SyntaxTree::TopConstRef)
2369
- ).returns(::String)
2370
- end
2371
- def full_constant_name(node); end
2372
-
2373
- # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#79
2374
- sig do
2375
- params(
2376
- title: ::String,
2377
- entries: T::Array[::RubyIndexer::Index::Entry]
2378
- ).returns(::LanguageServer::Protocol::Interface::MarkupContent)
2379
- end
2380
- def markdown_from_index_entries(title, entries); end
2381
-
2382
- # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#13
2383
- sig { params(node: ::SyntaxTree::Node).returns(::LanguageServer::Protocol::Interface::Range) }
2384
- def range_from_syntax_tree_node(node); end
2385
-
2386
- # source://ruby-lsp/lib/ruby_lsp/requests/support/common.rb#47
2387
- sig { params(node: T.nilable(::SyntaxTree::Node), range: T.nilable(T::Range[::Integer])).returns(T::Boolean) }
2388
- def visible?(node, range); end
2389
- end
2390
-
2391
- # @abstract Subclasses must implement the `abstract` methods below.
2392
- #
2393
- # source://ruby-lsp/lib/ruby_lsp/requests/support/formatter_runner.rb#7
2394
- module RubyLsp::Requests::Support::FormatterRunner
2395
- interface!
2396
-
2397
- # @abstract
2398
- #
2399
- # source://ruby-lsp/lib/ruby_lsp/requests/support/formatter_runner.rb#14
2400
- sig { abstract.params(uri: ::URI::Generic, document: ::RubyLsp::Document).returns(T.nilable(::String)) }
2401
- def run(uri, document); end
2402
- end
2403
-
2404
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#7
2405
- class RubyLsp::Requests::Support::HighlightTarget
2406
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#30
2407
- sig { params(node: ::SyntaxTree::Node).void }
2408
- def initialize(node); end
2409
-
2410
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#36
2411
- sig do
2412
- params(
2413
- other: ::SyntaxTree::Node
2414
- ).returns(T.nilable(::RubyLsp::Requests::Support::HighlightTarget::HighlightMatch))
2415
- end
2416
- def highlight_type(other); end
2417
-
2418
- private
2419
-
2420
- # Match the target type (where the cursor is positioned) with the `other` type (the node we're currently
2421
- # visiting)
2422
- #
2423
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#45
2424
- sig do
2425
- params(
2426
- other: ::SyntaxTree::Node
2427
- ).returns(T.nilable(::RubyLsp::Requests::Support::HighlightTarget::HighlightMatch))
2428
- end
2429
- def matched_highlight(other); end
2430
-
2431
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#77
2432
- sig { params(node: ::SyntaxTree::Node).returns(T.nilable(::String)) }
2433
- def value(node); end
2434
- end
2435
-
2436
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#13
2437
- class RubyLsp::Requests::Support::HighlightTarget::HighlightMatch
2438
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#23
2439
- sig { params(type: ::Integer, node: ::SyntaxTree::Node).void }
2440
- def initialize(type:, node:); end
2441
-
2442
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#20
2443
- sig { returns(::SyntaxTree::Node) }
2444
- def node; end
2445
-
2446
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#17
2447
- sig { returns(::Integer) }
2448
- def type; end
2449
- end
2450
-
2451
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#10
2452
- RubyLsp::Requests::Support::HighlightTarget::READ = T.let(T.unsafe(nil), Integer)
2453
-
2454
- # source://ruby-lsp/lib/ruby_lsp/requests/support/highlight_target.rb#11
2455
- RubyLsp::Requests::Support::HighlightTarget::WRITE = T.let(T.unsafe(nil), Integer)
2456
-
2457
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#19
2458
- class RubyLsp::Requests::Support::InternalRuboCopError < ::StandardError
2459
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#29
2460
- sig { params(rubocop_error: ::RuboCop::ErrorWithAnalyzedFileLocation).void }
2461
- def initialize(rubocop_error); end
2462
- end
2463
-
2464
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#22
2465
- RubyLsp::Requests::Support::InternalRuboCopError::MESSAGE = T.let(T.unsafe(nil), String)
2466
-
2467
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#7
2468
- class RubyLsp::Requests::Support::RuboCopDiagnostic
2469
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#23
2470
- sig { params(offense: ::RuboCop::Cop::Offense, uri: ::URI::Generic).void }
2471
- def initialize(offense, uri); end
2472
-
2473
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#29
2474
- sig { returns(::LanguageServer::Protocol::Interface::CodeAction) }
2475
- def to_lsp_code_action; end
2476
-
2477
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#49
2478
- sig { returns(::LanguageServer::Protocol::Interface::Diagnostic) }
2479
- def to_lsp_diagnostic; end
2480
-
2481
- private
2482
-
2483
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#83
2484
- sig { returns(T::Array[::LanguageServer::Protocol::Interface::TextEdit]) }
2485
- def offense_replacements; end
2486
- end
2487
-
2488
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb#10
2489
- RubyLsp::Requests::Support::RuboCopDiagnostic::RUBOCOP_TO_LSP_SEVERITY = T.let(T.unsafe(nil), Hash)
2490
-
2491
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostics_runner.rb#12
2492
- class RubyLsp::Requests::Support::RuboCopDiagnosticsRunner
2493
- include ::Singleton
2494
- extend ::Singleton::SingletonClassMethods
2495
-
2496
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostics_runner.rb#17
2497
- sig { void }
2498
- def initialize; end
2499
-
2500
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_diagnostics_runner.rb#22
2501
- sig do
2502
- params(
2503
- uri: ::URI::Generic,
2504
- document: ::RubyLsp::Document
2505
- ).returns(T::Array[::RubyLsp::Requests::Support::RuboCopDiagnostic])
2506
- end
2507
- def run(uri, document); end
2508
-
2509
- class << self
2510
- private
2511
-
2512
- def allocate; end
2513
- def new(*_arg0); end
2514
- end
2515
- end
2516
-
2517
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb#12
2518
- class RubyLsp::Requests::Support::RuboCopFormattingRunner
2519
- include ::Singleton
2520
- include ::RubyLsp::Requests::Support::FormatterRunner
2521
- extend ::Singleton::SingletonClassMethods
2522
-
2523
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb#18
2524
- sig { void }
2525
- def initialize; end
2526
-
2527
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb#24
2528
- sig { override.params(uri: ::URI::Generic, document: ::RubyLsp::Document).returns(::String) }
2529
- def run(uri, document); end
2530
-
2531
- class << self
2532
- private
2533
-
2534
- def allocate; end
2535
- def new(*_arg0); end
2536
- end
2537
- end
2538
-
2539
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#36
2540
- class RubyLsp::Requests::Support::RuboCopRunner < ::RuboCop::Runner
2541
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#63
2542
- sig { params(args: ::String).void }
2543
- def initialize(*args); end
2544
-
2545
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#95
2546
- sig { returns(::String) }
2547
- def formatted_source; end
2548
-
2549
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#42
2550
- sig { returns(T::Array[::RuboCop::Cop::Offense]) }
2551
- def offenses; end
2552
-
2553
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#77
2554
- sig { params(path: ::String, contents: ::String).void }
2555
- def run(path, contents); end
2556
-
2557
- private
2558
-
2559
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#102
2560
- sig { params(_file: ::String, offenses: T::Array[::RuboCop::Cop::Offense]).void }
2561
- def file_finished(_file, offenses); end
2562
- end
2563
-
2564
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#39
2565
- class RubyLsp::Requests::Support::RuboCopRunner::ConfigurationError < ::StandardError; end
2566
-
2567
- # source://ruby-lsp/lib/ruby_lsp/requests/support/rubocop_runner.rb#44
2568
- RubyLsp::Requests::Support::RuboCopRunner::DEFAULT_ARGS = T.let(T.unsafe(nil), Array)
2569
-
2570
- # source://ruby-lsp/lib/ruby_lsp/requests/support/selection_range.rb#7
2571
- class RubyLsp::Requests::Support::SelectionRange < ::LanguageServer::Protocol::Interface::SelectionRange
2572
- # source://ruby-lsp/lib/ruby_lsp/requests/support/selection_range.rb#11
2573
- sig { params(position: {line: ::Integer, character: ::Integer}).returns(T::Boolean) }
2574
- def cover?(position); end
2575
- end
2576
-
2577
- # source://ruby-lsp/lib/ruby_lsp/requests/support/semantic_token_encoder.rb#7
2578
- class RubyLsp::Requests::Support::SemanticTokenEncoder
2579
- # source://ruby-lsp/lib/ruby_lsp/requests/support/semantic_token_encoder.rb#11
2580
- sig { void }
2581
- def initialize; end
2582
-
2583
- # For more information on how each number is calculated, read:
2584
- # https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
2585
- #
2586
- # source://ruby-lsp/lib/ruby_lsp/requests/support/semantic_token_encoder.rb#43
2587
- sig { params(token: ::RubyLsp::Requests::SemanticHighlighting::SemanticToken).returns(T::Array[::Integer]) }
2588
- def compute_delta(token); end
2589
-
2590
- # source://ruby-lsp/lib/ruby_lsp/requests/support/semantic_token_encoder.rb#21
2591
- sig do
2592
- params(
2593
- tokens: T::Array[::RubyLsp::Requests::SemanticHighlighting::SemanticToken]
2594
- ).returns(::LanguageServer::Protocol::Interface::SemanticTokens)
2595
- end
2596
- def encode(tokens); end
2597
-
2598
- # Encode an array of modifiers to positions onto a bit flag
2599
- # For example, [:default_library] will be encoded as
2600
- # 0b1000000000, as :default_library is the 10th bit according
2601
- # to the token modifiers index map.
2602
- #
2603
- # source://ruby-lsp/lib/ruby_lsp/requests/support/semantic_token_encoder.rb#62
2604
- sig { params(modifiers: T::Array[::Integer]).returns(::Integer) }
2605
- def encode_modifiers(modifiers); end
2606
- end
2607
-
2608
- # source://ruby-lsp/lib/ruby_lsp/requests/support/sorbet.rb#7
2609
- class RubyLsp::Requests::Support::Sorbet
2610
- class << self
2611
- # source://ruby-lsp/lib/ruby_lsp/requests/support/sorbet.rb#48
2612
- sig { params(node: T.any(::SyntaxTree::CallNode, ::SyntaxTree::VCall)).returns(T::Boolean) }
2613
- def annotation?(node); end
2614
-
2615
- private
2616
-
2617
- # source://ruby-lsp/lib/ruby_lsp/requests/support/sorbet.rb#61
2618
- sig do
2619
- params(
2620
- node: T.any(::SyntaxTree::CallNode, ::SyntaxTree::VCall)
2621
- ).returns(T.nilable(::RubyLsp::Requests::Support::Annotation))
2622
- end
2623
- def annotation(node); end
2624
-
2625
- # source://ruby-lsp/lib/ruby_lsp/requests/support/sorbet.rb#90
2626
- sig { params(node: T.nilable(::SyntaxTree::Node)).returns(T.nilable(::String)) }
2627
- def node_name(node); end
2628
-
2629
- # source://ruby-lsp/lib/ruby_lsp/requests/support/sorbet.rb#76
2630
- sig { params(receiver: T.any(::SyntaxTree::CallNode, ::SyntaxTree::VCall)).returns(T.nilable(::String)) }
2631
- def receiver_name(receiver); end
2632
- end
2633
- end
2634
-
2635
- # source://ruby-lsp/lib/ruby_lsp/requests/support/syntax_tree_formatting_runner.rb#11
2636
- class RubyLsp::Requests::Support::SyntaxTreeFormattingRunner
2637
- include ::Singleton
2638
- include ::RubyLsp::Requests::Support::FormatterRunner
2639
- extend ::Singleton::SingletonClassMethods
2640
-
2641
- # source://ruby-lsp/lib/ruby_lsp/requests/support/syntax_tree_formatting_runner.rb#17
2642
- sig { void }
2643
- def initialize; end
2644
-
2645
- # source://ruby-lsp/lib/ruby_lsp/requests/support/syntax_tree_formatting_runner.rb#30
2646
- sig { override.params(uri: ::URI::Generic, document: ::RubyLsp::Document).returns(T.nilable(::String)) }
2647
- def run(uri, document); end
2648
-
2649
- class << self
2650
- private
2651
-
2652
- def allocate; end
2653
- def new(*_arg0); end
2654
- end
2655
- end
2656
-
2657
- # ![Workspace symbol demo](../../workspace_symbol.gif)
2658
- #
2659
- # The [workspace symbol](https://microsoft.github.io/language-server-protocol/specification#workspace_symbol)
2660
- # request allows fuzzy searching declarations in the entire project. On VS Code, use CTRL/CMD + T to search for
2661
- # symbols.
2662
- #
2663
- # # Example
2664
- #
2665
- # ```ruby
2666
- # # Searching for `Floo` will fuzzy match and return all declarations according to the query, including this `Foo`
2667
- # class
2668
- # class Foo
2669
- # end
2670
- # ```
2671
- #
2672
- # source://ruby-lsp/lib/ruby_lsp/requests/workspace_symbol.rb#21
2673
- class RubyLsp::Requests::WorkspaceSymbol
2674
- # source://ruby-lsp/lib/ruby_lsp/requests/workspace_symbol.rb#25
2675
- sig { params(query: T.nilable(::String), index: ::RubyIndexer::Index).void }
2676
- def initialize(query, index); end
2677
-
2678
- # source://ruby-lsp/lib/ruby_lsp/requests/workspace_symbol.rb#31
2679
- sig { returns(T::Array[::LanguageServer::Protocol::Interface::WorkspaceSymbol]) }
2680
- def run; end
2681
-
2682
- private
2683
-
2684
- # source://ruby-lsp/lib/ruby_lsp/requests/workspace_symbol.rb#74
2685
- sig { params(entry: ::RubyIndexer::Index::Entry).returns(T.nilable(::Integer)) }
2686
- def kind_for_entry(entry); end
2687
- end
2688
-
2689
- # The final result of running a request before its IO is finalized
2690
- #
2691
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#35
2692
- class RubyLsp::Result
2693
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#54
2694
- sig { params(response: T.untyped, error: T.nilable(::Exception), request_time: T.nilable(::Float)).void }
2695
- def initialize(response:, error: T.unsafe(nil), request_time: T.unsafe(nil)); end
2696
-
2697
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#42
2698
- sig { returns(T.nilable(::Exception)) }
2699
- def error; end
2700
-
2701
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#45
2702
- sig { returns(T.nilable(::Float)) }
2703
- def request_time; end
2704
-
2705
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#39
2706
- sig { returns(T.untyped) }
2707
- def response; end
2708
- end
2709
-
2710
- # source://ruby-lsp/lib/ruby_lsp/server.rb#11
2711
- class RubyLsp::Server
2712
- # source://ruby-lsp/lib/ruby_lsp/server.rb#15
2713
- sig { void }
2714
- def initialize; end
2715
-
2716
- # source://ruby-lsp/lib/ruby_lsp/server.rb#60
2717
- sig { void }
2718
- def start; end
2719
-
2720
- private
2721
-
2722
- # Finalize a Queue::Result. All IO operations should happen here to avoid any issues with cancelling requests
2723
- #
2724
- # source://ruby-lsp/lib/ruby_lsp/server.rb#145
2725
- sig { params(result: ::RubyLsp::Result, request: T::Hash[::Symbol, T.untyped]).void }
2726
- def finalize_request(result, request); end
2727
-
2728
- # source://ruby-lsp/lib/ruby_lsp/server.rb#120
2729
- sig { returns(::Thread) }
2730
- def new_worker; end
2731
-
2732
- # source://ruby-lsp/lib/ruby_lsp/server.rb#177
2733
- sig do
2734
- params(
2735
- request: T::Hash[::Symbol, T.untyped],
2736
- request_time: ::Float,
2737
- error: T.nilable(::Exception)
2738
- ).returns(T::Hash[::Symbol, T.any(::Float, ::String)])
2739
- end
2740
- def telemetry_params(request, request_time, error); end
2741
- end
2742
-
2743
- # source://ruby-lsp/lib/ruby_lsp/store.rb#7
2744
- class RubyLsp::Store
2745
- # source://ruby-lsp/lib/ruby_lsp/store.rb#23
2746
- sig { void }
2747
- def initialize; end
2748
-
2749
- # source://ruby-lsp/lib/ruby_lsp/store.rb#75
2750
- sig do
2751
- type_parameters(:T)
2752
- .params(
2753
- uri: ::URI::Generic,
2754
- request_name: ::String,
2755
- block: T.proc.params(document: ::RubyLsp::Document).returns(T.type_parameter(:T))
2756
- ).returns(T.type_parameter(:T))
2757
- end
2758
- def cache_fetch(uri, request_name, &block); end
2759
-
2760
- # source://ruby-lsp/lib/ruby_lsp/store.rb#53
2761
- sig { void }
2762
- def clear; end
2763
-
2764
- # source://ruby-lsp/lib/ruby_lsp/store.rb#63
2765
- sig { params(uri: ::URI::Generic).void }
2766
- def delete(uri); end
2767
-
2768
- # source://ruby-lsp/lib/ruby_lsp/store.rb#58
2769
- sig { returns(T::Boolean) }
2770
- def empty?; end
2771
-
2772
- # source://ruby-lsp/lib/ruby_lsp/store.rb#11
2773
- sig { returns(::String) }
2774
- def encoding; end
2775
-
2776
- # @return [String]
2777
- #
2778
- # source://ruby-lsp/lib/ruby_lsp/store.rb#11
2779
- def encoding=(_arg0); end
2780
-
2781
- # source://ruby-lsp/lib/ruby_lsp/store.rb#20
2782
- sig { returns(T::Boolean) }
2783
- def experimental_features; end
2784
-
2785
- # @return [Boolean]
2786
- #
2787
- # source://ruby-lsp/lib/ruby_lsp/store.rb#20
2788
- def experimental_features=(_arg0); end
2789
-
2790
- # source://ruby-lsp/lib/ruby_lsp/store.rb#14
2791
- sig { returns(::String) }
2792
- def formatter; end
2793
-
2794
- # @return [String]
2795
- #
2796
- # source://ruby-lsp/lib/ruby_lsp/store.rb#14
2797
- def formatter=(_arg0); end
2798
-
2799
- # source://ruby-lsp/lib/ruby_lsp/store.rb#32
2800
- sig { params(uri: ::URI::Generic).returns(::RubyLsp::Document) }
2801
- def get(uri); end
2802
-
2803
- # source://ruby-lsp/lib/ruby_lsp/store.rb#48
2804
- sig do
2805
- params(
2806
- uri: ::URI::Generic,
2807
- edits: T::Array[{range: {start: {line: ::Integer, character: ::Integer}, end: {line: ::Integer, character: ::Integer}}, text: ::String}],
2808
- version: ::Integer
2809
- ).void
2810
- end
2811
- def push_edits(uri:, edits:, version:); end
2812
-
2813
- # source://ruby-lsp/lib/ruby_lsp/store.rb#42
2814
- sig { params(uri: ::URI::Generic, source: ::String, version: ::Integer).void }
2815
- def set(uri:, source:, version:); end
2816
-
2817
- # source://ruby-lsp/lib/ruby_lsp/store.rb#17
2818
- sig { returns(T::Boolean) }
2819
- def supports_progress; end
2820
-
2821
- # @return [Boolean]
2822
- #
2823
- # source://ruby-lsp/lib/ruby_lsp/store.rb#17
2824
- def supports_progress=(_arg0); end
2825
- end
2826
-
2827
- # source://ruby-lsp/lib/ruby_lsp/server.rb#8
2828
- RubyLsp::Transport = LanguageServer::Protocol::Transport
2829
-
2830
- # source://ruby-lsp/lib/ruby-lsp.rb#5
2831
- RubyLsp::VERSION = T.let(T.unsafe(nil), String)
2832
-
2833
- # Used to indicate that a request shouldn't return a response
2834
- #
2835
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#6
2836
- RubyLsp::VOID = T.let(T.unsafe(nil), Object)
2837
-
2838
- # This freeze is not redundant since the interpolated string is mutable
2839
- #
2840
- # source://ruby-lsp/lib/ruby_lsp/utils.rb#9
2841
- RubyLsp::WORKSPACE_URI = T.let(T.unsafe(nil), URI::Generic)
2842
-
2843
- # source://ruby-lsp/lib/core_ext/uri.rb#4
2844
- module URI
2845
- include ::URI::RFC2396_REGEXP
2846
- end
2847
-
2848
- # source://ruby-lsp/lib/core_ext/uri.rb#5
2849
- class URI::Generic
2850
- include ::URI::RFC2396_REGEXP
2851
- include ::URI
2852
-
2853
- class << self
2854
- # source://ruby-lsp/lib/core_ext/uri.rb#10
2855
- sig { params(path: ::String, fragment: T.nilable(::String), scheme: ::String).returns(::URI::Generic) }
2856
- def from_path(path:, fragment: T.unsafe(nil), scheme: T.unsafe(nil)); end
2857
- end
2858
- end
2859
-
2860
- # Must be kept in sync with the one in Tapioca
2861
- #
2862
- # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#8
2863
- class URI::Source < ::URI::File
2864
- # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#62
2865
- sig { params(v: T.nilable(::String)).returns(T::Boolean) }
2866
- def check_host(v); end
2867
-
2868
- # source://uri/0.12.1uri/generic.rb#243
2869
- def gem_name; end
2870
-
2871
- # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#26
2872
- sig { returns(T.nilable(::String)) }
2873
- def gem_version; end
2874
-
2875
- # source://uri/0.12.1uri/generic.rb#283
2876
- def line_number; end
2877
-
2878
- # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#52
2879
- sig { params(v: T.nilable(::String)).void }
2880
- def set_path(v); end
2881
-
2882
- # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#74
2883
- sig { returns(::String) }
2884
- def to_s; end
2885
-
2886
- class << self
2887
- # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#39
2888
- sig do
2889
- params(
2890
- gem_name: ::String,
2891
- gem_version: T.nilable(::String),
2892
- path: ::String,
2893
- line_number: T.nilable(::String)
2894
- ).returns(::URI::Source)
2895
- end
2896
- def build(gem_name:, gem_version:, path:, line_number:); end
2897
- end
2898
- end
2899
-
2900
- # source://ruby-lsp/lib/ruby_lsp/requests/support/source_uri.rb#11
2901
- URI::Source::COMPONENT = T.let(T.unsafe(nil), Array)
2902
-
2903
- class URI::WSS < ::URI::WS; end