ruby-lsp-rails 0.3.19 → 0.3.21

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: 68571fad74f7aaf4caf243921b544515d55a0121dfcb4edf012ec39cdb77edf7
4
- data.tar.gz: 2b703f0d4c79171e186722f77b779036df5ca9e40c8025b0ed62688c546871b2
3
+ metadata.gz: feb1936ab1a1b20409425b3d644ab0e3c158b6f21a6bdf024d73013ccac28120
4
+ data.tar.gz: f32daf2f444a0ca0fa2a55b0d2bdef2d67abfcf40b4bae5cd351eede9b50dc11
5
5
  SHA512:
6
- metadata.gz: 33f5e99f7c2dd576ef8cc98d5e33f99909fee41adfe1ea9aa5692c0b4a24e31d3dec55080cc791a3f5e500e0fcba3aa4596a26350fc12c990b030cf51fe7ffde
7
- data.tar.gz: 040b46b1fe55910199605c39b3193227ba634d9ff6adaf06a334036c05430b38a2ccfb593748752fbe0cbac3aa7a6a8c3e81192b4c3e4258e8a1ad90a6abfb53
6
+ metadata.gz: 72082ba3519fec8b3453201b9ffa9a270d745bdb4abff0e70edce58ad82024aae836a604bcdbdcec73f54faaae8b28e5a646ffec4bd0910c88099d425f3a6606
7
+ data.tar.gz: 4c53919cae2b20d3dbd6402721ebe9470ba89ab4a2db24cbc61f04484d8b19c23c7c99017042ac09fff55e4f3cf34c2830890a270245b89011a0691ba6ab11f1
@@ -141,7 +141,7 @@ module RubyLsp
141
141
 
142
142
  arg_receiver = argument.receiver
143
143
 
144
- name = arg_receiver.full_name if arg_receiver.is_a?(Prism::ConstantReadNode) ||
144
+ name = constant_name(arg_receiver) if arg_receiver.is_a?(Prism::ConstantReadNode) ||
145
145
  arg_receiver.is_a?(Prism::ConstantPathNode)
146
146
  next unless name
147
147
 
@@ -201,8 +201,8 @@ module RubyLsp
201
201
  arguments.each do |argument|
202
202
  case argument
203
203
  when Prism::ConstantReadNode, Prism::ConstantPathNode
204
- name = argument.full_name
205
- next if name.empty?
204
+ name = constant_name(argument)
205
+ next unless name
206
206
 
207
207
  append_document_symbol(
208
208
  name: "#{message} #{name}",
@@ -15,8 +15,8 @@ module RubyLsp
15
15
  @stdout.write("Content-Length: #{json_message.length}\r\n\r\n#{json_message}")
16
16
  end
17
17
 
18
- # Log a debug message to the editor's output
19
- def debug_message(message)
18
+ # Log a message to the editor's output panel
19
+ def log_message(message)
20
20
  $stderr.puts(message)
21
21
  end
22
22
  end
@@ -119,12 +119,17 @@ module RubyLsp
119
119
  require params[:server_addon_path]
120
120
  ServerAddon.finalize_registrations!(@stdout)
121
121
  when "server_addon/delegate"
122
- server_addon_name = params.delete(:server_addon_name)
123
- request_name = params.delete(:request_name)
124
- ServerAddon.delegate(server_addon_name, request_name, params)
122
+ server_addon_name = params[:server_addon_name]
123
+ request_name = params[:request_name]
124
+ ServerAddon.delegate(server_addon_name, request_name, params.except(:request_name, :server_addon_name))
125
125
  end
126
+ request_name = request
127
+ request_name = "#{params[:server_addon_name]}##{params[:request_name]}" if request == "server_addon/delegate"
128
+ # Since this is a common problem, we show a specific error message to the user, instead of the full stack trace.
129
+ rescue ActiveRecord::ConnectionNotEstablished
130
+ log_message("Request #{request_name} failed because database connection was not established.")
126
131
  rescue => e
127
- send_message({ error: e.full_message(highlight: false) })
132
+ log_message("Request #{request_name} failed:\n" + e.full_message(highlight: false))
128
133
  end
129
134
 
130
135
  private
@@ -141,8 +146,10 @@ module RubyLsp
141
146
  ::Rails.application.routes.routes.find { |route| route.requirements == requirements }
142
147
  end
143
148
 
144
- if route&.source_location
145
- file, _, line = route.source_location.rpartition(":")
149
+ source_location = route&.respond_to?(:source_location) && route.source_location
150
+
151
+ if source_location
152
+ file, _, line = source_location.rpartition(":")
146
153
  body = {
147
154
  source_location: [::Rails.root.join(file).to_s, line],
148
155
  verb: route.verb,
@@ -3,6 +3,6 @@
3
3
 
4
4
  module RubyLsp
5
5
  module Rails
6
- VERSION = "0.3.19"
6
+ VERSION = "0.3.21"
7
7
  end
8
8
  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.19
4
+ version: 0.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-11 00:00:00.000000000 Z
11
+ date: 2024-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-lsp
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.5.21
83
+ rubygems_version: 3.5.22
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: A Ruby LSP addon for Rails