ruby-lsp 0.20.1 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/VERSION +1 -1
- data/exe/ruby-lsp +19 -4
- data/exe/ruby-lsp-launcher +124 -0
- data/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +6 -0
- data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +233 -59
- data/lib/ruby_indexer/lib/ruby_indexer/enhancement.rb +34 -16
- data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +1 -1
- data/lib/ruby_indexer/lib/ruby_indexer/index.rb +15 -15
- data/lib/ruby_indexer/test/classes_and_modules_test.rb +4 -4
- data/lib/ruby_indexer/test/configuration_test.rb +10 -0
- data/lib/ruby_indexer/test/constant_test.rb +8 -8
- data/lib/ruby_indexer/test/enhancements_test.rb +169 -41
- data/lib/ruby_indexer/test/index_test.rb +41 -2
- data/lib/ruby_indexer/test/instance_variables_test.rb +1 -1
- data/lib/ruby_indexer/test/method_test.rb +139 -0
- data/lib/ruby_indexer/test/rbs_indexer_test.rb +1 -1
- data/lib/ruby_lsp/addon.rb +9 -2
- data/lib/ruby_lsp/base_server.rb +14 -5
- data/lib/ruby_lsp/client_capabilities.rb +67 -0
- data/lib/ruby_lsp/document.rb +1 -1
- data/lib/ruby_lsp/global_state.rb +33 -20
- data/lib/ruby_lsp/internal.rb +3 -0
- data/lib/ruby_lsp/listeners/completion.rb +62 -0
- data/lib/ruby_lsp/listeners/definition.rb +48 -13
- data/lib/ruby_lsp/listeners/document_highlight.rb +91 -4
- data/lib/ruby_lsp/listeners/document_symbol.rb +37 -4
- data/lib/ruby_lsp/listeners/hover.rb +52 -0
- data/lib/ruby_lsp/requests/code_action_resolve.rb +1 -1
- data/lib/ruby_lsp/requests/completion.rb +7 -1
- data/lib/ruby_lsp/requests/completion_resolve.rb +1 -1
- data/lib/ruby_lsp/requests/definition.rb +28 -11
- data/lib/ruby_lsp/requests/document_highlight.rb +7 -1
- data/lib/ruby_lsp/requests/document_symbol.rb +2 -1
- data/lib/ruby_lsp/requests/hover.rb +26 -6
- data/lib/ruby_lsp/requests/rename.rb +1 -1
- data/lib/ruby_lsp/requests/request.rb +1 -1
- data/lib/ruby_lsp/requests/support/rubocop_runner.rb +12 -1
- data/lib/ruby_lsp/scripts/compose_bundle.rb +20 -0
- data/lib/ruby_lsp/scripts/compose_bundle_windows.rb +8 -0
- data/lib/ruby_lsp/server.rb +85 -55
- data/lib/ruby_lsp/setup_bundler.rb +154 -47
- data/lib/ruby_lsp/store.rb +0 -4
- data/lib/ruby_lsp/utils.rb +63 -0
- metadata +8 -3
@@ -3,12 +3,16 @@
|
|
3
3
|
|
4
4
|
require "sorbet-runtime"
|
5
5
|
require "bundler"
|
6
|
+
require "bundler/cli"
|
7
|
+
require "bundler/cli/install"
|
8
|
+
require "bundler/cli/update"
|
6
9
|
require "fileutils"
|
7
10
|
require "pathname"
|
8
11
|
require "digest"
|
9
12
|
require "time"
|
13
|
+
require "uri"
|
10
14
|
|
11
|
-
# This file is a script that will configure a
|
15
|
+
# This file is a script that will configure a composed bundle for the Ruby LSP. The composed bundle allows developers to use
|
12
16
|
# the Ruby LSP without including the gem in their application's Gemfile while at the same time giving us access to the
|
13
17
|
# exact locked versions of dependencies.
|
14
18
|
|
@@ -27,6 +31,8 @@ module RubyLsp
|
|
27
31
|
def initialize(project_path, **options)
|
28
32
|
@project_path = project_path
|
29
33
|
@branch = T.let(options[:branch], T.nilable(String))
|
34
|
+
@launcher = T.let(options[:launcher], T.nilable(T::Boolean))
|
35
|
+
patch_thor_to_print_progress_to_stderr! if @launcher
|
30
36
|
|
31
37
|
# Regular bundle paths
|
32
38
|
@gemfile = T.let(
|
@@ -39,6 +45,9 @@ module RubyLsp
|
|
39
45
|
)
|
40
46
|
@lockfile = T.let(@gemfile ? Bundler.default_lockfile : nil, T.nilable(Pathname))
|
41
47
|
|
48
|
+
@gemfile_hash = T.let(@gemfile ? Digest::SHA256.hexdigest(@gemfile.read) : nil, T.nilable(String))
|
49
|
+
@lockfile_hash = T.let(@lockfile&.exist? ? Digest::SHA256.hexdigest(@lockfile.read) : nil, T.nilable(String))
|
50
|
+
|
42
51
|
@gemfile_name = T.let(@gemfile&.basename&.to_s || "Gemfile", String)
|
43
52
|
|
44
53
|
# Custom bundle paths
|
@@ -47,6 +56,7 @@ module RubyLsp
|
|
47
56
|
@custom_lockfile = T.let(@custom_dir + (@lockfile&.basename || "Gemfile.lock"), Pathname)
|
48
57
|
@lockfile_hash_path = T.let(@custom_dir + "main_lockfile_hash", Pathname)
|
49
58
|
@last_updated_path = T.let(@custom_dir + "last_updated", Pathname)
|
59
|
+
@error_path = T.let(@custom_dir + "install_error", Pathname)
|
50
60
|
|
51
61
|
dependencies, bundler_version = load_dependencies
|
52
62
|
@dependencies = T.let(dependencies, T::Hash[String, T.untyped])
|
@@ -55,33 +65,28 @@ module RubyLsp
|
|
55
65
|
@retry = T.let(false, T::Boolean)
|
56
66
|
end
|
57
67
|
|
58
|
-
# Sets up the
|
68
|
+
# Sets up the composed bundle and returns the `BUNDLE_GEMFILE`, `BUNDLE_PATH` and `BUNDLE_APP_CONFIG` that should be
|
59
69
|
# used for running the server
|
60
70
|
sig { returns(T::Hash[String, String]) }
|
61
71
|
def setup!
|
62
|
-
raise BundleNotLocked if @gemfile&.exist? && !@lockfile&.exist?
|
72
|
+
raise BundleNotLocked if !@launcher && @gemfile&.exist? && !@lockfile&.exist?
|
63
73
|
|
64
|
-
#
|
74
|
+
# Automatically create and ignore the .ruby-lsp folder for users
|
75
|
+
@custom_dir.mkpath unless @custom_dir.exist?
|
76
|
+
ignore_file = @custom_dir + ".gitignore"
|
77
|
+
ignore_file.write("*") unless ignore_file.exist?
|
78
|
+
|
79
|
+
# Do not set up a composed bundle if LSP dependencies are already in the Gemfile
|
65
80
|
if @dependencies["ruby-lsp"] &&
|
66
81
|
@dependencies["debug"] &&
|
67
82
|
(@rails_app ? @dependencies["ruby-lsp-rails"] : true)
|
68
83
|
$stderr.puts(
|
69
|
-
"Ruby LSP> Skipping
|
84
|
+
"Ruby LSP> Skipping composed bundle setup since LSP dependencies are already in #{@gemfile}",
|
70
85
|
)
|
71
86
|
|
72
|
-
# If the user decided to add `ruby-lsp` and `debug` (and potentially `ruby-lsp-rails`) to their Gemfile after
|
73
|
-
# having already run the Ruby LSP, then we need to remove the `.ruby-lsp` folder, otherwise we will run `bundle
|
74
|
-
# install` for the top level and try to execute the Ruby LSP using the custom bundle, which will fail since the
|
75
|
-
# gems are not installed there
|
76
|
-
@custom_dir.rmtree if @custom_dir.exist?
|
77
87
|
return run_bundle_install
|
78
88
|
end
|
79
89
|
|
80
|
-
# Automatically create and ignore the .ruby-lsp folder for users
|
81
|
-
@custom_dir.mkpath unless @custom_dir.exist?
|
82
|
-
ignore_file = @custom_dir + ".gitignore"
|
83
|
-
ignore_file.write("*") unless ignore_file.exist?
|
84
|
-
|
85
90
|
write_custom_gemfile
|
86
91
|
|
87
92
|
unless @gemfile&.exist? && @lockfile&.exist?
|
@@ -89,39 +94,39 @@ module RubyLsp
|
|
89
94
|
return run_bundle_install(@custom_gemfile)
|
90
95
|
end
|
91
96
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
if @custom_lockfile.exist? && @lockfile_hash_path.exist? && @lockfile_hash_path.read == current_lockfile_hash
|
97
|
+
if @lockfile_hash && @custom_lockfile.exist? && @lockfile_hash_path.exist? &&
|
98
|
+
@lockfile_hash_path.read == @lockfile_hash
|
96
99
|
$stderr.puts(
|
97
|
-
"Ruby LSP> Skipping
|
100
|
+
"Ruby LSP> Skipping composed bundle setup since #{@custom_lockfile} already exists and is up to date",
|
98
101
|
)
|
99
102
|
return run_bundle_install(@custom_gemfile)
|
100
103
|
end
|
101
104
|
|
102
105
|
FileUtils.cp(@lockfile.to_s, @custom_lockfile.to_s)
|
103
106
|
correct_relative_remote_paths
|
104
|
-
@lockfile_hash_path.write(
|
107
|
+
@lockfile_hash_path.write(@lockfile_hash)
|
105
108
|
run_bundle_install(@custom_gemfile)
|
106
109
|
end
|
107
110
|
|
108
111
|
private
|
109
112
|
|
110
113
|
sig { returns(T::Hash[String, T.untyped]) }
|
111
|
-
def
|
112
|
-
@
|
114
|
+
def composed_bundle_dependencies
|
115
|
+
@composed_bundle_dependencies ||= T.let(
|
113
116
|
begin
|
117
|
+
original_bundle_gemfile = ENV["BUNDLE_GEMFILE"]
|
118
|
+
|
114
119
|
if @custom_lockfile.exist?
|
115
120
|
ENV["BUNDLE_GEMFILE"] = @custom_gemfile.to_s
|
116
121
|
Bundler::LockfileParser.new(@custom_lockfile.read).dependencies
|
117
122
|
else
|
118
123
|
{}
|
119
124
|
end
|
125
|
+
ensure
|
126
|
+
ENV["BUNDLE_GEMFILE"] = original_bundle_gemfile
|
120
127
|
end,
|
121
128
|
T.nilable(T::Hash[String, T.untyped]),
|
122
129
|
)
|
123
|
-
ensure
|
124
|
-
ENV.delete("BUNDLE_GEMFILE")
|
125
130
|
end
|
126
131
|
|
127
132
|
sig { void }
|
@@ -132,9 +137,9 @@ module RubyLsp
|
|
132
137
|
"",
|
133
138
|
]
|
134
139
|
|
135
|
-
# If there's a top level Gemfile, we want to evaluate from the
|
136
|
-
# Gemfile, so if there isn't one we need to add a default source
|
137
|
-
if @gemfile&.exist?
|
140
|
+
# If there's a top level Gemfile, we want to evaluate from the composed bundle. We get the source from the top
|
141
|
+
# level Gemfile, so if there isn't one we need to add a default source
|
142
|
+
if @gemfile&.exist? && @lockfile&.exist?
|
138
143
|
parts << "eval_gemfile(File.expand_path(\"../#{@gemfile_name}\", __dir__))"
|
139
144
|
else
|
140
145
|
parts.unshift('source "https://rubygems.org"')
|
@@ -183,7 +188,7 @@ module RubyLsp
|
|
183
188
|
env = bundler_settings_as_env
|
184
189
|
env["BUNDLE_GEMFILE"] = bundle_gemfile.to_s
|
185
190
|
|
186
|
-
# If the user has a
|
191
|
+
# If the user has a composed bundle path configured, we need to ensure that we will use the absolute and not
|
187
192
|
# relative version of it when running `bundle install`. This is necessary to avoid installing the gems under the
|
188
193
|
# `.ruby-lsp` folder, which is not the user's intention. For example, if the path is configured as `vendor`, we
|
189
194
|
# want to install it in the top level `vendor` and not `.ruby-lsp/vendor`
|
@@ -191,18 +196,73 @@ module RubyLsp
|
|
191
196
|
env["BUNDLE_PATH"] = File.expand_path(env["BUNDLE_PATH"], @project_path)
|
192
197
|
end
|
193
198
|
|
194
|
-
|
195
|
-
|
196
|
-
|
199
|
+
return run_bundle_install_through_command(env) unless @launcher
|
200
|
+
|
201
|
+
# This same check happens conditionally when running through the command. For invoking the CLI directly, it's
|
202
|
+
# important that we ensure the Bundler version is set to avoid restarts
|
203
|
+
if @bundler_version
|
197
204
|
env["BUNDLER_VERSION"] = @bundler_version.to_s
|
198
205
|
install_bundler_if_needed
|
199
|
-
"bundle _#{@bundler_version}_"
|
200
|
-
else
|
201
|
-
"bundle"
|
202
206
|
end
|
203
207
|
|
208
|
+
begin
|
209
|
+
run_bundle_install_directly(env)
|
210
|
+
# If no error occurred, then clear previous errors
|
211
|
+
@error_path.delete if @error_path.exist?
|
212
|
+
$stderr.puts("Ruby LSP> Composed bundle installation complete")
|
213
|
+
rescue => e
|
214
|
+
# Write the error object to a file so that we can read it from the parent process
|
215
|
+
@error_path.write(Marshal.dump(e))
|
216
|
+
end
|
217
|
+
|
218
|
+
# If either the Gemfile or the lockfile have been modified during the process of setting up the bundle, retry
|
219
|
+
# composing the bundle from scratch
|
220
|
+
|
221
|
+
if @gemfile && @lockfile
|
222
|
+
current_gemfile_hash = Digest::SHA256.hexdigest(@gemfile.read)
|
223
|
+
current_lockfile_hash = Digest::SHA256.hexdigest(@lockfile.read)
|
224
|
+
|
225
|
+
if !@retry && (current_gemfile_hash != @gemfile_hash || current_lockfile_hash != @lockfile_hash)
|
226
|
+
@gemfile_hash = current_gemfile_hash
|
227
|
+
@lockfile_hash = current_lockfile_hash
|
228
|
+
@retry = true
|
229
|
+
@custom_dir.rmtree
|
230
|
+
$stderr.puts("Ruby LSP> Bundle was modified during setup. Retrying from scratch...")
|
231
|
+
return setup!
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
env
|
236
|
+
end
|
237
|
+
|
238
|
+
sig { params(env: T::Hash[String, String]).returns(T::Hash[String, String]) }
|
239
|
+
def run_bundle_install_directly(env)
|
240
|
+
RubyVM::YJIT.enable if defined?(RubyVM::YJIT.enable)
|
241
|
+
T.unsafe(ENV).merge!(env)
|
242
|
+
|
243
|
+
unless should_bundle_update?
|
244
|
+
Bundler::CLI::Install.new({}).run
|
245
|
+
correct_relative_remote_paths if @custom_lockfile.exist?
|
246
|
+
return env
|
247
|
+
end
|
248
|
+
|
249
|
+
# Try to auto upgrade the gems we depend on, unless they are in the Gemfile as that would result in undesired
|
250
|
+
# source control changes
|
251
|
+
gems = ["ruby-lsp", "debug", "prism"].reject { |dep| @dependencies[dep] }
|
252
|
+
gems << "ruby-lsp-rails" if @rails_app && !@dependencies["ruby-lsp-rails"]
|
253
|
+
|
254
|
+
Bundler::CLI::Update.new({ conservative: true }, gems).run
|
255
|
+
correct_relative_remote_paths if @custom_lockfile.exist?
|
256
|
+
@last_updated_path.write(Time.now.iso8601)
|
257
|
+
env
|
258
|
+
end
|
259
|
+
|
260
|
+
sig { params(env: T::Hash[String, String]).returns(T::Hash[String, String]) }
|
261
|
+
def run_bundle_install_through_command(env)
|
262
|
+
base_bundle = base_bundle_command(env)
|
263
|
+
|
204
264
|
# If `ruby-lsp` and `debug` (and potentially `ruby-lsp-rails`) are already in the Gemfile, then we shouldn't try
|
205
|
-
# to upgrade them or else we'll produce undesired source control changes. If the
|
265
|
+
# to upgrade them or else we'll produce undesired source control changes. If the composed bundle was just created
|
206
266
|
# and any of `ruby-lsp`, `ruby-lsp-rails` or `debug` weren't a part of the Gemfile, then we need to run `bundle
|
207
267
|
# install` for the first time to generate the Gemfile.lock with them included or else Bundler will complain that
|
208
268
|
# they're missing. We can only update if the custom `.ruby-lsp/Gemfile.lock` already exists and includes all gems
|
@@ -232,16 +292,16 @@ module RubyLsp
|
|
232
292
|
command << "1>&2"
|
233
293
|
|
234
294
|
# Add bundle update
|
235
|
-
$stderr.puts("Ruby LSP> Running bundle install for the
|
295
|
+
$stderr.puts("Ruby LSP> Running bundle install for the composed bundle. This may take a while...")
|
236
296
|
$stderr.puts("Ruby LSP> Command: #{command}")
|
237
297
|
|
238
|
-
# Try to run the bundle install or update command. If that fails, it normally means that the
|
239
|
-
# a bad state that no longer reflects the top level one. In that case, we can remove the whole directory, try
|
298
|
+
# Try to run the bundle install or update command. If that fails, it normally means that the composed lockfile is
|
299
|
+
# in a bad state that no longer reflects the top level one. In that case, we can remove the whole directory, try
|
240
300
|
# another time and give up if it fails again
|
241
|
-
if !system(env, command) && !@retry && @
|
301
|
+
if !system(env, command) && !@retry && @custom_gemfile.exist?
|
242
302
|
@retry = true
|
243
303
|
@custom_dir.rmtree
|
244
|
-
$stderr.puts("Ruby LSP> Running bundle install failed. Trying to re-generate the
|
304
|
+
$stderr.puts("Ruby LSP> Running bundle install failed. Trying to re-generate the composed bundle from scratch")
|
245
305
|
return setup!
|
246
306
|
end
|
247
307
|
|
@@ -288,14 +348,14 @@ module RubyLsp
|
|
288
348
|
if @rails_app
|
289
349
|
return false if @dependencies.values_at("ruby-lsp", "ruby-lsp-rails", "debug").all?
|
290
350
|
|
291
|
-
# If the
|
292
|
-
# before updating
|
293
|
-
return false if
|
351
|
+
# If the composed lockfile doesn't include `ruby-lsp`, `ruby-lsp-rails` or `debug`, we need to run bundle
|
352
|
+
# install before updating
|
353
|
+
return false if composed_bundle_dependencies.values_at("ruby-lsp", "debug", "ruby-lsp-rails").any?(&:nil?)
|
294
354
|
else
|
295
355
|
return false if @dependencies.values_at("ruby-lsp", "debug").all?
|
296
356
|
|
297
|
-
# If the
|
298
|
-
return false if
|
357
|
+
# If the composed lockfile doesn't include `ruby-lsp` or `debug`, we need to run bundle install before updating
|
358
|
+
return false if composed_bundle_dependencies.values_at("ruby-lsp", "debug").any?(&:nil?)
|
299
359
|
end
|
300
360
|
|
301
361
|
# If the last updated file doesn't exist or was updated more than 4 hours ago, we should update
|
@@ -312,11 +372,14 @@ module RubyLsp
|
|
312
372
|
|
313
373
|
# We should only apply the correction if the remote is a relative path. It might also be a URI, like
|
314
374
|
# `https://rubygems.org` or an absolute path, in which case we shouldn't do anything
|
315
|
-
if path
|
375
|
+
if path && !URI(path).scheme
|
316
376
|
"remote: #{File.expand_path(path, T.must(@gemfile).dirname)}"
|
317
377
|
else
|
318
378
|
match
|
319
379
|
end
|
380
|
+
rescue URI::InvalidURIError, URI::InvalidComponentError
|
381
|
+
# If the path raises an invalid error, it might be a git ssh path, which indeed isn't a URI
|
382
|
+
match
|
320
383
|
end
|
321
384
|
|
322
385
|
@custom_lockfile.write(content)
|
@@ -331,5 +394,49 @@ module RubyLsp
|
|
331
394
|
|
332
395
|
/class .* < (::)?Rails::Application/.match?(application_contents)
|
333
396
|
end
|
397
|
+
|
398
|
+
# Returns the base bundle command we should use for this project, which will be:
|
399
|
+
# - `bundle` if there's no locked Bundler version and no `bin/bundle` binstub in the $PATH
|
400
|
+
# - `bundle _<version>_` if there's a locked Bundler version
|
401
|
+
# - `bin/bundle` if there's a `bin/bundle` binstub in the $PATH
|
402
|
+
sig { params(env: T::Hash[String, String]).returns(String) }
|
403
|
+
def base_bundle_command(env)
|
404
|
+
path_parts = if Gem.win_platform?
|
405
|
+
ENV["Path"] || ENV["PATH"] || ENV["path"] || ""
|
406
|
+
else
|
407
|
+
ENV["PATH"] || ""
|
408
|
+
end.split(File::PATH_SEPARATOR)
|
409
|
+
|
410
|
+
bin_dir = File.expand_path("bin", @project_path)
|
411
|
+
bundle_binstub = File.join(@project_path, "bin", "bundle")
|
412
|
+
|
413
|
+
if File.exist?(bundle_binstub) && path_parts.any? { |path| File.expand_path(path, @project_path) == bin_dir }
|
414
|
+
return bundle_binstub
|
415
|
+
end
|
416
|
+
|
417
|
+
if @bundler_version
|
418
|
+
env["BUNDLER_VERSION"] = @bundler_version.to_s
|
419
|
+
install_bundler_if_needed
|
420
|
+
return "bundle _#{@bundler_version}_"
|
421
|
+
end
|
422
|
+
|
423
|
+
"bundle"
|
424
|
+
end
|
425
|
+
|
426
|
+
sig { void }
|
427
|
+
def patch_thor_to_print_progress_to_stderr!
|
428
|
+
return unless defined?(Bundler::Thor::Shell::Basic)
|
429
|
+
|
430
|
+
Bundler::Thor::Shell::Basic.prepend(Module.new do
|
431
|
+
extend T::Sig
|
432
|
+
|
433
|
+
sig { returns(IO) }
|
434
|
+
def stdout
|
435
|
+
$stderr
|
436
|
+
end
|
437
|
+
end)
|
438
|
+
|
439
|
+
Bundler.ui.level = :info
|
440
|
+
end
|
334
441
|
end
|
335
442
|
end
|
data/lib/ruby_lsp/store.rb
CHANGED
@@ -7,9 +7,6 @@ module RubyLsp
|
|
7
7
|
|
8
8
|
class NonExistingDocumentError < StandardError; end
|
9
9
|
|
10
|
-
sig { returns(T::Boolean) }
|
11
|
-
attr_accessor :supports_progress
|
12
|
-
|
13
10
|
sig { returns(T::Hash[Symbol, RequestConfig]) }
|
14
11
|
attr_accessor :features_configuration
|
15
12
|
|
@@ -19,7 +16,6 @@ module RubyLsp
|
|
19
16
|
sig { void }
|
20
17
|
def initialize
|
21
18
|
@state = T.let({}, T::Hash[String, Document[T.untyped]])
|
22
|
-
@supports_progress = T.let(true, T::Boolean)
|
23
19
|
@features_configuration = T.let(
|
24
20
|
{
|
25
21
|
inlayHint: RequestConfig.new({
|
data/lib/ruby_lsp/utils.rb
CHANGED
@@ -79,6 +79,69 @@ module RubyLsp
|
|
79
79
|
params: Interface::LogMessageParams.new(type: type, message: message),
|
80
80
|
)
|
81
81
|
end
|
82
|
+
|
83
|
+
sig { params(data: T::Hash[Symbol, T.untyped]).returns(Notification) }
|
84
|
+
def telemetry(data)
|
85
|
+
new(
|
86
|
+
method: "telemetry/event",
|
87
|
+
params: data,
|
88
|
+
)
|
89
|
+
end
|
90
|
+
|
91
|
+
sig do
|
92
|
+
params(
|
93
|
+
id: String,
|
94
|
+
title: String,
|
95
|
+
percentage: T.nilable(Integer),
|
96
|
+
message: T.nilable(String),
|
97
|
+
).returns(Notification)
|
98
|
+
end
|
99
|
+
def progress_begin(id, title, percentage: nil, message: nil)
|
100
|
+
new(
|
101
|
+
method: "$/progress",
|
102
|
+
params: Interface::ProgressParams.new(
|
103
|
+
token: id,
|
104
|
+
value: Interface::WorkDoneProgressBegin.new(
|
105
|
+
kind: "begin",
|
106
|
+
title: title,
|
107
|
+
percentage: percentage,
|
108
|
+
message: message,
|
109
|
+
),
|
110
|
+
),
|
111
|
+
)
|
112
|
+
end
|
113
|
+
|
114
|
+
sig do
|
115
|
+
params(
|
116
|
+
id: String,
|
117
|
+
percentage: T.nilable(Integer),
|
118
|
+
message: T.nilable(String),
|
119
|
+
).returns(Notification)
|
120
|
+
end
|
121
|
+
def progress_report(id, percentage: nil, message: nil)
|
122
|
+
new(
|
123
|
+
method: "$/progress",
|
124
|
+
params: Interface::ProgressParams.new(
|
125
|
+
token: id,
|
126
|
+
value: Interface::WorkDoneProgressReport.new(
|
127
|
+
kind: "report",
|
128
|
+
percentage: percentage,
|
129
|
+
message: message,
|
130
|
+
),
|
131
|
+
),
|
132
|
+
)
|
133
|
+
end
|
134
|
+
|
135
|
+
sig { params(id: String).returns(Notification) }
|
136
|
+
def progress_end(id)
|
137
|
+
Notification.new(
|
138
|
+
method: "$/progress",
|
139
|
+
params: Interface::ProgressParams.new(
|
140
|
+
token: id,
|
141
|
+
value: Interface::WorkDoneProgressEnd.new(kind: "end"),
|
142
|
+
),
|
143
|
+
)
|
144
|
+
end
|
82
145
|
end
|
83
146
|
|
84
147
|
extend T::Sig
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lsp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: language_server-protocol
|
@@ -84,6 +84,7 @@ email:
|
|
84
84
|
executables:
|
85
85
|
- ruby-lsp
|
86
86
|
- ruby-lsp-check
|
87
|
+
- ruby-lsp-launcher
|
87
88
|
extensions: []
|
88
89
|
extra_rdoc_files: []
|
89
90
|
files:
|
@@ -92,6 +93,7 @@ files:
|
|
92
93
|
- VERSION
|
93
94
|
- exe/ruby-lsp
|
94
95
|
- exe/ruby-lsp-check
|
96
|
+
- exe/ruby-lsp-launcher
|
95
97
|
- lib/core_ext/uri.rb
|
96
98
|
- lib/rubocop/cop/ruby_lsp/use_language_server_aliases.rb
|
97
99
|
- lib/rubocop/cop/ruby_lsp/use_register_with_handler_method.rb
|
@@ -121,6 +123,7 @@ files:
|
|
121
123
|
- lib/ruby_indexer/test/test_case.rb
|
122
124
|
- lib/ruby_lsp/addon.rb
|
123
125
|
- lib/ruby_lsp/base_server.rb
|
126
|
+
- lib/ruby_lsp/client_capabilities.rb
|
124
127
|
- lib/ruby_lsp/document.rb
|
125
128
|
- lib/ruby_lsp/erb_document.rb
|
126
129
|
- lib/ruby_lsp/global_state.rb
|
@@ -183,6 +186,8 @@ files:
|
|
183
186
|
- lib/ruby_lsp/response_builders/signature_help.rb
|
184
187
|
- lib/ruby_lsp/ruby_document.rb
|
185
188
|
- lib/ruby_lsp/scope.rb
|
189
|
+
- lib/ruby_lsp/scripts/compose_bundle.rb
|
190
|
+
- lib/ruby_lsp/scripts/compose_bundle_windows.rb
|
186
191
|
- lib/ruby_lsp/server.rb
|
187
192
|
- lib/ruby_lsp/setup_bundler.rb
|
188
193
|
- lib/ruby_lsp/static_docs.rb
|
@@ -212,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
217
|
- !ruby/object:Gem::Version
|
213
218
|
version: '0'
|
214
219
|
requirements: []
|
215
|
-
rubygems_version: 3.5.
|
220
|
+
rubygems_version: 3.5.23
|
216
221
|
signing_key:
|
217
222
|
specification_version: 4
|
218
223
|
summary: An opinionated language server for Ruby
|