solargraph 0.39.8 → 0.39.9
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 +4 -4
- data/lib/solargraph/library.rb +1 -1
- data/lib/solargraph/pin/method.rb +1 -1
- data/lib/solargraph/source_map.rb +1 -0
- data/lib/solargraph/source_map/mapper.rb +19 -7
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map/rdoc_to_yard.rb +12 -10
- 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: aafa8f2eb715c3a50670e40b951c2965b66c4391f0fd3809cc18640038de8d4e
|
|
4
|
+
data.tar.gz: 162435cd9263a0e1a97762c48b2b77f654c8775c9461614b9c8700c554ad2bfb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a08253ac143f7d5367f5cfc21d719114ff692065e2b4d9343a73dee8be883e1c219a991d3ae64d91566b18df4449ce122aa998c28392fd769184da8f574d8080
|
|
7
|
+
data.tar.gz: f748e9b60cedc4c4e1862be52043c9dfa9f79bbefe9ce209ab5f80dfce21df7342eed664d890d32b57e7f4b0f850f74c45e9fef788eadb2b9ebe03f8eb55df9f
|
data/lib/solargraph/library.rb
CHANGED
|
@@ -339,7 +339,7 @@ module Solargraph
|
|
|
339
339
|
logger.info "Cataloging #{workspace.directory.empty? ? 'generic workspace' : workspace.directory}"
|
|
340
340
|
api_map.catalog bundle
|
|
341
341
|
@synchronized = true
|
|
342
|
-
logger.info "Catalog complete (#{api_map.pins.length} pins)"
|
|
342
|
+
logger.info "Catalog complete (#{api_map.source_maps.length} files, #{api_map.pins.length} pins)" if logger.info?
|
|
343
343
|
end
|
|
344
344
|
end
|
|
345
345
|
|
|
@@ -76,6 +76,7 @@ module Solargraph
|
|
|
76
76
|
# @param query [String]
|
|
77
77
|
# @return [Array<Pin::Base>]
|
|
78
78
|
def query_symbols query
|
|
79
|
+
return document_symbols if query && query.empty?
|
|
79
80
|
document_symbols.select{ |pin| fuzzy_string_match(pin.path, query) || fuzzy_string_match(pin.name, query) }
|
|
80
81
|
end
|
|
81
82
|
|
|
@@ -95,6 +95,7 @@ module Solargraph
|
|
|
95
95
|
# @param source_position [Position]
|
|
96
96
|
# @param comment_position [Position]
|
|
97
97
|
# @param directive [YARD::Tags::Directive]
|
|
98
|
+
# @return [void]
|
|
98
99
|
def process_directive source_position, comment_position, directive
|
|
99
100
|
docstring = Solargraph::Source.parse_docstring(directive.tag.text).to_docstring
|
|
100
101
|
location = Location.new(@filename, Range.new(comment_position, comment_position))
|
|
@@ -104,10 +105,10 @@ module Solargraph
|
|
|
104
105
|
if namespace.location.range.start.line < comment_position.line
|
|
105
106
|
namespace = closure_at(comment_position)
|
|
106
107
|
end
|
|
107
|
-
region = Parser::Region.new(source: @source, closure: namespace)
|
|
108
108
|
begin
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
src = Solargraph::Source.load_string("def #{directive.tag.name};end", @source.filename)
|
|
110
|
+
region = Parser::Region.new(source: src, closure: namespace)
|
|
111
|
+
gen_pin = Parser.process_node(src.node, region).first.last
|
|
111
112
|
return if gen_pin.nil?
|
|
112
113
|
# Move the location to the end of the line so it gets recognized
|
|
113
114
|
# as originating from a comment
|
|
@@ -148,12 +149,23 @@ module Solargraph
|
|
|
148
149
|
)
|
|
149
150
|
end
|
|
150
151
|
when 'parse'
|
|
151
|
-
ns = closure_at(source_position)
|
|
152
|
-
region = Parser::Region.new(source: @source, closure: ns)
|
|
153
152
|
begin
|
|
154
|
-
|
|
153
|
+
ns = closure_at(source_position)
|
|
154
|
+
src = Solargraph::Source.load_string(directive.tag.text, @source.filename)
|
|
155
|
+
region = Parser::Region.new(source: src, closure: ns)
|
|
155
156
|
# @todo These pins may need to be marked not explicit
|
|
156
|
-
|
|
157
|
+
index = @pins.length
|
|
158
|
+
loff = if @code.lines[comment_position.line].strip.end_with?('@!parse')
|
|
159
|
+
comment_position.line + 1
|
|
160
|
+
else
|
|
161
|
+
comment_position.line
|
|
162
|
+
end
|
|
163
|
+
Parser.process_node(src.node, region, @pins)
|
|
164
|
+
@pins[index..-1].each do |p|
|
|
165
|
+
# @todo Smelly instance variable access
|
|
166
|
+
p.location.range.start.instance_variable_set(:@line, p.location.range.start.line + loff)
|
|
167
|
+
p.location.range.ending.instance_variable_set(:@line, p.location.range.ending.line + loff)
|
|
168
|
+
end
|
|
157
169
|
rescue Parser::SyntaxError => e
|
|
158
170
|
# @todo Handle parser errors in !parse directives
|
|
159
171
|
end
|
data/lib/solargraph/version.rb
CHANGED
|
@@ -15,23 +15,23 @@ module Solargraph
|
|
|
15
15
|
# @return [void]
|
|
16
16
|
def self.run spec, cache_dir: nil
|
|
17
17
|
Dir.mktmpdir do |tmpdir|
|
|
18
|
-
rdir = File.join(tmpdir, '
|
|
19
|
-
Dir.
|
|
18
|
+
rdir = File.join(tmpdir, 'sg_tmp_rdoc')
|
|
19
|
+
FileUtils.cp_r Dir.glob(File.join(spec.full_gem_path, '*')), tmpdir
|
|
20
|
+
Dir.chdir tmpdir do
|
|
20
21
|
pins = []
|
|
21
22
|
pins.push Solargraph::Pin::ROOT_PIN
|
|
22
23
|
name_hash = {}
|
|
23
24
|
|
|
24
|
-
argv = ['-q', '-
|
|
25
|
+
argv = ['-q', '-r', '-N', '-o', rdir]
|
|
25
26
|
spec.load_paths.each do |path|
|
|
26
27
|
argv.concat ['-i', path]
|
|
27
28
|
end
|
|
28
29
|
rdoc = RDoc::RDoc.new
|
|
29
30
|
rdoc.document argv
|
|
30
|
-
|
|
31
|
-
store =
|
|
32
|
-
store.
|
|
31
|
+
# @type [RDoc::Store]
|
|
32
|
+
store = rdoc.store
|
|
33
|
+
store.path = rdir
|
|
33
34
|
store.cache[:modules].each do |mod|
|
|
34
|
-
# store.load_class(mod)
|
|
35
35
|
# @type [RDoc::NormalClass]
|
|
36
36
|
mod = store.find_class_or_module(mod)
|
|
37
37
|
closure = pins.select { |pin| pin.path == mod.full_name.split('::')[0..-2].join('::') }.first || pins.first
|
|
@@ -51,7 +51,7 @@ module Solargraph
|
|
|
51
51
|
closure: namepin
|
|
52
52
|
)
|
|
53
53
|
end
|
|
54
|
-
# @param
|
|
54
|
+
# @param ext [RDoc::Extend]
|
|
55
55
|
mod.extends.each do |ext|
|
|
56
56
|
pins.push Solargraph::Pin::Reference::Extend.new(
|
|
57
57
|
location: locate(ext),
|
|
@@ -105,7 +105,9 @@ module Solargraph
|
|
|
105
105
|
mod.full_name.split('::')[0..-2].join('::')
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
# @param cmnt [RDoc::Comment]
|
|
108
109
|
def self.commentary cmnt
|
|
110
|
+
return cmnt.text if cmnt.is_a?(RDoc::Comment)
|
|
109
111
|
result = []
|
|
110
112
|
cmnt.parts.each do |part|
|
|
111
113
|
result.push RDoc::Markup::ToHtml.new({}).to_html(part.text) if part.respond_to?(:text)
|
|
@@ -126,9 +128,9 @@ module Solargraph
|
|
|
126
128
|
|
|
127
129
|
def self.find_file obj
|
|
128
130
|
if obj.respond_to?(:in_files) && !obj.in_files.empty?
|
|
129
|
-
[obj.in_files.first.to_s.sub(/^file /, ''), obj.
|
|
131
|
+
[obj.in_files.first.to_s.sub(/^file /, ''), obj.line]
|
|
130
132
|
else
|
|
131
|
-
[obj.
|
|
133
|
+
[obj.file, obj.line]
|
|
132
134
|
end
|
|
133
135
|
end
|
|
134
136
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solargraph
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.39.
|
|
4
|
+
version: 0.39.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fred Snyder
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backport
|