ruby-lsp 0.23.3 → 0.23.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95642b8034d20684e2596755f391591d6dfffc9021e23a6e2efd0b9a0e500eb0
4
- data.tar.gz: 6db469fda24144ce71eb0c2d8434251b3bf01a800035d85bea5e8e6801cf5120
3
+ metadata.gz: 924e57270229eb4d0b709b01023d16f414591f8ea40c3b8a51ae6fb6cd09cc4f
4
+ data.tar.gz: 72f4f544baf412f8580fe28287ba5324c7f646a9436797ebea59f34f3712d62e
5
5
  SHA512:
6
- metadata.gz: 69365797e36c6597b43b5067da2e10b6c634cdb9121081db0e7c16c657fe12e2aa72042ba7beb07480b1cbb4a24c9a37a7a71f5a49a1be42923adb7a85a80715
7
- data.tar.gz: 22695e4a4fd4e72738b43c32e9a693ed9895033e82240317700cde5583537b0ad6e7d8ce530a110624c57278d5a08c4eeb207ae010a4db99b3885bc241c5caa4
6
+ metadata.gz: 650cf172b8b1408f5498cb2010c2f94b3ef0a4bc93212ef63e24c2177ef5996455625a1bb64fe51f75322a42625e9ebcf156f95f5412c44839fe4957df4c957f
7
+ data.tar.gz: ce9b866443836810fe5884c2f977d4fd91fe020023ff547a9d60e525715ce388429aa7a901b0acc84876d68cada8f30dac2836494b7403fd8c2e845bea86ce79
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.23.3
1
+ 0.23.5
@@ -7,6 +7,7 @@
7
7
  # !!!!!!!
8
8
 
9
9
  setup_error = nil
10
+ install_error = nil
10
11
 
11
12
  # Read the initialize request before even starting the server. We need to do this to figure out the workspace URI.
12
13
  # Editors are not required to spawn the language server process on the same directory as the workspace URI, so we need
@@ -45,12 +46,6 @@ rescue Errno::ECHILD
45
46
  # In theory, the child process can finish before we even get to the wait call, but that is not an error
46
47
  end
47
48
 
48
- error_path = File.join(".ruby-lsp", "install_error")
49
-
50
- install_error = if File.exist?(error_path)
51
- Marshal.load(File.read(error_path))
52
- end
53
-
54
49
  begin
55
50
  bundle_env_path = File.join(".ruby-lsp", "bundle_env")
56
51
  # We can't require `bundler/setup` because that file prematurely exits the process if setup fails. However, we can't
@@ -67,6 +62,14 @@ begin
67
62
 
68
63
  require "bundler"
69
64
  Bundler.ui.level = :silent
65
+
66
+ # This Marshal load can only happen after requiring Bundler because it will load a custom error class from Bundler
67
+ # itself. If we try to load before requiring, the class will not be defined and loading will fail
68
+ error_path = File.join(".ruby-lsp", "install_error")
69
+ install_error = if File.exist?(error_path)
70
+ Marshal.load(File.read(error_path))
71
+ end
72
+
70
73
  Bundler.setup
71
74
  $stderr.puts("Composed Bundle set up successfully")
72
75
  end
@@ -100,11 +100,7 @@ module RubyLsp
100
100
  @writer.write(Result.new(id: message[:id], response: nil).to_hash)
101
101
  end
102
102
  when "exit"
103
- @global_state.synchronize do
104
- status = @incoming_queue.closed? ? 0 : 1
105
- send_log_message("Shutdown complete with status #{status}")
106
- exit(status)
107
- end
103
+ @global_state.synchronize { exit(@incoming_queue.closed? ? 0 : 1) }
108
104
  else
109
105
  @incoming_queue << message
110
106
  end
@@ -119,8 +115,8 @@ module RubyLsp
119
115
  @outgoing_queue.close
120
116
  @cancelled_requests.clear
121
117
 
122
- @worker.join
123
- @outgoing_dispatcher.join
118
+ @worker.terminate
119
+ @outgoing_dispatcher.terminate
124
120
  @store.clear
125
121
  end
126
122
 
@@ -31,7 +31,7 @@ module RubyLsp
31
31
 
32
32
  # TODO: avoid passing document once we have alternative ways to get at
33
33
  # encoding and file source
34
- sig { params(document: RubyDocument, offense: RuboCop::Cop::Offense, uri: URI::Generic).void }
34
+ sig { params(document: RubyDocument, offense: ::RuboCop::Cop::Offense, uri: URI::Generic).void }
35
35
  def initialize(document, offense, uri)
36
36
  @document = document
37
37
  @offense = offense
@@ -48,7 +48,7 @@ module RubyLsp
48
48
  code_actions
49
49
  end
50
50
 
51
- sig { params(config: RuboCop::Config).returns(Interface::Diagnostic) }
51
+ sig { params(config: ::RuboCop::Config).returns(Interface::Diagnostic) }
52
52
  def to_lsp_diagnostic(config)
53
53
  # highlighted_area contains the begin and end position of the first line
54
54
  # This ensures that multiline offenses don't clutter the editor
@@ -90,7 +90,7 @@ module RubyLsp
90
90
  RUBOCOP_TO_LSP_SEVERITY[@offense.severity.name]
91
91
  end
92
92
 
93
- sig { params(config: RuboCop::Config).returns(T.nilable(Interface::CodeDescription)) }
93
+ sig { params(config: ::RuboCop::Config).returns(T.nilable(Interface::CodeDescription)) }
94
94
  def code_description(config)
