Skip to content

Commit ab273bd

Browse files
Upgrade Tapioca (#3622)
* Upgrade Tapioca * Change `should` to `must` Co-authored-by: Alex Rocha <9896751+alexcrocha@users.noreply.github.com> --------- Co-authored-by: Alex Rocha <9896751+alexcrocha@users.noreply.github.com>
1 parent 69c5000 commit ab273bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6727
-9735
lines changed

Gemfile.lock

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ GEM
4545
racc (1.8.1)
4646
rainbow (3.1.1)
4747
rake (13.3.0)
48-
rbi (0.3.3)
48+
rbi (0.3.6)
4949
prism (~> 1.0)
5050
rbs (>= 3.4.4)
51-
sorbet-runtime (>= 0.5.9204)
5251
rbs (4.0.0.dev.4)
5352
logger
5453
prism (>= 1.3.0)
@@ -86,15 +85,15 @@ GEM
8685
rubocop (>= 1)
8786
ruby-progressbar (1.13.0)
8887
ruby2_keywords (0.0.5)
89-
sorbet (0.5.12152)
90-
sorbet-static (= 0.5.12152)
91-
sorbet-runtime (0.5.12152)
92-
sorbet-static (0.5.12152-universal-darwin)
93-
sorbet-static (0.5.12152-x86_64-linux)
94-
sorbet-static-and-runtime (0.5.12152)
95-
sorbet (= 0.5.12152)
96-
sorbet-runtime (= 0.5.12152)
97-
spoom (1.7.2)
88+
sorbet (0.5.12194)
89+
sorbet-static (= 0.5.12194)
90+
sorbet-runtime (0.5.12194)
91+
sorbet-static (0.5.12194-universal-darwin)
92+
sorbet-static (0.5.12194-x86_64-linux)
93+
sorbet-static-and-runtime (0.5.12194)
94+
sorbet (= 0.5.12194)
95+
sorbet-runtime (= 0.5.12194)
96+
spoom (1.7.4)
9897
erubi (>= 1.10.0)
9998
prism (>= 0.28.0)
10099
rbi (>= 0.3.3)
@@ -105,7 +104,7 @@ GEM
105104
stringio (3.1.7)
106105
syntax_tree (6.2.0)
107106
prettier_print (>= 1.2.0)
108-
tapioca (0.17.1)
107+
tapioca (0.17.4)
109108
benchmark
110109
bundler (>= 2.2.25)
111110
netrc (>= 0.11.0)

lib/ruby_indexer/lib/ruby_indexer/entry.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ def initialize(name, uri, location, comments, visibility, owner) # rubocop:disab
294294

295295
# @abstract
296296
#: -> Array[Signature]
297-
def signatures; end
297+
def signatures
298+
raise AbstractMethodInvokedError
299+
end
298300

299301
#: -> String
300302
def decorated_parameters

lib/ruby_lsp/addon.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,24 +182,32 @@ def errors_details
182182
# reading information into memory or even spawning a separate process
183183
# @abstract
184184
#: (GlobalState, Thread::Queue) -> void
185-
def activate(global_state, outgoing_queue); end
185+
def activate(global_state, outgoing_queue)
186+
raise AbstractMethodInvokedError
187+
end
186188

187-
# Each add-on should implement `MyAddon#deactivate` and use to perform any clean up, like shutting down a
189+
# Each add-on must implement `MyAddon#deactivate` and use to perform any clean up, like shutting down a
188190
# child process
189191
# @abstract
190192
#: -> void
191-
def deactivate; end
193+
def deactivate
194+
raise AbstractMethodInvokedError
195+
end
192196

193197
# Add-ons should override the `name` method to return the add-on name
194198
# @abstract
195199
#: -> String
196-
def name; end
200+
def name
201+
raise AbstractMethodInvokedError
202+
end
197203

198204
# Add-ons should override the `version` method to return a semantic version string representing the add-on's
199205
# version. This is used for compatibility checks
200206
# @abstract
201207
#: -> String
202-
def version; end
208+
def version
209+
raise AbstractMethodInvokedError
210+
end
203211

204212
# Handle a response from a window/showMessageRequest request. Add-ons must include the addon_name as part of the
205213
# original request so that the response is delegated to the correct add-on and must override this method to handle

lib/ruby_lsp/base_server.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,15 @@ def push_message(message)
128128

129129
# @abstract
130130
#: (Hash[Symbol, untyped] message) -> void
131-
def process_message(message); end
131+
def process_message(message)
132+
raise AbstractMethodInvokedError
133+
end
132134

133135
# @abstract
134136
#: -> void
135-
def shutdown; end
137+
def shutdown
138+
raise AbstractMethodInvokedError
139+
end
136140

137141
#: (Integer id, String message, ?type: Integer) -> void
138142
def fail_request_and_notify(id, message, type: Constant::MessageType::INFO)

lib/ruby_lsp/document.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ def ==(other)
6060

6161
# @abstract
6262
#: -> Symbol
63-
def language_id; end
63+
def language_id
64+
raise AbstractMethodInvokedError
65+
end
6466

6567
#: [T] (String request_name) { (Document[ParseResultType] document) -> T } -> T
6668
def cache_fetch(request_name, &block)
@@ -120,11 +122,15 @@ def push_edits(edits, version:)
120122
# Returns `true` if the document was parsed and `false` if nothing needed parsing
121123
# @abstract
122124
#: -> bool
123-
def parse!; end
125+
def parse!
126+
raise AbstractMethodInvokedError
127+
end
124128

125129
# @abstract
126130
#: -> bool
127-
def syntax_error?; end
131+
def syntax_error?
132+
raise AbstractMethodInvokedError
133+
end
128134

129135
#: -> bool
130136
def past_expensive_limit?
@@ -190,7 +196,9 @@ def initialize
190196
# character index regardless of whether we are searching positions based on bytes, code units, or codepoints.
191197
# @abstract
192198
#: (Hash[Symbol, untyped] position) -> Integer
193-
def find_char_position(position); end
199+
def find_char_position(position)
200+
raise AbstractMethodInvokedError
201+
end
194202
end
195203

196204
# For the UTF-8 encoding, positions correspond to bytes

lib/ruby_lsp/requests/request.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class InvalidFormatter < StandardError; end
99

1010
# @abstract
1111
#: -> untyped
12-
def perform; end
12+
def perform
13+
raise AbstractMethodInvokedError
14+
end
1315

1416
private
1517

lib/ruby_lsp/requests/support/formatter.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ module Support
99
module Formatter
1010
# @abstract
1111
#: (URI::Generic, RubyLsp::RubyDocument) -> String?
12-
def run_formatting(uri, document); end
12+
def run_formatting(uri, document)
13+
raise AbstractMethodInvokedError
14+
end
1315

1416
# @abstract
1517
#: (URI::Generic, String, Integer) -> String?
16-
def run_range_formatting(uri, source, base_indentation); end
18+
def run_range_formatting(uri, source, base_indentation)
19+
raise AbstractMethodInvokedError
20+
end
1721

1822
# @abstract
1923
#: (URI::Generic, RubyLsp::RubyDocument) -> Array[Interface::Diagnostic]?
20-
def run_diagnostic(uri, document); end
24+
def run_diagnostic(uri, document)
25+
raise AbstractMethodInvokedError
26+
end
2127
end
2228
end
2329
end

lib/ruby_lsp/response_builders/response_builder.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ module ResponseBuilders
77
class ResponseBuilder
88
# @abstract
99
#: -> top
10-
def response; end
10+
def response
11+
raise AbstractMethodInvokedError
12+
end
1113
end
1214
end
1315
end

lib/ruby_lsp/server.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ def process_message(message)
9494
id: message[:id],
9595
response:
9696
Addon.addons.map do |addon|
97-
{ name: addon.name, version: addon.version, errored: addon.error? }
97+
version = begin
98+
addon.version
99+
rescue AbstractMethodInvokedError
100+
nil
101+
end
102+
103+
{ name: addon.name, version: version, errored: addon.error? }
98104
end,
99105
),
100106
)

lib/ruby_lsp/utils.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class DelegateRequestError < StandardError
3131
CODE = -32900
3232
end
3333

34+
class AbstractMethodInvokedError < StandardError; end
35+
3436
BUNDLE_COMPOSE_FAILED_CODE = -33000
3537

3638
# A notification to be sent to the client
@@ -50,7 +52,9 @@ def initialize(method:, params:)
5052

5153
# @abstract
5254
#: -> Hash[Symbol, untyped]
53-
def to_hash; end
55+
def to_hash
56+
raise AbstractMethodInvokedError
57+
end
5458
end
5559

5660
class Notification < Message

0 commit comments

Comments
 (0)