ruby-lsp-rails 0.3.24 → 0.3.26
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df7c6791cb1fc007fc4705e034eb60cde1d5905a1771b145c2d4bb6f36224658
|
4
|
+
data.tar.gz: 1fdd80b7787bf31a237aa9f9f196c3170ee5e612ce8105c2fc20a63fd9027f73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8de8df639f440b7bcedb854e03ead56eb56517569dc31938759593cce32ff87d968b07b88598de01939fab8d3e1b8bb73108cf21b85c7f30493093d1f8d2973a
|
7
|
+
data.tar.gz: 69550bcd5575bf7d8f6f82e7e738e53392fd776534dc88495274ab500e9ea3e11472e1008d05fe27de3ae40beee9a43d039be49866902e569ec7fdd0c91af161
|
@@ -43,8 +43,9 @@ module RubyLsp
|
|
43
43
|
end
|
44
44
|
|
45
45
|
class InitializationError < StandardError; end
|
46
|
-
class
|
47
|
-
class
|
46
|
+
class MessageError < StandardError; end
|
47
|
+
class IncompleteMessageError < MessageError; end
|
48
|
+
class EmptyMessageError < MessageError; end
|
48
49
|
|
49
50
|
extend T::Sig
|
50
51
|
|
@@ -115,7 +116,7 @@ module RubyLsp
|
|
115
116
|
sig { params(server_addon_path: String).void }
|
116
117
|
def register_server_addon(server_addon_path)
|
117
118
|
send_notification("server_addon/register", server_addon_path: server_addon_path)
|
118
|
-
rescue
|
119
|
+
rescue MessageError
|
119
120
|
log_message(
|
120
121
|
"Ruby LSP Rails failed to register server addon #{server_addon_path}",
|
121
122
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -126,7 +127,7 @@ module RubyLsp
|
|
126
127
|
sig { params(name: String).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
|
127
128
|
def model(name)
|
128
129
|
make_request("model", name: name)
|
129
|
-
rescue
|
130
|
+
rescue MessageError
|
130
131
|
log_message(
|
131
132
|
"Ruby LSP Rails failed to get model information",
|
132
133
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -146,7 +147,7 @@ module RubyLsp
|
|
146
147
|
model_name: model_name,
|
147
148
|
association_name: association_name,
|
148
149
|
)
|
149
|
-
rescue
|
150
|
+
rescue MessageError
|
150
151
|
log_message(
|
151
152
|
"Ruby LSP Rails failed to get association location",
|
152
153
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -157,7 +158,7 @@ module RubyLsp
|
|
157
158
|
sig { params(name: String).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
|
158
159
|
def route_location(name)
|
159
160
|
make_request("route_location", name: name)
|
160
|
-
rescue
|
161
|
+
rescue MessageError
|
161
162
|
log_message(
|
162
163
|
"Ruby LSP Rails failed to get route location",
|
163
164
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -168,7 +169,7 @@ module RubyLsp
|
|
168
169
|
sig { params(controller: String, action: String).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
|
169
170
|
def route(controller:, action:)
|
170
171
|
make_request("route_info", controller: controller, action: action)
|
171
|
-
rescue
|
172
|
+
rescue MessageError
|
172
173
|
log_message(
|
173
174
|
"Ruby LSP Rails failed to get route information",
|
174
175
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -191,7 +192,7 @@ module RubyLsp
|
|
191
192
|
def pending_migrations_message
|
192
193
|
response = make_request("pending_migrations_message")
|
193
194
|
response[:pending_migrations_message] if response
|
194
|
-
rescue
|
195
|
+
rescue MessageError
|
195
196
|
log_message(
|
196
197
|
"Ruby LSP Rails failed when checking for pending migrations",
|
197
198
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -202,7 +203,7 @@ module RubyLsp
|
|
202
203
|
sig { returns(T.nilable(T::Hash[Symbol, T.untyped])) }
|
203
204
|
def run_migrations
|
204
205
|
make_request("run_migrations")
|
205
|
-
rescue
|
206
|
+
rescue MessageError
|
206
207
|
log_message(
|
207
208
|
"Ruby LSP Rails failed to run migrations",
|
208
209
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -225,7 +226,7 @@ module RubyLsp
|
|
225
226
|
request_name: request_name,
|
226
227
|
**params,
|
227
228
|
)
|
228
|
-
rescue
|
229
|
+
rescue MessageError
|
229
230
|
nil
|
230
231
|
end
|
231
232
|
|
@@ -233,7 +234,7 @@ module RubyLsp
|
|
233
234
|
def trigger_reload
|
234
235
|
log_message("Reloading Rails application")
|
235
236
|
send_notification("reload")
|
236
|
-
rescue
|
237
|
+
rescue MessageError
|
237
238
|
log_message(
|
238
239
|
"Ruby LSP Rails failed to trigger reload",
|
239
240
|
type: RubyLsp::Constant::MessageType::ERROR,
|
@@ -19,6 +19,7 @@ module RubyLsp
|
|
19
19
|
# Log a message to the editor's output panel
|
20
20
|
def log_message(message)
|
21
21
|
$stderr.puts(message)
|
22
|
+
send_message({ result: nil })
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -103,6 +104,9 @@ module RubyLsp
|
|
103
104
|
end
|
104
105
|
|
105
106
|
def execute(request, params)
|
107
|
+
request_name = request
|
108
|
+
request_name = "#{params[:server_addon_name]}##{params[:request_name]}" if request == "server_addon/delegate"
|
109
|
+
|
106
110
|
case request
|
107
111
|
when "shutdown"
|
108
112
|
@running = false
|
@@ -128,11 +132,11 @@ module RubyLsp
|
|
128
132
|
request_name = params[:request_name]
|
129
133
|
ServerAddon.delegate(server_addon_name, request_name, params.except(:request_name, :server_addon_name))
|
130
134
|
end
|
131
|
-
request_name = request
|
132
|
-
request_name = "#{params[:server_addon_name]}##{params[:request_name]}" if request == "server_addon/delegate"
|
133
135
|
# Since this is a common problem, we show a specific error message to the user, instead of the full stack trace.
|
134
136
|
rescue ActiveRecord::ConnectionNotEstablished
|
135
137
|
log_message("Request #{request_name} failed because database connection was not established.")
|
138
|
+
rescue ActiveRecord::NoDatabaseError
|
139
|
+
log_message("Request #{request_name} failed because the database does not exist.")
|
136
140
|
rescue => e
|
137
141
|
log_message("Request #{request_name} failed:\n" + e.full_message(highlight: false))
|
138
142
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lsp-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-lsp
|