solargraph 0.38.3 → 0.38.4
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/Gemfile +0 -2
- data/lib/solargraph/api_map.rb +1 -1
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/hover.rb +5 -1
- data/lib/solargraph/source/chain.rb +1 -11
- data/lib/solargraph/source/chain/literal.rb +1 -1
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace.rb +11 -7
- data/lib/solargraph/yard_map.rb +15 -3
- 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: fee6de28dda75ac732866b6ca8e68f52d3b5c4216feac100cbe3196280059f34
|
4
|
+
data.tar.gz: f8f51dc88c5aff911673a186d2c7ddb60a9e31cd084318741f2cae237091607a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f433fe6a05b703945d53f74ef2b19c24e23c1aca77fcc71c0c6a88499e6c7900e275cdc43913cd51ff3a3fda7785885ece07e68daa18c7eae1f705dc990974
|
7
|
+
data.tar.gz: 313f01cdc3336c46a1ff6659c84b393192f0b7fab112ae479285f4e7a4b0866da61e47bbb8c2e41638beb931a92e408e2a285d841071a47f006ca16281d3a16c
|
data/Gemfile
CHANGED
data/lib/solargraph/api_map.rb
CHANGED
@@ -121,7 +121,7 @@ module Solargraph
|
|
121
121
|
pins.concat implicit.overrides
|
122
122
|
br = reqs.include?('bundler/require') ? require_from_bundle(bundle.workspace.directory) : {}
|
123
123
|
reqs.merge br.keys
|
124
|
-
yard_map.change(reqs.to_a, br)
|
124
|
+
yard_map.change(reqs.to_a, br, bundle.workspace.gemnames)
|
125
125
|
new_store = Store.new(pins + yard_map.pins)
|
126
126
|
@mutex.synchronize {
|
127
127
|
@cache.clear
|
@@ -45,7 +45,7 @@ module Solargraph
|
|
45
45
|
if this_link && this_link != last_link && this_link != 'undefined'
|
46
46
|
result.push this_link
|
47
47
|
end
|
48
|
-
result.push pin.documentation
|
48
|
+
result.push pin.documentation unless result.last && result.last.end_with?(pin.documentation)
|
49
49
|
last_link = this_link
|
50
50
|
end
|
51
51
|
result.join("\n\n")
|
@@ -19,7 +19,11 @@ module Solargraph
|
|
19
19
|
end
|
20
20
|
parts.push pin.detail.gsub(':', '\\:') unless pin.is_a?(Pin::Namespace) || pin.detail.nil?
|
21
21
|
parts.push pin.documentation unless pin.documentation.nil? || pin.documentation.empty?
|
22
|
-
|
22
|
+
unless parts.empty?
|
23
|
+
data = parts.join("\n\n")
|
24
|
+
next if contents.last && contents.last.end_with?(data)
|
25
|
+
contents.push data
|
26
|
+
end
|
23
27
|
last_link = this_link unless this_link.nil?
|
24
28
|
end
|
25
29
|
set_result(
|
@@ -23,8 +23,6 @@ module Solargraph
|
|
23
23
|
|
24
24
|
@@inference_stack = []
|
25
25
|
@@inference_depth = 0
|
26
|
-
@@last_api_map = nil
|
27
|
-
@@pin_cache = {}
|
28
26
|
|
29
27
|
UNDEFINED_CALL = Chain::Call.new('<undefined>')
|
30
28
|
UNDEFINED_CONSTANT = Chain::Constant.new('<undefined>')
|
@@ -123,9 +121,7 @@ module Solargraph
|
|
123
121
|
# Avoid infinite recursion
|
124
122
|
next if @@inference_stack.include?(pin)
|
125
123
|
@@inference_stack.push pin
|
126
|
-
|
127
|
-
# type = pin.probe(api_map)
|
128
|
-
type = remember_or_probe(pin, api_map)
|
124
|
+
type = pin.probe(api_map)
|
129
125
|
@@inference_stack.pop
|
130
126
|
break if type.defined?
|
131
127
|
end
|
@@ -163,12 +159,6 @@ module Solargraph
|
|
163
159
|
end
|
164
160
|
end
|
165
161
|
end
|
166
|
-
|
167
|
-
def remember_or_probe pin, api_map
|
168
|
-
@@pin_cache.clear if @@last_api_map != api_map
|
169
|
-
@@last_api_map = api_map
|
170
|
-
@@pin_cache[pin] ||= pin.probe(api_map)
|
171
|
-
end
|
172
162
|
end
|
173
163
|
end
|
174
164
|
end
|
data/lib/solargraph/version.rb
CHANGED
data/lib/solargraph/workspace.rb
CHANGED
@@ -11,12 +11,22 @@ module Solargraph
|
|
11
11
|
# @return [String]
|
12
12
|
attr_reader :directory
|
13
13
|
|
14
|
+
# The require paths associated with the workspace.
|
15
|
+
#
|
16
|
+
# @return [Array<String>]
|
17
|
+
attr_reader :require_paths
|
18
|
+
|
19
|
+
# @return [Array<String>]
|
20
|
+
attr_reader :gemnames
|
21
|
+
|
14
22
|
# @param directory [String]
|
15
23
|
# @param config [Config, nil]
|
16
24
|
def initialize directory = '', config = nil
|
17
25
|
@directory = directory
|
18
26
|
@config = config
|
19
27
|
load_sources
|
28
|
+
@gemnames = []
|
29
|
+
@require_paths = generate_require_paths
|
20
30
|
end
|
21
31
|
|
22
32
|
# @return [Solargraph::Workspace::Config]
|
@@ -85,13 +95,6 @@ module Solargraph
|
|
85
95
|
source_hash[filename]
|
86
96
|
end
|
87
97
|
|
88
|
-
# The require paths associated with the workspace.
|
89
|
-
#
|
90
|
-
# @return [Array<String>]
|
91
|
-
def require_paths
|
92
|
-
@require_paths ||= generate_require_paths
|
93
|
-
end
|
94
|
-
|
95
98
|
# True if the path resolves to a file in the workspace's require paths.
|
96
99
|
#
|
97
100
|
# @param path [String]
|
@@ -164,6 +167,7 @@ module Solargraph
|
|
164
167
|
# @type [Gem::Specification]
|
165
168
|
spec = eval(File.read(file), binding, file)
|
166
169
|
next unless Gem::Specification === spec
|
170
|
+
@gemnames.push spec.name
|
167
171
|
result.concat(spec.require_paths.map { |path| File.join(base, path) })
|
168
172
|
rescue Exception => e
|
169
173
|
# Don't die if we have an error during eval-ing a gem spec.
|
data/lib/solargraph/yard_map.rb
CHANGED
@@ -50,6 +50,7 @@ module Solargraph
|
|
50
50
|
@gem_paths = {}
|
51
51
|
@stdlib_namespaces = []
|
52
52
|
@gemset = gemset
|
53
|
+
@source_gems = []
|
53
54
|
process_requires
|
54
55
|
yardocs.uniq!
|
55
56
|
end
|
@@ -67,13 +68,14 @@ module Solargraph
|
|
67
68
|
# @param new_requires [Array<String>]
|
68
69
|
# @param new_gemset [Hash{String => String}]
|
69
70
|
# @return [Boolean]
|
70
|
-
def change new_requires, new_gemset
|
71
|
-
if new_requires.uniq.sort == required.uniq.sort && new_gemset == gemset
|
71
|
+
def change new_requires, new_gemset, source_gems = []
|
72
|
+
if new_requires.uniq.sort == required.uniq.sort && new_gemset == gemset && @source_gems.uniq.sort == source_gems.uniq.sort
|
72
73
|
false
|
73
74
|
else
|
74
75
|
required.clear
|
75
76
|
required.concat new_requires
|
76
77
|
@gemset = new_gemset
|
78
|
+
@source_gems = source_gems
|
77
79
|
process_requires
|
78
80
|
true
|
79
81
|
end
|
@@ -181,6 +183,10 @@ module Solargraph
|
|
181
183
|
result = []
|
182
184
|
begin
|
183
185
|
spec = spec_for_require(r)
|
186
|
+
if @source_gems.include?(spec.name)
|
187
|
+
next
|
188
|
+
end
|
189
|
+
next if @gem_paths.key?(spec.name)
|
184
190
|
yd = yardoc_file_for_spec(spec)
|
185
191
|
# YARD detects gems for certain libraries that do not have a yardoc
|
186
192
|
# but exist in the stdlib. `fileutils` is an example. Treat those
|
@@ -252,6 +258,9 @@ module Solargraph
|
|
252
258
|
result = []
|
253
259
|
(spec.dependencies - spec.development_dependencies).each do |dep|
|
254
260
|
begin
|
261
|
+
if @source_gems.include?(dep.name)
|
262
|
+
next
|
263
|
+
end
|
255
264
|
depspec = Gem::Specification.find_by_name(dep.name)
|
256
265
|
next if depspec.nil? || @gem_paths.key?(depspec.name)
|
257
266
|
@gem_paths[depspec.name] = depspec.full_gem_path
|
@@ -304,7 +313,10 @@ module Solargraph
|
|
304
313
|
# @return [Gem::Specification]
|
305
314
|
def spec_for_require path
|
306
315
|
spec = Gem::Specification.find_by_path(path) || Gem::Specification.find_by_name(path.split('/').first)
|
307
|
-
if
|
316
|
+
# Avoid loading the spec again if it's going to be skipped anyway
|
317
|
+
return spec if @source_gems.include?(spec.name)
|
318
|
+
# Avoid loading the spec again if it's alredy the correct version
|
319
|
+
if @gemset[spec.name] && @gemset[spec.name] != spec.version
|
308
320
|
begin
|
309
321
|
return Gem::Specification.find_by_name(spec.name, "= #{@gemset[spec.name]}")
|
310
322
|
rescue Gem::LoadError
|
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.38.
|
4
|
+
version: 0.38.4
|
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-01-
|
11
|
+
date: 2020-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|