solargraph 0.39.8 → 0.39.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solargraph/library.rb +1 -1
- data/lib/solargraph/pin/documenting.rb +3 -2
- data/lib/solargraph/pin/method.rb +1 -1
- data/lib/solargraph/source_map.rb +1 -0
- data/lib/solargraph/source_map/mapper.rb +20 -8
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map/rdoc_to_yard.rb +14 -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: 005ae6488ba3fec9c5cd26d961b60ee1085a3020e3e52819b7da9351a6480cdd
|
4
|
+
data.tar.gz: 0f8bf29d0c2d6a4577d4432cf89209d037d51186a5b709869fbcce793e98763e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 656cf961069df0d647886a0ea0555182a0be4c3fc3794ed0b70c41decee645ef76cdec1240c6e1c0d389fab842ce33a0dba6df74c49a59efc04359963d2e848d
|
7
|
+
data.tar.gz: 1cb435e7a3b218fde5a0d3e3c9b5f27d376157fd7f316cd29cb4711de81fd5bac133b41c6e95b72249ec11d616fc98d13f6a5486d75b5dedede21e7bd12b43db
|
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
|
|
@@ -53,13 +53,14 @@ module Solargraph
|
|
53
53
|
# @param text [String]
|
54
54
|
# @return [String]
|
55
55
|
def escape_brackets text
|
56
|
-
text.gsub(/(\[[^\]]*\])([^\(]|\z)/, '
|
56
|
+
# text.gsub(/(\[[^\]]*\])([^\(]|\z)/, '!!!^\1^!!!\2')
|
57
|
+
text.gsub('[', '!!!!b').gsub(']', 'e!!!!')
|
57
58
|
end
|
58
59
|
|
59
60
|
# @param text [String]
|
60
61
|
# @return [String]
|
61
62
|
def unescape_brackets text
|
62
|
-
text.gsub('
|
63
|
+
text.gsub('!!!!b', '[').gsub('e!!!!', ']')
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
@@ -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
|
@@ -190,7 +202,7 @@ module Solargraph
|
|
190
202
|
code_lines = @code.lines
|
191
203
|
@source.associated_comments.each do |line, comments|
|
192
204
|
src_pos = line ? Position.new(line, code_lines[line].to_s.chomp.index(/[^\s]/) || 0) : Position.new(code_lines.length, 0)
|
193
|
-
com_pos = Position.new(line -
|
205
|
+
com_pos = Position.new(line + 1 - comments.lines.length, 0)
|
194
206
|
process_comment(src_pos, com_pos, comments)
|
195
207
|
end
|
196
208
|
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,11 @@ module Solargraph
|
|
105
105
|
mod.full_name.split('::')[0..-2].join('::')
|
106
106
|
end
|
107
107
|
|
108
|
+
# @param cmnt [RDoc::Comment]
|
109
|
+
# @return [String]
|
108
110
|
def self.commentary cmnt
|
111
|
+
return cmnt if cmnt.is_a?(String)
|
112
|
+
return cmnt.text if cmnt.is_a?(RDoc::Comment)
|
109
113
|
result = []
|
110
114
|
cmnt.parts.each do |part|
|
111
115
|
result.push RDoc::Markup::ToHtml.new({}).to_html(part.text) if part.respond_to?(:text)
|
@@ -126,9 +130,9 @@ module Solargraph
|
|
126
130
|
|
127
131
|
def self.find_file obj
|
128
132
|
if obj.respond_to?(:in_files) && !obj.in_files.empty?
|
129
|
-
[obj.in_files.first.to_s.sub(/^file /, ''), obj.
|
133
|
+
[obj.in_files.first.to_s.sub(/^file /, ''), obj.line]
|
130
134
|
else
|
131
|
-
[obj.
|
135
|
+
[obj.file, obj.line]
|
132
136
|
end
|
133
137
|
end
|
134
138
|
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.11
|
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-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|