ruby-lsp 0.23.4 → 0.23.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/exe/ruby-lsp-launcher +9 -6
- data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +3 -3
- data/lib/ruby_lsp/requests/support/rubocop_runner.rb +13 -13
- data/lib/ruby_lsp/server.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 924e57270229eb4d0b709b01023d16f414591f8ea40c3b8a51ae6fb6cd09cc4f
|
4
|
+
data.tar.gz: 72f4f544baf412f8580fe28287ba5324c7f646a9436797ebea59f34f3712d62e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 650cf172b8b1408f5498cb2010c2f94b3ef0a4bc93212ef63e24c2177ef5996455625a1bb64fe51f75322a42625e9ebcf156f95f5412c44839fe4957df4c957f
|
7
|
+
data.tar.gz: ce9b866443836810fe5884c2f977d4fd91fe020023ff547a9d60e525715ce388429aa7a901b0acc84876d68cada8f30dac2836494b7403fd8c2e845bea86ce79
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.23.
|
1
|
+
0.23.5
|
data/exe/ruby-lsp-launcher
CHANGED
@@ -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
|
@@ -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
|
data/lib/ruby_lsp/server.rb
CHANGED
@@ -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(
|