ruby-lsp 0.23.15 → 0.26.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/exe/ruby-lsp +17 -14
- data/exe/ruby-lsp-check +0 -4
- data/exe/ruby-lsp-launcher +41 -14
- data/exe/ruby-lsp-test-exec +6 -0
- data/lib/rubocop/cop/ruby_lsp/use_language_server_aliases.rb +0 -1
- data/lib/rubocop/cop/ruby_lsp/use_register_with_handler_method.rb +0 -1
- data/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +4 -3
- data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +42 -20
- data/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb +1 -7
- data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +49 -62
- data/lib/ruby_indexer/lib/ruby_indexer/index.rb +84 -74
- data/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb +6 -9
- data/lib/ruby_indexer/lib/ruby_indexer/rbs_indexer.rb +9 -14
- data/lib/ruby_indexer/lib/ruby_indexer/reference_finder.rb +12 -8
- data/lib/ruby_indexer/lib/ruby_indexer/visibility_scope.rb +4 -4
- data/lib/ruby_lsp/addon.rb +44 -15
- data/lib/ruby_lsp/base_server.rb +56 -37
- data/lib/ruby_lsp/client_capabilities.rb +6 -1
- data/lib/ruby_lsp/document.rb +174 -62
- data/lib/ruby_lsp/erb_document.rb +10 -8
- data/lib/ruby_lsp/global_state.rb +86 -33
- data/lib/ruby_lsp/internal.rb +6 -3
- data/lib/ruby_lsp/listeners/completion.rb +22 -11
- data/lib/ruby_lsp/listeners/definition.rb +41 -21
- data/lib/ruby_lsp/listeners/document_highlight.rb +26 -1
- data/lib/ruby_lsp/listeners/document_link.rb +64 -28
- data/lib/ruby_lsp/listeners/hover.rb +27 -16
- data/lib/ruby_lsp/listeners/inlay_hints.rb +5 -3
- data/lib/ruby_lsp/listeners/semantic_highlighting.rb +2 -2
- data/lib/ruby_lsp/listeners/signature_help.rb +2 -2
- data/lib/ruby_lsp/listeners/spec_style.rb +155 -79
- data/lib/ruby_lsp/listeners/test_discovery.rb +39 -21
- data/lib/ruby_lsp/listeners/test_style.rb +75 -35
- data/lib/ruby_lsp/rbs_document.rb +3 -6
- data/lib/ruby_lsp/requests/code_action_resolve.rb +83 -58
- data/lib/ruby_lsp/requests/code_actions.rb +20 -5
- data/lib/ruby_lsp/requests/code_lens.rb +27 -6
- data/lib/ruby_lsp/requests/completion.rb +3 -3
- data/lib/ruby_lsp/requests/completion_resolve.rb +8 -6
- data/lib/ruby_lsp/requests/definition.rb +4 -7
- data/lib/ruby_lsp/requests/discover_tests.rb +2 -2
- data/lib/ruby_lsp/requests/document_highlight.rb +2 -2
- data/lib/ruby_lsp/requests/document_link.rb +1 -1
- data/lib/ruby_lsp/requests/folding_ranges.rb +1 -1
- data/lib/ruby_lsp/requests/go_to_relevant_file.rb +64 -12
- data/lib/ruby_lsp/requests/hover.rb +3 -6
- data/lib/ruby_lsp/requests/inlay_hints.rb +4 -4
- data/lib/ruby_lsp/requests/on_type_formatting.rb +1 -1
- data/lib/ruby_lsp/requests/prepare_rename.rb +1 -1
- data/lib/ruby_lsp/requests/references.rb +10 -21
- data/lib/ruby_lsp/requests/rename.rb +9 -10
- data/lib/ruby_lsp/requests/request.rb +8 -8
- data/lib/ruby_lsp/requests/selection_ranges.rb +2 -2
- data/lib/ruby_lsp/requests/semantic_highlighting.rb +1 -1
- data/lib/ruby_lsp/requests/show_syntax_tree.rb +2 -2
- data/lib/ruby_lsp/requests/signature_help.rb +2 -2
- data/lib/ruby_lsp/requests/support/annotation.rb +1 -1
- data/lib/ruby_lsp/requests/support/common.rb +9 -12
- data/lib/ruby_lsp/requests/support/formatter.rb +16 -15
- data/lib/ruby_lsp/requests/support/package_url.rb +414 -0
- data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +7 -1
- data/lib/ruby_lsp/requests/support/rubocop_formatter.rb +2 -2
- data/lib/ruby_lsp/requests/support/rubocop_runner.rb +13 -3
- data/lib/ruby_lsp/requests/support/source_uri.rb +7 -4
- data/lib/ruby_lsp/requests/support/test_item.rb +7 -1
- data/lib/ruby_lsp/requests/workspace_symbol.rb +20 -12
- data/lib/ruby_lsp/response_builders/collection_response_builder.rb +1 -4
- data/lib/ruby_lsp/response_builders/document_symbol.rb +2 -3
- data/lib/ruby_lsp/response_builders/hover.rb +1 -4
- data/lib/ruby_lsp/response_builders/response_builder.rb +6 -7
- data/lib/ruby_lsp/response_builders/semantic_highlighting.rb +4 -5
- data/lib/ruby_lsp/response_builders/signature_help.rb +1 -2
- data/lib/ruby_lsp/response_builders/test_collection.rb +29 -3
- data/lib/ruby_lsp/ruby_document.rb +14 -42
- data/lib/ruby_lsp/scripts/compose_bundle.rb +3 -3
- data/lib/ruby_lsp/scripts/compose_bundle_windows.rb +3 -1
- data/lib/ruby_lsp/server.rb +173 -130
- data/lib/ruby_lsp/setup_bundler.rb +114 -47
- data/lib/ruby_lsp/static_docs.rb +1 -0
- data/lib/ruby_lsp/store.rb +6 -16
- data/lib/ruby_lsp/test_helper.rb +1 -4
- data/lib/ruby_lsp/test_reporters/lsp_reporter.rb +121 -17
- data/lib/ruby_lsp/test_reporters/minitest_reporter.rb +65 -25
- data/lib/ruby_lsp/test_reporters/test_unit_reporter.rb +16 -18
- data/lib/ruby_lsp/utils.rb +102 -13
- data/static_docs/break.md +103 -0
- metadata +8 -33
- data/lib/ruby_indexer/test/class_variables_test.rb +0 -140
- data/lib/ruby_indexer/test/classes_and_modules_test.rb +0 -770
- data/lib/ruby_indexer/test/configuration_test.rb +0 -280
- data/lib/ruby_indexer/test/constant_test.rb +0 -402
- data/lib/ruby_indexer/test/enhancements_test.rb +0 -325
- data/lib/ruby_indexer/test/global_variable_test.rb +0 -49
- data/lib/ruby_indexer/test/index_test.rb +0 -2190
- data/lib/ruby_indexer/test/instance_variables_test.rb +0 -240
- data/lib/ruby_indexer/test/method_test.rb +0 -973
- data/lib/ruby_indexer/test/prefix_tree_test.rb +0 -150
- data/lib/ruby_indexer/test/rbs_indexer_test.rb +0 -380
- data/lib/ruby_indexer/test/reference_finder_test.rb +0 -330
- data/lib/ruby_indexer/test/test_case.rb +0 -51
- data/lib/ruby_indexer/test/uri_test.rb +0 -85
- data/lib/ruby_lsp/load_sorbet.rb +0 -62
|
@@ -22,7 +22,7 @@ module RubyLsp
|
|
|
22
22
|
char_position, _ = @document.find_index_by_position(@position)
|
|
23
23
|
|
|
24
24
|
node_context = RubyDocument.locate(
|
|
25
|
-
@document.
|
|
25
|
+
@document.ast,
|
|
26
26
|
char_position,
|
|
27
27
|
node_types: [Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::ConstantPathTargetNode],
|
|
28
28
|
code_units_cache: @document.code_units_cache,
|
|
@@ -26,7 +26,7 @@ module RubyLsp
|
|
|
26
26
|
char_position, _ = @document.find_index_by_position(position)
|
|
27
27
|
|
|
28
28
|
node_context = RubyDocument.locate(
|
|
29
|
-
@document.
|
|
29
|
+
@document.ast,
|
|
30
30
|
char_position,
|
|
31
31
|
node_types: [
|
|
32
32
|
Prism::ConstantReadNode,
|
|
@@ -55,22 +55,7 @@ module RubyLsp
|
|
|
55
55
|
)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
target =
|
|
59
|
-
target,
|
|
60
|
-
T.any(
|
|
61
|
-
Prism::ConstantReadNode,
|
|
62
|
-
Prism::ConstantPathNode,
|
|
63
|
-
Prism::ConstantPathTargetNode,
|
|
64
|
-
Prism::InstanceVariableAndWriteNode,
|
|
65
|
-
Prism::InstanceVariableOperatorWriteNode,
|
|
66
|
-
Prism::InstanceVariableOrWriteNode,
|
|
67
|
-
Prism::InstanceVariableReadNode,
|
|
68
|
-
Prism::InstanceVariableTargetNode,
|
|
69
|
-
Prism::InstanceVariableWriteNode,
|
|
70
|
-
Prism::CallNode,
|
|
71
|
-
Prism::DefNode,
|
|
72
|
-
),
|
|
73
|
-
)
|
|
58
|
+
target = target #: as Prism::ConstantReadNode | Prism::ConstantPathNode | Prism::ConstantPathTargetNode | Prism::InstanceVariableAndWriteNode | Prism::InstanceVariableOperatorWriteNode | Prism::InstanceVariableOrWriteNode | Prism::InstanceVariableReadNode | Prism::InstanceVariableTargetNode | Prism::InstanceVariableWriteNode | Prism::CallNode | Prism::DefNode,
|
|
74
59
|
|
|
75
60
|
reference_target = create_reference_target(target, node_context)
|
|
76
61
|
return @locations unless reference_target
|
|
@@ -81,7 +66,7 @@ module RubyLsp
|
|
|
81
66
|
# of reading from disk
|
|
82
67
|
next if @store.key?(uri)
|
|
83
68
|
|
|
84
|
-
parse_result = Prism.
|
|
69
|
+
parse_result = Prism.parse_lex_file(path)
|
|
85
70
|
collect_references(reference_target, parse_result, uri)
|
|
86
71
|
rescue Errno::EISDIR, Errno::ENOENT
|
|
87
72
|
# If `path` is a directory, just ignore it and continue. If the file doesn't exist, then we also ignore it.
|
|
@@ -116,13 +101,17 @@ module RubyLsp
|
|
|
116
101
|
Prism::InstanceVariableReadNode,
|
|
117
102
|
Prism::InstanceVariableTargetNode,
|
|
118
103
|
Prism::InstanceVariableWriteNode
|
|
119
|
-
|
|
104
|
+
receiver_type = @global_state.type_inferrer.infer_receiver_type(node_context)
|
|
105
|
+
return unless receiver_type
|
|
106
|
+
|
|
107
|
+
ancestors = @global_state.index.linearized_ancestors_of(receiver_type.name)
|
|
108
|
+
RubyIndexer::ReferenceFinder::InstanceVariableTarget.new(target_node.name.to_s, ancestors)
|
|
120
109
|
when Prism::CallNode, Prism::DefNode
|
|
121
110
|
RubyIndexer::ReferenceFinder::MethodTarget.new(target_node.name.to_s)
|
|
122
111
|
end
|
|
123
112
|
end
|
|
124
113
|
|
|
125
|
-
#: (RubyIndexer::ReferenceFinder::Target target, Prism::
|
|
114
|
+
#: (RubyIndexer::ReferenceFinder::Target target, Prism::LexResult parse_result, URI::Generic uri) -> void
|
|
126
115
|
def collect_references(target, parse_result, uri)
|
|
127
116
|
dispatcher = Prism::Dispatcher.new
|
|
128
117
|
finder = RubyIndexer::ReferenceFinder.new(
|
|
@@ -132,7 +121,7 @@ module RubyLsp
|
|
|
132
121
|
uri,
|
|
133
122
|
include_declarations: @params.dig(:context, :includeDeclaration) || true,
|
|
134
123
|
)
|
|
135
|
-
dispatcher.visit(parse_result.value)
|
|
124
|
+
dispatcher.visit(parse_result.value.first)
|
|
136
125
|
|
|
137
126
|
finder.references.each do |reference|
|
|
138
127
|
@locations << Interface::Location.new(
|
|
@@ -34,7 +34,7 @@ module RubyLsp
|
|
|
34
34
|
char_position, _ = @document.find_index_by_position(@position)
|
|
35
35
|
|
|
36
36
|
node_context = RubyDocument.locate(
|
|
37
|
-
@document.
|
|
37
|
+
@document.ast,
|
|
38
38
|
char_position,
|
|
39
39
|
node_types: [Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::ConstantPathTargetNode],
|
|
40
40
|
code_units_cache: @document.code_units_cache,
|
|
@@ -51,10 +51,7 @@ module RubyLsp
|
|
|
51
51
|
)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
target =
|
|
55
|
-
target,
|
|
56
|
-
T.any(Prism::ConstantReadNode, Prism::ConstantPathNode, Prism::ConstantPathTargetNode),
|
|
57
|
-
)
|
|
54
|
+
target = target #: as Prism::ConstantReadNode | Prism::ConstantPathNode | Prism::ConstantPathTargetNode
|
|
58
55
|
|
|
59
56
|
name = RubyIndexer::Index.constant_name(target)
|
|
60
57
|
return unless name
|
|
@@ -139,25 +136,27 @@ module RubyLsp
|
|
|
139
136
|
next if @store.key?(uri)
|
|
140
137
|
|
|
141
138
|
parse_result = Prism.parse_file(path)
|
|
142
|
-
edits = collect_changes(target, parse_result, name, uri)
|
|
139
|
+
edits = collect_changes(target, parse_result.value, name, uri)
|
|
143
140
|
changes[uri.to_s] = edits unless edits.empty?
|
|
144
141
|
rescue Errno::EISDIR, Errno::ENOENT
|
|
145
142
|
# If `path` is a directory, just ignore it and continue. If the file doesn't exist, then we also ignore it.
|
|
146
143
|
end
|
|
147
144
|
|
|
148
145
|
@store.each do |uri, document|
|
|
149
|
-
|
|
146
|
+
next unless document.is_a?(RubyDocument) || document.is_a?(ERBDocument)
|
|
147
|
+
|
|
148
|
+
edits = collect_changes(target, document.ast, name, document.uri)
|
|
150
149
|
changes[uri] = edits unless edits.empty?
|
|
151
150
|
end
|
|
152
151
|
|
|
153
152
|
changes
|
|
154
153
|
end
|
|
155
154
|
|
|
156
|
-
#: (RubyIndexer::ReferenceFinder::Target target, Prism::
|
|
157
|
-
def collect_changes(target,
|
|
155
|
+
#: (RubyIndexer::ReferenceFinder::Target target, Prism::Node ast, String name, URI::Generic uri) -> Array[Interface::TextEdit]
|
|
156
|
+
def collect_changes(target, ast, name, uri)
|
|
158
157
|
dispatcher = Prism::Dispatcher.new
|
|
159
158
|
finder = RubyIndexer::ReferenceFinder.new(target, @global_state.index, dispatcher, uri)
|
|
160
|
-
dispatcher.visit(
|
|
159
|
+
dispatcher.visit(ast)
|
|
161
160
|
|
|
162
161
|
finder.references.map do |reference|
|
|
163
162
|
adjust_reference_for_edit(name, reference)
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
module RubyLsp
|
|
5
5
|
module Requests
|
|
6
|
+
# @abstract
|
|
6
7
|
class Request
|
|
7
|
-
extend T::Generic
|
|
8
|
-
extend T::Sig
|
|
9
|
-
|
|
10
8
|
class InvalidFormatter < StandardError; end
|
|
11
9
|
|
|
12
|
-
abstract
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
# @abstract
|
|
11
|
+
#: -> untyped
|
|
12
|
+
def perform
|
|
13
|
+
raise AbstractMethodInvokedError
|
|
14
|
+
end
|
|
16
15
|
|
|
17
16
|
private
|
|
18
17
|
|
|
@@ -60,7 +59,8 @@ module RubyLsp
|
|
|
60
59
|
return target unless parent.is_a?(Prism::ConstantPathNode)
|
|
61
60
|
|
|
62
61
|
target = parent #: Prism::Node
|
|
63
|
-
parent =
|
|
62
|
+
parent = target #: as Prism::ConstantPathNode
|
|
63
|
+
.parent #: Prism::Node?
|
|
64
64
|
|
|
65
65
|
while parent && cover?(parent.location, position)
|
|
66
66
|
target = parent
|
|
@@ -25,14 +25,14 @@ module RubyLsp
|
|
|
25
25
|
#: -> (Array[Support::SelectionRange] & Object)
|
|
26
26
|
def perform
|
|
27
27
|
# [node, parent]
|
|
28
|
-
queue = [[@document.
|
|
28
|
+
queue = [[@document.ast, nil]]
|
|
29
29
|
|
|
30
30
|
until queue.empty?
|
|
31
31
|
node, parent = queue.shift
|
|
32
32
|
next unless node
|
|
33
33
|
|
|
34
34
|
range = Support::SelectionRange.new(range: range_from_location(node.location), parent: parent)
|
|
35
|
-
|
|
35
|
+
queue.unshift(*node.child_nodes.map { |child| [child, range] })
|
|
36
36
|
@ranges.unshift(range)
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -74,7 +74,7 @@ module RubyLsp
|
|
|
74
74
|
@result_id = 0 #: Integer
|
|
75
75
|
@mutex = Mutex.new #: Mutex
|
|
76
76
|
|
|
77
|
-
#: (GlobalState global_state, Prism::Dispatcher dispatcher, (RubyDocument | ERBDocument) document, String? previous_result_id, ?range:
|
|
77
|
+
#: (GlobalState global_state, Prism::Dispatcher dispatcher, (RubyDocument | ERBDocument) document, String? previous_result_id, ?range: Range[Integer]?) -> void
|
|
78
78
|
def initialize(global_state, dispatcher, document, previous_result_id, range: nil)
|
|
79
79
|
super()
|
|
80
80
|
|
|
@@ -12,7 +12,7 @@ module RubyLsp
|
|
|
12
12
|
super()
|
|
13
13
|
@document = document
|
|
14
14
|
@range = range
|
|
15
|
-
@tree = document.
|
|
15
|
+
@tree = document.ast #: Prism::ProgramNode
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# @override
|
|
@@ -46,7 +46,7 @@ module RubyLsp
|
|
|
46
46
|
if (start_char..end_char).cover?(loc.start_offset..loc.end_offset)
|
|
47
47
|
found_nodes << node
|
|
48
48
|
else
|
|
49
|
-
|
|
49
|
+
queue.unshift(*node.child_nodes)
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -19,7 +19,7 @@ module RubyLsp
|
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
#: ((RubyDocument | ERBDocument) document, GlobalState global_state, Hash[Symbol, untyped] position, Hash[Symbol, untyped]? context, Prism::Dispatcher dispatcher,
|
|
22
|
+
#: ((RubyDocument | ERBDocument) document, GlobalState global_state, Hash[Symbol, untyped] position, Hash[Symbol, untyped]? context, Prism::Dispatcher dispatcher, SorbetLevel sorbet_level) -> void
|
|
23
23
|
def initialize(document, global_state, position, context, dispatcher, sorbet_level) # rubocop:disable Metrics/ParameterLists
|
|
24
24
|
super()
|
|
25
25
|
|
|
@@ -27,7 +27,7 @@ module RubyLsp
|
|
|
27
27
|
delegate_request_if_needed!(global_state, document, char_position)
|
|
28
28
|
|
|
29
29
|
node_context = RubyDocument.locate(
|
|
30
|
-
document.
|
|
30
|
+
document.ast,
|
|
31
31
|
char_position,
|
|
32
32
|
node_types: [Prism::CallNode],
|
|
33
33
|
code_units_cache: document.code_units_cache,
|
|
@@ -5,7 +5,7 @@ module RubyLsp
|
|
|
5
5
|
module Requests
|
|
6
6
|
module Support
|
|
7
7
|
class Annotation
|
|
8
|
-
#: (arity: (Integer |
|
|
8
|
+
#: (arity: (Integer | Range[Integer]), ?receiver: bool) -> void
|
|
9
9
|
def initialize(arity:, receiver: false)
|
|
10
10
|
@arity = arity
|
|
11
11
|
@receiver = receiver
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
module RubyLsp
|
|
5
5
|
module Requests
|
|
6
6
|
module Support
|
|
7
|
+
# @requires_ancestor: Kernel
|
|
7
8
|
module Common
|
|
8
9
|
# WARNING: Methods in this class may be used by Ruby LSP add-ons such as
|
|
9
10
|
# https://github.com/Shopify/ruby-lsp-rails, or add-ons by created by developers outside of Shopify, so be
|
|
10
11
|
# cautious of changing anything.
|
|
11
|
-
extend T::Helpers
|
|
12
|
-
|
|
13
|
-
requires_ancestor { Kernel }
|
|
14
12
|
|
|
15
13
|
#: (Prism::Node node) -> Interface::Range
|
|
16
14
|
def range_from_node(node)
|
|
@@ -142,28 +140,27 @@ module RubyLsp
|
|
|
142
140
|
end
|
|
143
141
|
end
|
|
144
142
|
|
|
145
|
-
#: (RubyIndexer::Entry entry) -> Integer
|
|
143
|
+
#: (RubyIndexer::Entry entry) -> Integer
|
|
146
144
|
def kind_for_entry(entry)
|
|
147
145
|
case entry
|
|
148
146
|
when RubyIndexer::Entry::Class
|
|
149
147
|
Constant::SymbolKind::CLASS
|
|
150
148
|
when RubyIndexer::Entry::Module
|
|
151
149
|
Constant::SymbolKind::NAMESPACE
|
|
152
|
-
when RubyIndexer::Entry::Constant
|
|
150
|
+
when RubyIndexer::Entry::Constant, RubyIndexer::Entry::UnresolvedConstantAlias, RubyIndexer::Entry::ConstantAlias
|
|
153
151
|
Constant::SymbolKind::CONSTANT
|
|
154
|
-
when RubyIndexer::Entry::Method
|
|
152
|
+
when RubyIndexer::Entry::Method, RubyIndexer::Entry::UnresolvedMethodAlias, RubyIndexer::Entry::MethodAlias
|
|
155
153
|
entry.name == "initialize" ? Constant::SymbolKind::CONSTRUCTOR : Constant::SymbolKind::METHOD
|
|
156
154
|
when RubyIndexer::Entry::Accessor
|
|
157
155
|
Constant::SymbolKind::PROPERTY
|
|
158
|
-
when RubyIndexer::Entry::InstanceVariable
|
|
156
|
+
when RubyIndexer::Entry::InstanceVariable, RubyIndexer::Entry::ClassVariable
|
|
159
157
|
Constant::SymbolKind::FIELD
|
|
158
|
+
when RubyIndexer::Entry::GlobalVariable
|
|
159
|
+
Constant::SymbolKind::VARIABLE
|
|
160
|
+
else
|
|
161
|
+
Constant::SymbolKind::NULL
|
|
160
162
|
end
|
|
161
163
|
end
|
|
162
|
-
|
|
163
|
-
#: (RubyDocument::SorbetLevel sorbet_level) -> bool
|
|
164
|
-
def sorbet_level_true_or_higher?(sorbet_level)
|
|
165
|
-
sorbet_level == RubyDocument::SorbetLevel::True || sorbet_level == RubyDocument::SorbetLevel::Strict
|
|
166
|
-
end
|
|
167
164
|
end
|
|
168
165
|
end
|
|
169
166
|
end
|
|
@@ -4,25 +4,26 @@
|
|
|
4
4
|
module RubyLsp
|
|
5
5
|
module Requests
|
|
6
6
|
module Support
|
|
7
|
+
# Empty module to avoid the runtime component. This is an interface defined in sorbet/rbi/shims/ruby_lsp.rbi
|
|
8
|
+
# @interface
|
|
7
9
|
module Formatter
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
sig { abstract.params(uri: URI::Generic, document: RubyDocument).returns(T.nilable(String)) }
|
|
14
|
-
def run_formatting(uri, document); end
|
|
10
|
+
# @abstract
|
|
11
|
+
#: (URI::Generic, RubyLsp::RubyDocument) -> String?
|
|
12
|
+
def run_formatting(uri, document)
|
|
13
|
+
raise AbstractMethodInvokedError
|
|
14
|
+
end
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
# @abstract
|
|
17
|
+
#: (URI::Generic, String, Integer) -> String?
|
|
18
|
+
def run_range_formatting(uri, source, base_indentation)
|
|
19
|
+
raise AbstractMethodInvokedError
|
|
20
|
+
end
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
).returns(T.nilable(T::Array[Interface::Diagnostic]))
|
|
22
|
+
# @abstract
|
|
23
|
+
#: (URI::Generic, RubyLsp::RubyDocument) -> Array[Interface::Diagnostic]?
|
|
24
|
+
def run_diagnostic(uri, document)
|
|
25
|
+
raise AbstractMethodInvokedError
|
|
24
26
|
end
|
|
25
|
-
def run_diagnostic(uri, document); end
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
end
|