95
95
  cop = RuboCopRunner.find_cop_by_name(@offense.cop_name)
96
96
  return unless cop
@@ -40,10 +40,10 @@ module RubyLsp
40
40
  For more details, run RuboCop on the command line.
41
41
  EOS
42
42
 
43
- sig { params(rubocop_error: T.any(RuboCop::ErrorWithAnalyzedFileLocation, StandardError)).void }
43
+ sig { params(rubocop_error: T.any(::RuboCop::ErrorWithAnalyzedFileLocation, StandardError)).void }
44
44
  def initialize(rubocop_error)
45
45
  message = case rubocop_error
46
- when RuboCop::ErrorWithAnalyzedFileLocation
46
+ when ::RuboCop::ErrorWithAnalyzedFileLocation
47
47
  format(MESSAGE, "for the #{rubocop_error.cop.name} cop")
48
48
  when StandardError
49
49
  format(MESSAGE, rubocop_error.message)
@@ -53,7 +53,7 @@ module RubyLsp
53
53
  end
54
54
 
55
55
  # :nodoc:
56
- class RuboCopRunner < RuboCop::Runner
56
+ class RuboCopRunner < ::RuboCop::Runner
57
57
  extend T::Sig
58
58
 
59
59
  class ConfigurationError < StandardError; end
@@ -68,14 +68,14 @@ module RubyLsp
68
68
  T::Array[String],
69
69
  )
70
70
 
71
- sig { returns(T::Array[RuboCop::Cop::Offense]) }
71
+ sig { returns(T::Array[::RuboCop::Cop::Offense]) }
72
72
  attr_reader :offenses
73
73
 
74
74
  sig { returns(::RuboCop::Config) }
75
75
  attr_reader :config_for_working_directory
76
76
 
77
77
  begin
78
- RuboCop::Options.new.parse(["--raise-cop-error"])
78
+ ::RuboCop::Options.new.parse(["--raise-cop-error"])
79
79
  DEFAULT_ARGS << "--raise-cop-error"
80
80
  rescue OptionParser::InvalidOption
81
81
  # older versions of RuboCop don't support this flag
@@ -85,7 +85,7 @@ module RubyLsp
85
85
  sig { params(args: String).void }
86
86
  def initialize(*args)
87
87
  @options = T.let({}, T::Hash[Symbol, T.untyped])
88
- @offenses = T.let([], T::Array[RuboCop::Cop::Offense])
88
+ @offenses = T.let([], T::Array[::RuboCop::Cop::Offense])
89
89
  @errors = T.let([], T::Array[String])
90
90
  @warnings = T.let([], T::Array[String])
91
91
 
@@ -113,9 +113,9 @@ module RubyLsp
113
113
  # RuboCop rescues interrupts and then sets the `@aborting` variable to true. We don't want them to be rescued,
114
114
  # so here we re-raise in case RuboCop received an interrupt.
115
115
  raise Interrupt if aborting?
116
- rescue RuboCop::Runner::InfiniteCorrectionLoop => error
116
+ rescue ::RuboCop::Runner::InfiniteCorrectionLoop => error
117
117
  raise Formatting::Error, error.message
118
- rescue RuboCop::ValidationError => error
118
+ rescue ::RuboCop::ValidationError => error
119
119
  raise ConfigurationError, error.message
120
120
  rescue StandardError => error
121
121
  raise InternalRuboCopError, error
@@ -129,25 +129,25 @@ module RubyLsp
129
129
  class << self
130
130
  extend T::Sig
131
131
 
132
- sig { params(cop_name: String).returns(T.nilable(T.class_of(RuboCop::Cop::Base))) }
132
+ sig { params(cop_name: String).returns(T.nilable(T.class_of(::RuboCop::Cop::Base))) }
133
133
  def find_cop_by_name(cop_name)
134
134
  cop_registry[cop_name]&.first
135
135
  end
136
136
 
137
137
  private
138
138
 
139
- sig { returns(T::Hash[String, [T.class_of(RuboCop::Cop::Base)]]) }
139
+ sig { returns(T::Hash[String, [T.class_of(::RuboCop::Cop::Base)]]) }
140
140
  def cop_registry
141
141
  @cop_registry ||= T.let(
142
- RuboCop::Cop::Registry.global.to_h,
143
- T.nilable(T::Hash[String, [T.class_of(RuboCop::Cop::Base)]]),
142
+ ::RuboCop::Cop::Registry.global.to_h,
143
+ T.nilable(T::Hash[String, [T.class_of(::RuboCop::Cop::Base)]]),
144
144
  )
145
145
  end
146
146
  end
147
147
 
148
148
  private
149
149
 
150
- sig { params(_file: String, offenses: T::Array[RuboCop::Cop::Offense]).void }
150
+ sig { params(_file: String, offenses: T::Array[::RuboCop::Cop::Offense]).void }
151
151
  def file_finished(_file, offenses)
152
152
  @offenses = offenses
153
153
  end
@@ -339,7 +339,7 @@ module RubyLsp
339
339
  if defined?(Requests::Support::RuboCopFormatter)
340
340
  begin
341
341
  @global_state.register_formatter("rubocop", Requests::Support::RuboCopFormatter.new)
342
- rescue RuboCop::Error => e
342
+ rescue ::RuboCop::Error => e
343
343
  # The user may have provided unknown config switches in .rubocop or
344
344
  # is trying to load a non-existent config file.
345
345
  send_message(Notification.window_show_message(
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.3
4
+ version: 0.23.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-09 00:00:00.000000000 Z
10
+ date: 2025-01-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: language_server-protocol