ruby-lsp-rake 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -0
- data/lib/ruby/lsp/rake/version.rb +1 -1
- data/lib/ruby_lsp/ruby_lsp_rake/hover.rb +9 -6
- data/lib/ruby_lsp/ruby_lsp_rake/indexing_enhancement.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bdcde0bdc4ebc43f2cf72c1644ff98491d779e076beaaa7aa2fbf164dc3d979
|
4
|
+
data.tar.gz: ff5f37d8872ada12e8ffd0cbdc9eef136059d4018551135eda1fe50930d01372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ca6d230be2bac1c0aba848922adc32307a546d7023f710a103bcd9c040c14ed6fa1062c7a75e2cea8c3ea6285c86b2f19c1c23d8247d2915087322d5eeda833
|
7
|
+
data.tar.gz: 85f04c0bc96f657718961cad0f449751d8d96e13c28a6ae9978df499406f9e8c55e9d45811c1737cf7012fc5855e0201bffcf4fc15cd09aeff67c670180d961c
|
data/Rakefile
CHANGED
@@ -9,8 +9,7 @@ module RubyLsp
|
|
9
9
|
def initialize(response_builder, node_context, dispatcher, index)
|
10
10
|
@response_builder = response_builder
|
11
11
|
@node_context = node_context
|
12
|
-
dispatcher.register(self, :on_string_node_enter)
|
13
|
-
dispatcher.register(self, :on_symbol_node_enter)
|
12
|
+
dispatcher.register(self, :on_string_node_enter, :on_symbol_node_enter)
|
14
13
|
@index = index
|
15
14
|
end
|
16
15
|
|
@@ -36,17 +35,21 @@ module RubyLsp
|
|
36
35
|
task_name = "task_#{name}"
|
37
36
|
return unless @index.indexed? task_name
|
38
37
|
|
38
|
+
# refer to: https://github.com/Shopify/ruby-lsp/blob/896617a0c5f7a22ebe12912a481bf1b59db14c12/lib/ruby_lsp/requests/support/common.rb#L83
|
39
|
+
content = +""
|
39
40
|
entries = @index[task_name]
|
40
|
-
|
41
|
-
label = "task :#{name}"
|
41
|
+
links = entries.map do |entry|
|
42
42
|
loc = entry.location
|
43
43
|
uri = T.unsafe(URI::Generic).from_path(
|
44
44
|
path: entry.file_path,
|
45
45
|
fragment: "L#{loc.start_line},#{loc.start_column + 1}-#{loc.end_line},#{loc.end_column + 1}"
|
46
46
|
)
|
47
|
-
"
|
47
|
+
content << "\n\n#{entry.comments}" unless entry.comments.empty?
|
48
|
+
"[#{entry.file_name}](#{uri})"
|
48
49
|
end
|
49
|
-
@response_builder.push("
|
50
|
+
@response_builder.push("```\nrake #{name}\n```", category: :title)
|
51
|
+
@response_builder.push("Definitions: #{links.join(" | ")}", category: :links)
|
52
|
+
@response_builder.push(content, category: :documentation)
|
50
53
|
end
|
51
54
|
end
|
52
55
|
end
|
@@ -4,9 +4,13 @@
|
|
4
4
|
module RubyLsp
|
5
5
|
module Rake
|
6
6
|
class IndexingEnhancement < RubyIndexer::Enhancement # rubocop:disable Style/Documentation
|
7
|
+
@last_desc = nil
|
8
|
+
|
7
9
|
def on_call_node_enter(node) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
10
|
+
@last_desc = nil unless node.name == :task
|
11
|
+
|
8
12
|
return unless @listener.current_owner.nil?
|
9
|
-
return unless node.name == :task
|
13
|
+
return unless node.name == :task || node.name == :desc
|
10
14
|
|
11
15
|
arguments = node.arguments&.arguments
|
12
16
|
return unless arguments
|
@@ -33,12 +37,20 @@ module RubyLsp
|
|
33
37
|
|
34
38
|
return if name.nil?
|
35
39
|
|
40
|
+
if node.name == :desc
|
41
|
+
@last_desc = name
|
42
|
+
return
|
43
|
+
end
|
44
|
+
|
36
45
|
location = node.location
|
37
46
|
@listener.add_method(
|
38
47
|
"task_#{name}",
|
39
48
|
location,
|
40
|
-
[]
|
49
|
+
[],
|
50
|
+
comments: @last_desc
|
41
51
|
)
|
52
|
+
|
53
|
+
@last_desc = nil
|
42
54
|
end
|
43
55
|
|
44
56
|
def on_call_node_leave(node); end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lsp-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koji NAKAMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-lsp
|