ruby-lsp-fabrication 0.2.1 → 0.3.0
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: 6dfcaaeba451c5437a79bb927dd6c817c73757112a4168dd4b7d049f48100a71
|
4
|
+
data.tar.gz: d4dc18ec2ffdd331f642c4283c8e27d8f83843fd052539ead712edb31ec6d431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91abb3ec38b1bef86f7d0367dcea20d5567ec5e5285d81dd8b428ec66b97716dbf70abc8fb352eec4d754214553c15e671f318ee1cb40636fe128e56fdcdafa3
|
7
|
+
data.tar.gz: 6aae1b41682d74aa96db2e00c3296ddad751cd33734e90f7715a4d9f31ad30b58fe70752e2869f6a5df02192aae2283ae87779c4e5e7d011321471d638545fc4
|
data/.rubocop.yml
CHANGED
@@ -10,7 +10,7 @@ require_relative 'definition'
|
|
10
10
|
module RubyLsp
|
11
11
|
module Fabrication
|
12
12
|
class Addon < ::RubyLsp::Addon
|
13
|
-
def activate(global_state,
|
13
|
+
def activate(global_state, _message_queue)
|
14
14
|
@index = global_state.index
|
15
15
|
@index.register_enhancement(IndexingEnhancement.new)
|
16
16
|
end
|
@@ -10,13 +10,29 @@ module RubyLsp
|
|
10
10
|
@uri = uri
|
11
11
|
@node_context = node_context
|
12
12
|
@index = index
|
13
|
-
dispatcher.register(self, :
|
13
|
+
dispatcher.register(self, :on_symbol_node_enter)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
16
|
+
def on_symbol_node_enter(node)
|
17
|
+
if @node_context.call_node.message == 'Fabricator' && inherited?(node)
|
18
|
+
entries = @index["#{node.value}Fabricator"]
|
18
19
|
|
19
|
-
|
20
|
+
return if entries.blank? || entries.empty?
|
21
|
+
|
22
|
+
entries.each do |entry|
|
23
|
+
@response_builder << Interface::LocationLink.new(
|
24
|
+
target_uri: URI::Generic.from_path(path: entry.file_path).to_s,
|
25
|
+
target_range: range_from_location(entry.location),
|
26
|
+
target_selection_range: range_from_location(entry.name_location)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
return
|
31
|
+
end
|
32
|
+
|
33
|
+
return unless @node_context.call_node.message == 'Fabricate'
|
34
|
+
|
35
|
+
fabricator_name = generate_fabricator_name(@node_context.call_node)
|
20
36
|
entries = @index[fabricator_name]
|
21
37
|
return if entries.blank? || entries.empty?
|
22
38
|
|
@@ -29,6 +45,21 @@ module RubyLsp
|
|
29
45
|
end
|
30
46
|
end
|
31
47
|
|
48
|
+
def inherited?(node)
|
49
|
+
@node_context.parent.compact_child_nodes.first.compact_child_nodes.each do |n|
|
50
|
+
next unless n.type == :keyword_hash_node
|
51
|
+
|
52
|
+
first_child = n.compact_child_nodes.first
|
53
|
+
next unless first_child.type == :assoc_node
|
54
|
+
next unless first_child.key.value == 'from'
|
55
|
+
next unless first_child.value.value == node.value
|
56
|
+
|
57
|
+
return true
|
58
|
+
end
|
59
|
+
|
60
|
+
false
|
61
|
+
end
|
62
|
+
|
32
63
|
def generate_fabricator_name(node)
|
33
64
|
arguments = node.compact_child_nodes.first
|
34
65
|
name = arguments.compact_child_nodes.first.value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lsp-fabrication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac McAuley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-lsp
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
64
|
+
rubygems_version: 3.5.16
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: Ruby LSP Addon for Fabrication support
|