ruby-lsp-rails 0.4.5 → 0.4.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc55b4c0d67bcf2d51cfece504e53483ce6cc744fa482042bf8c9cdc5b6713e6
|
4
|
+
data.tar.gz: aa657a320f52d7b97dff961045d2e8144e04a5390889c00c41ba65ab5b9c8112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b9e0856f031b24d5d97569db824d7781c10d0243099614d1bace814e46f326e280342ef451cef46ac1a9d28f9974ea8487b3dd35cae353ad79be7147fca726e
|
7
|
+
data.tar.gz: e1d0e2840d2b41d3af0a139f45a1c4546dcd87130812764f1a0051285ff148c2b6ff5cbcbdfed7944e6e89f9ffd6e11267140fd208ec7669195fae5f351c6404
|
@@ -36,7 +36,7 @@ module RubyLsp
|
|
36
36
|
resolved_class = @client.model(receiver.name.to_s)
|
37
37
|
return if resolved_class.nil?
|
38
38
|
|
39
|
-
arguments = @node_context.call_node
|
39
|
+
arguments = @node_context.call_node&.arguments&.arguments
|
40
40
|
indexed_call_node_args = {} #: Hash[String, Prism::Node]
|
41
41
|
|
42
42
|
if arguments
|
@@ -29,18 +29,20 @@ module RubyLsp
|
|
29
29
|
#: (Prism::ConstantPathNode node) -> void
|
30
30
|
def on_constant_path_node_enter(node)
|
31
31
|
entries = @index.resolve(node.slice, @nesting)
|
32
|
-
|
32
|
+
item = entries&.first
|
33
|
+
return unless item
|
33
34
|
|
34
|
-
name =
|
35
|
+
name = item.name
|
35
36
|
generate_column_content(name)
|
36
37
|
end
|
37
38
|
|
38
39
|
#: (Prism::ConstantReadNode node) -> void
|
39
40
|
def on_constant_read_node_enter(node)
|
40
41
|
entries = @index.resolve(node.name.to_s, @nesting)
|
41
|
-
|
42
|
+
item = entries&.first
|
43
|
+
return unless item
|
42
44
|
|
43
|
-
generate_column_content(
|
45
|
+
generate_column_content(item.name)
|
44
46
|
end
|
45
47
|
|
46
48
|
private
|
@@ -53,10 +53,10 @@ module RubyLsp
|
|
53
53
|
#: (ResponseBuilders::TestCollection response_builder, GlobalState global_state, Prism::Dispatcher dispatcher, URI::Generic uri) -> void
|
54
54
|
def initialize(response_builder, global_state, dispatcher, uri)
|
55
55
|
@parent_stack = [response_builder] #: Array[(Requests::Support::TestItem | ResponseBuilders::TestCollection)?]
|
56
|
-
super(response_builder, global_state,
|
56
|
+
super(response_builder, global_state, uri)
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
register_events(
|
59
|
+
dispatcher,
|
60
60
|
:on_class_node_enter,
|
61
61
|
:on_call_node_enter,
|
62
62
|
:on_def_node_enter,
|
@@ -68,8 +68,10 @@ module RubyLsp
|
|
68
68
|
send_error_response("Request #{request_name} failed because database connection was not established.")
|
69
69
|
rescue ActiveRecord::NoDatabaseError
|
70
70
|
send_error_response("Request #{request_name} failed because the database does not exist.")
|
71
|
-
rescue => e
|
72
|
-
send_error_response("Request #{request_name} failed:\n#{e.full_message(highlight: false)}")
|
71
|
+
rescue NotImplementedError, LoadError, SyntaxError, SystemExit, SystemStackError => e
|
72
|
+
send_error_response("Request #{request_name} failed with #{e.class}:\n#{e.full_message(highlight: false)}")
|
73
|
+
rescue StandardError => e
|
74
|
+
send_error_response("Request #{request_name} failed with StandardError:\n#{e.full_message(highlight: false)}")
|
73
75
|
end
|
74
76
|
|
75
77
|
# Handle possible errors for a notification. This should only be used for notifications, which means messages that
|
@@ -82,8 +84,10 @@ module RubyLsp
|
|
82
84
|
log_message("Request #{notification_name} failed because database connection was not established.")
|
83
85
|
rescue ActiveRecord::NoDatabaseError
|
84
86
|
log_message("Request #{notification_name} failed because the database does not exist.")
|
85
|
-
rescue => e
|
86
|
-
log_message("Request #{notification_name} failed:\n#{e.full_message(highlight: false)}")
|
87
|
+
rescue NotImplementedError, LoadError, SyntaxError, SystemExit, SystemStackError => e
|
88
|
+
log_message("Request #{notification_name} failed with #{e.class}:\n#{e.full_message(highlight: false)}")
|
89
|
+
rescue StandardError => e
|
90
|
+
log_message("Request #{notification_name} failed with StandardError:\n#{e.full_message(highlight: false)}")
|
87
91
|
end
|
88
92
|
|
89
93
|
#: (String, String, ?percentage: Integer?, ?message: String?) -> void
|
@@ -401,7 +405,7 @@ module RubyLsp
|
|
401
405
|
|
402
406
|
#: (String) -> Hash[Symbol | String, untyped]?
|
403
407
|
def resolve_database_info_from_model(model_name)
|
404
|
-
const = ActiveSupport::Inflector.safe_constantize(model_name)
|
408
|
+
const = ActiveSupport::Inflector.safe_constantize(model_name) # rubocop:disable Sorbet/ConstantsFromStrings
|
405
409
|
return unless active_record_model?(const)
|
406
410
|
|
407
411
|
info = {
|
@@ -420,7 +424,7 @@ module RubyLsp
|
|
420
424
|
|
421
425
|
#: (Hash[Symbol | String, untyped]) -> Hash[Symbol | String, untyped]?
|
422
426
|
def resolve_association_target(params)
|
423
|
-
const = ActiveSupport::Inflector.safe_constantize(params[:model_name])
|
427
|
+
const = ActiveSupport::Inflector.safe_constantize(params[:model_name]) # rubocop:disable Sorbet/ConstantsFromStrings
|
424
428
|
return unless active_record_model?(const)
|
425
429
|
|
426
430
|
association_klass = const.reflect_on_association(params[:association_name].intern).klass
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lsp-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
@@ -15,20 +15,20 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.
|
18
|
+
version: 0.25.0
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.26.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.25.0
|
29
29
|
- - "<"
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0.
|
31
|
+
version: 0.26.0
|
32
32
|
description: A Ruby LSP addon that adds extra editor functionality for Rails applications
|
33
33
|
email:
|
34
34
|
- ruby@shopify.com
|