solargraph 0.41.2 → 0.42.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -5
- data/CHANGELOG.md +8 -0
- data/lib/.rubocop.yml +4 -3
- data/lib/solargraph/api_map.rb +5 -53
- data/lib/solargraph/bench.rb +8 -12
- data/lib/solargraph/diagnostics/type_check.rb +1 -1
- data/lib/solargraph/language_server/host.rb +41 -8
- data/lib/solargraph/language_server/host/sources.rb +1 -1
- data/lib/solargraph/language_server/message/initialize.rb +7 -0
- data/lib/solargraph/library.rb +44 -7
- data/lib/solargraph/shell.rb +5 -1
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace.rb +1 -0
- data/lib/solargraph/yard_map.rb +41 -39
- data/solargraph.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee62ce435bde441d527641ea98d3f448d36ce67f575f35d16927c315a98f1401
|
4
|
+
data.tar.gz: 514c7a0540e0bce8b050e9da507ed6d778b0ba482c5c73bef6ebc54360d93367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fec2a060f92ba925c0911b41025033afb6821e0f5758de849c2722a03b9b102b97f437dad23097d442546e254f21ec407fdf3ca494ee311ce3d2f26396cc9e1d
|
7
|
+
data.tar.gz: 919ae0f90af0de75228cf2c42eb5ab22a9f9ef3af9c9f7003c4fdf746d0b2ee43375f006a08b926f4d5135facfd97f4cacd5df47e2a1862c3d17a96d4c11b004
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.42.0 - June 11, 2021
|
2
|
+
- Improve YardMap efficiency
|
3
|
+
- Bench includes Workspace for cataloging
|
4
|
+
- Initialize confirms static features from options (#436)
|
5
|
+
- Enable simple repairs without incremental sync (#416)
|
6
|
+
- Discard unrecognized client responses
|
7
|
+
- Notify on use of closest match for core (#390)
|
8
|
+
|
1
9
|
## 0.41.2 - June 9, 2021
|
2
10
|
- Rescue InvalidOffset in async diagnosis
|
3
11
|
- Remove erroneous escaping from Hover
|
data/lib/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
3
|
Style/MethodDefParentheses:
|
4
4
|
Enabled: false
|
5
5
|
Layout/EmptyLineAfterGuardClause:
|
@@ -10,6 +10,8 @@ Lint/RaiseException:
|
|
10
10
|
Enabled: true
|
11
11
|
Lint/StructNewOverride:
|
12
12
|
Enabled: true
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Max: 25
|
13
15
|
Style/ExponentialNotation:
|
14
16
|
Enabled: true
|
15
17
|
Style/HashEachMethods:
|
@@ -18,4 +20,3 @@ Style/HashTransformKeys:
|
|
18
20
|
Enabled: true
|
19
21
|
Style/HashTransformValues:
|
20
22
|
Enabled: true
|
21
|
-
|
data/lib/solargraph/api_map.rb
CHANGED
@@ -17,7 +17,6 @@ module Solargraph
|
|
17
17
|
autoload :BundlerMethods, 'solargraph/api_map/bundler_methods'
|
18
18
|
|
19
19
|
include SourceToYard
|
20
|
-
include BundlerMethods
|
21
20
|
|
22
21
|
# @return [Array<String>]
|
23
22
|
attr_reader :unresolved_requires
|
@@ -59,30 +58,14 @@ module Solargraph
|
|
59
58
|
implicit.clear
|
60
59
|
@cache.clear
|
61
60
|
@source_map_hash = bench.source_maps.map { |s| [s.filename, s] }.to_h
|
62
|
-
pins =
|
63
|
-
|
64
|
-
local_path_hash.clear
|
61
|
+
pins = bench.source_maps.map(&:pins).flatten
|
62
|
+
external_requires = bench.external_requires
|
65
63
|
source_map_hash.each_value do |map|
|
66
|
-
pins.concat map.pins
|
67
|
-
@required.merge map.requires.map(&:name)
|
68
64
|
implicit.merge map.environ
|
69
65
|
end
|
70
|
-
|
71
|
-
external_requires
|
72
|
-
|
73
|
-
result = bench.load_paths.find do |path|
|
74
|
-
full = Pathname.new(path).join("#{req}.rb").to_s
|
75
|
-
@source_map_hash.key?(full)
|
76
|
-
end
|
77
|
-
if result
|
78
|
-
local_path_hash[req] = Pathname.new(result).join("#{req}.rb").to_s
|
79
|
-
else
|
80
|
-
external_requires.push req unless result
|
81
|
-
end
|
82
|
-
end
|
83
|
-
br = @required.include?('bundler/require') ? require_from_bundle(bench.directory) : {}
|
84
|
-
@required.merge br.keys
|
85
|
-
yard_map.change(external_requires, br, bench.gemnames)
|
66
|
+
external_requires.merge implicit.requires
|
67
|
+
external_requires.merge bench.workspace.config.required
|
68
|
+
yard_map.change(external_requires, bench.workspace.directory, bench.workspace.source_gems)
|
86
69
|
@store = Store.new(yard_map.pins + implicit.pins + pins)
|
87
70
|
@unresolved_requires = yard_map.unresolved_requires
|
88
71
|
@rebindable_method_names = nil
|
@@ -105,11 +88,6 @@ module Solargraph
|
|
105
88
|
@implicit ||= Environ.new
|
106
89
|
end
|
107
90
|
|
108
|
-
# @return [Hash{String => String}]
|
109
|
-
def local_path_hash
|
110
|
-
@local_paths ||= {}
|
111
|
-
end
|
112
|
-
|
113
91
|
# @param filename [String]
|
114
92
|
# @param position [Position, Array(Integer, Integer)]
|
115
93
|
# @return [Source::Cursor]
|
@@ -456,27 +434,6 @@ module Solargraph
|
|
456
434
|
source_map_hash.keys.include?(filename)
|
457
435
|
end
|
458
436
|
|
459
|
-
# True if the specified file is included in the workspace.
|
460
|
-
#
|
461
|
-
# @param filename [String]
|
462
|
-
def workspaced? filename
|
463
|
-
workspace_filenames.include?(filename)
|
464
|
-
end
|
465
|
-
|
466
|
-
# @param location [Location]
|
467
|
-
# @return [Location]
|
468
|
-
def require_reference_at location
|
469
|
-
map = source_map(location.filename)
|
470
|
-
pin = map.requires.select { |p| p.location.range.contain?(location.range.start) }.first
|
471
|
-
return nil if pin.nil?
|
472
|
-
if local_path_hash.key?(pin.name)
|
473
|
-
return Location.new(local_path_hash[pin.name], Solargraph::Range.from_to(0, 0, 0, 0))
|
474
|
-
end
|
475
|
-
yard_map.require_reference(pin.name)
|
476
|
-
rescue FileNotFoundError
|
477
|
-
nil
|
478
|
-
end
|
479
|
-
|
480
437
|
# Check if a class is a superclass of another class.
|
481
438
|
#
|
482
439
|
# @param sup [String] The superclass
|
@@ -508,11 +465,6 @@ module Solargraph
|
|
508
465
|
|
509
466
|
private
|
510
467
|
|
511
|
-
# @return [Array<String>]
|
512
|
-
def workspace_filenames
|
513
|
-
@workspace_filenames ||= []
|
514
|
-
end
|
515
|
-
|
516
468
|
# A hash of source maps with filename keys.
|
517
469
|
#
|
518
470
|
# @return [Hash{String => SourceMap}]
|
data/lib/solargraph/bench.rb
CHANGED
@@ -9,23 +9,19 @@ module Solargraph
|
|
9
9
|
# @return [Set<SourceMap>]
|
10
10
|
attr_reader :source_maps
|
11
11
|
|
12
|
-
# @return [
|
13
|
-
attr_reader :
|
12
|
+
# @return [Workspace]
|
13
|
+
attr_reader :workspace
|
14
14
|
|
15
15
|
# @return [Set<String>]
|
16
|
-
attr_reader :
|
17
|
-
|
18
|
-
# @return [String]
|
19
|
-
attr_reader :directory
|
16
|
+
attr_reader :external_requires
|
20
17
|
|
21
18
|
# @param source_maps [Array<SourceMap>, Set<SourceMap>]
|
22
|
-
# @param
|
23
|
-
# @param
|
24
|
-
def initialize source_maps: [],
|
19
|
+
# @param workspace [Workspace]
|
20
|
+
# @param external_requires [Array<String>, Set<String>]
|
21
|
+
def initialize source_maps: [], workspace: Workspace.new, external_requires: []
|
25
22
|
@source_maps = source_maps.to_set
|
26
|
-
@
|
27
|
-
@
|
28
|
-
@directory = directory
|
23
|
+
@workspace = workspace
|
24
|
+
@external_requires = external_requires.to_set
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
@@ -7,7 +7,7 @@ module Solargraph
|
|
7
7
|
#
|
8
8
|
class TypeCheck < Base
|
9
9
|
def diagnose source, api_map
|
10
|
-
return [] unless args.include?('always') || api_map.workspaced?(source.filename)
|
10
|
+
# return [] unless args.include?('always') || api_map.workspaced?(source.filename)
|
11
11
|
severity = Diagnostics::Severities::ERROR
|
12
12
|
level = (args.reverse.find { |a| ['normal', 'typed', 'strict', 'strong'].include?(a) }) || :normal
|
13
13
|
checker = Solargraph::TypeChecker.new(source.filename, api_map: api_map, level: level.to_sym)
|
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'diff/lcs'
|
3
4
|
require 'observer'
|
4
|
-
require 'set'
|
5
5
|
require 'securerandom'
|
6
|
+
require 'set'
|
6
7
|
|
7
8
|
module Solargraph
|
8
9
|
module LanguageServer
|
@@ -107,9 +108,12 @@ module Solargraph
|
|
107
108
|
end
|
108
109
|
message
|
109
110
|
elsif request['id']
|
110
|
-
|
111
|
-
|
112
|
-
|
111
|
+
if requests[request['id']]
|
112
|
+
requests[request['id']].process(request['result'])
|
113
|
+
requests.delete request['id']
|
114
|
+
else
|
115
|
+
logger.warn "Discarding client response to unrecognized message #{request['id']}"
|
116
|
+
end
|
113
117
|
else
|
114
118
|
logger.warn "Invalid message received."
|
115
119
|
logger.debug request
|
@@ -165,8 +169,6 @@ module Solargraph
|
|
165
169
|
# @return [void]
|
166
170
|
def open_from_disk uri
|
167
171
|
sources.open_from_disk(uri)
|
168
|
-
library = library_for(uri)
|
169
|
-
# library.open_from_disk uri_to_file(uri)
|
170
172
|
diagnoser.schedule uri
|
171
173
|
end
|
172
174
|
|
@@ -672,7 +674,8 @@ module Solargraph
|
|
672
674
|
# @return [Source::Updater]
|
673
675
|
def generate_updater params
|
674
676
|
changes = []
|
675
|
-
params['contentChanges'].each do |
|
677
|
+
params['contentChanges'].each do |recvd|
|
678
|
+
chng = check_diff(params['textDocument']['uri'], recvd)
|
676
679
|
changes.push Solargraph::Source::Change.new(
|
677
680
|
(chng['range'].nil? ?
|
678
681
|
nil :
|
@@ -688,6 +691,36 @@ module Solargraph
|
|
688
691
|
)
|
689
692
|
end
|
690
693
|
|
694
|
+
# @param uri [String]
|
695
|
+
# @param change [Hash]
|
696
|
+
# @return [Hash]
|
697
|
+
def check_diff uri, change
|
698
|
+
return change if change['range']
|
699
|
+
source = sources.find(uri)
|
700
|
+
return change if source.code.length + 1 != change['text'].length
|
701
|
+
diffs = Diff::LCS.diff(source.code, change['text'])
|
702
|
+
return change if diffs.length.zero? || diffs.length > 1 || diffs.first.length > 1
|
703
|
+
# @type [Diff::LCS::Change]
|
704
|
+
diff = diffs.first.first
|
705
|
+
return change unless diff.adding? && ['.', ':'].include?(diff.element)
|
706
|
+
position = Solargraph::Position.from_offset(source.code, diff.position)
|
707
|
+
{
|
708
|
+
'range' => {
|
709
|
+
'start' => {
|
710
|
+
'line' => position.line,
|
711
|
+
'character' => position.character
|
712
|
+
},
|
713
|
+
'end' => {
|
714
|
+
'line' => position.line,
|
715
|
+
'character' => position.character
|
716
|
+
}
|
717
|
+
},
|
718
|
+
'text' => diff.element
|
719
|
+
}
|
720
|
+
rescue Solargraph::FileNotFoundError
|
721
|
+
change
|
722
|
+
end
|
723
|
+
|
691
724
|
# @return [Hash]
|
692
725
|
def dynamic_capability_options
|
693
726
|
@dynamic_capability_options ||= {
|
@@ -787,7 +820,7 @@ module Solargraph
|
|
787
820
|
next unless uuid
|
788
821
|
cur = ((library.source_map_hash.keys.length.to_f / total.to_f) * 100).to_i
|
789
822
|
if cur > pct && cur % mod == 0
|
790
|
-
|
823
|
+
pct = cur
|
791
824
|
send_notification '$/progress', {
|
792
825
|
token: uuid,
|
793
826
|
value: {
|
@@ -51,6 +51,7 @@ module Solargraph
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def static_completion
|
54
|
+
return {} unless host.options['completion']
|
54
55
|
{
|
55
56
|
completionProvider: {
|
56
57
|
resolveProvider: true,
|
@@ -84,18 +85,21 @@ module Solargraph
|
|
84
85
|
end
|
85
86
|
|
86
87
|
def static_hover
|
88
|
+
return {} unless host.options['hover']
|
87
89
|
{
|
88
90
|
hoverProvider: true
|
89
91
|
}
|
90
92
|
end
|
91
93
|
|
92
94
|
def static_document_formatting
|
95
|
+
return {} unless host.options['formatting']
|
93
96
|
{
|
94
97
|
documentFormattingProvider: true
|
95
98
|
}
|
96
99
|
end
|
97
100
|
|
98
101
|
def static_document_symbols
|
102
|
+
return {} unless host.options['symbols']
|
99
103
|
{
|
100
104
|
documentSymbolProvider: true
|
101
105
|
}
|
@@ -108,6 +112,7 @@ module Solargraph
|
|
108
112
|
end
|
109
113
|
|
110
114
|
def static_definitions
|
115
|
+
return {} unless host.options['definitions']
|
111
116
|
{
|
112
117
|
definitionProvider: true
|
113
118
|
}
|
@@ -120,12 +125,14 @@ module Solargraph
|
|
120
125
|
end
|
121
126
|
|
122
127
|
def static_references
|
128
|
+
return {} unless host.options['references']
|
123
129
|
{
|
124
130
|
referencesProvider: true
|
125
131
|
}
|
126
132
|
end
|
127
133
|
|
128
134
|
def static_folding_range
|
135
|
+
return {} unless host.options['folding']
|
129
136
|
{
|
130
137
|
foldingRangeProvider: true
|
131
138
|
}
|
data/lib/solargraph/library.rb
CHANGED
@@ -48,6 +48,8 @@ module Solargraph
|
|
48
48
|
mutex.synchronize do
|
49
49
|
if @current && @current.filename != source.filename && source_map_hash.key?(@current.filename) && !workspace.has_file?(@current.filename)
|
50
50
|
source_map_hash.delete @current.filename
|
51
|
+
source_map_external_require_hash.delete @current.filename
|
52
|
+
@external_requires = nil
|
51
53
|
@synchronized = false
|
52
54
|
end
|
53
55
|
@current = source
|
@@ -252,7 +254,18 @@ module Solargraph
|
|
252
254
|
end
|
253
255
|
|
254
256
|
def locate_ref location
|
255
|
-
|
257
|
+
map = source_map_hash[location.filename]
|
258
|
+
return if map.nil?
|
259
|
+
pin = map.requires.select { |p| p.location.range.contain?(location.range.start) }.first
|
260
|
+
return nil if pin.nil?
|
261
|
+
workspace.require_paths.each do |path|
|
262
|
+
full = Pathname.new(path).join("#{pin.name}.rb").to_s
|
263
|
+
next unless source_map_hash.key?(full)
|
264
|
+
return Location.new(full, Solargraph::Range.from_to(0, 0, 0, 0))
|
265
|
+
end
|
266
|
+
api_map.yard_map.require_reference(pin.name)
|
267
|
+
rescue FileNotFoundError
|
268
|
+
nil
|
256
269
|
end
|
257
270
|
|
258
271
|
# Get an array of pins that match a path.
|
@@ -326,6 +339,7 @@ module Solargraph
|
|
326
339
|
return [] unless open?(filename)
|
327
340
|
result = []
|
328
341
|
source = read(filename)
|
342
|
+
catalog
|
329
343
|
repargs = {}
|
330
344
|
workspace.config.reporters.each do |line|
|
331
345
|
if line == 'all!'
|
@@ -361,13 +375,10 @@ module Solargraph
|
|
361
375
|
end
|
362
376
|
|
363
377
|
def bench
|
364
|
-
source_maps = @current ? [@current] : []
|
365
|
-
source_maps.concat source_map_hash.values
|
366
378
|
Bench.new(
|
367
|
-
source_maps:
|
368
|
-
|
369
|
-
|
370
|
-
directory: workspace.directory
|
379
|
+
source_maps: source_map_hash.values,
|
380
|
+
workspace: workspace,
|
381
|
+
external_requires: external_requires
|
371
382
|
)
|
372
383
|
end
|
373
384
|
|
@@ -423,6 +434,8 @@ module Solargraph
|
|
423
434
|
if src
|
424
435
|
Logging.logger.debug "Mapping #{src.filename}"
|
425
436
|
source_map_hash[src.filename] = Solargraph::SourceMap.map(src)
|
437
|
+
find_external_requires(source_map_hash[src.filename])
|
438
|
+
source_map_hash[src.filename]
|
426
439
|
else
|
427
440
|
false
|
428
441
|
end
|
@@ -432,6 +445,7 @@ module Solargraph
|
|
432
445
|
def map!
|
433
446
|
workspace.sources.each do |src|
|
434
447
|
source_map_hash[src.filename] = Solargraph::SourceMap.map(src)
|
448
|
+
find_external_requires(source_map_hash[src.filename])
|
435
449
|
end
|
436
450
|
self
|
437
451
|
end
|
@@ -440,8 +454,29 @@ module Solargraph
|
|
440
454
|
@pins ||= []
|
441
455
|
end
|
442
456
|
|
457
|
+
def external_requires
|
458
|
+
@external_requires ||= source_map_external_require_hash.values.flatten.to_set
|
459
|
+
end
|
460
|
+
|
443
461
|
private
|
444
462
|
|
463
|
+
def source_map_external_require_hash
|
464
|
+
@source_map_external_require_hash ||= {}
|
465
|
+
end
|
466
|
+
|
467
|
+
# @param source_map [SourceMap]
|
468
|
+
def find_external_requires source_map
|
469
|
+
new_set = source_map.requires.map(&:name).to_set
|
470
|
+
# return if new_set == source_map_external_require_hash[source_map.filename]
|
471
|
+
source_map_external_require_hash[source_map.filename] = new_set.reject do |path|
|
472
|
+
workspace.require_paths.any? do |base|
|
473
|
+
full = Pathname.new(base).join("#{path}.rb").to_s
|
474
|
+
workspace.filenames.include?(full)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
@external_requires = nil
|
478
|
+
end
|
479
|
+
|
445
480
|
# @return [Mutex]
|
446
481
|
def mutex
|
447
482
|
@mutex ||= Mutex.new
|
@@ -484,6 +519,7 @@ module Solargraph
|
|
484
519
|
new_map = Solargraph::SourceMap.map(source)
|
485
520
|
unless source_map_hash[source.filename].try_merge!(new_map)
|
486
521
|
source_map_hash[source.filename] = new_map
|
522
|
+
find_external_requires(source_map_hash[source.filename])
|
487
523
|
@synchronized = false
|
488
524
|
end
|
489
525
|
else
|
@@ -492,6 +528,7 @@ module Solargraph
|
|
492
528
|
end
|
493
529
|
else
|
494
530
|
source_map_hash[source.filename] = Solargraph::SourceMap.map(source)
|
531
|
+
find_external_requires(source_map_hash[source.filename])
|
495
532
|
@synchronized = false
|
496
533
|
end
|
497
534
|
end
|
data/lib/solargraph/shell.rb
CHANGED
@@ -74,7 +74,11 @@ module Solargraph
|
|
74
74
|
desc 'download-core [VERSION]', 'Download core documentation'
|
75
75
|
def download_core version = nil
|
76
76
|
ver = version || Solargraph::YardMap::CoreDocs.best_download
|
77
|
-
|
77
|
+
if RUBY_VERSION != ver
|
78
|
+
puts "Documentation for #{RUBY_VERSION} is not available. Reverting to closest match..."
|
79
|
+
else
|
80
|
+
puts "Downloading docs for #{ver}..."
|
81
|
+
end
|
78
82
|
Solargraph::YardMap::CoreDocs.download ver
|
79
83
|
# Clear cached documentation if it exists
|
80
84
|
FileUtils.rm_rf Dir.glob(File.join(Solargraph::YardMap::CoreDocs.cache_dir, ver, '*.ser'))
|
data/lib/solargraph/version.rb
CHANGED
data/lib/solargraph/workspace.rb
CHANGED
data/lib/solargraph/yard_map.rb
CHANGED
@@ -20,6 +20,8 @@ module Solargraph
|
|
20
20
|
autoload :Helpers, 'solargraph/yard_map/helpers'
|
21
21
|
autoload :ToMethod, 'solargraph/yard_map/to_method'
|
22
22
|
|
23
|
+
include ApiMap::BundlerMethods
|
24
|
+
|
23
25
|
CoreDocs.require_minimum
|
24
26
|
|
25
27
|
def stdlib_paths
|
@@ -37,33 +39,16 @@ module Solargraph
|
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
|
-
# @return [Array<String>]
|
41
|
-
attr_reader :required
|
42
|
-
|
43
42
|
# @return [Boolean]
|
44
43
|
attr_writer :with_dependencies
|
45
44
|
|
46
|
-
#
|
47
|
-
#
|
48
|
-
# @
|
49
|
-
attr_reader :gemset
|
50
|
-
|
51
|
-
# @param required [Array<String>]
|
52
|
-
# @param gemset [Hash{String => String}]
|
45
|
+
# @param required [Array<String>, Set<String>]
|
46
|
+
# @param directory [String]
|
47
|
+
# @param source_gems [Array<String>, Set<String>]
|
53
48
|
# @param with_dependencies [Boolean]
|
54
|
-
def initialize(required: [],
|
55
|
-
# HACK: YardMap needs its own copy of this array
|
56
|
-
@required = required.clone
|
57
|
-
# HACK: Hardcoded YAML handling
|
58
|
-
@required.push 'psych' if @required.include?('yaml')
|
49
|
+
def initialize(required: [], directory: '', source_gems: [], with_dependencies: true)
|
59
50
|
@with_dependencies = with_dependencies
|
60
|
-
|
61
|
-
@stdlib_namespaces = []
|
62
|
-
@gemset = gemset
|
63
|
-
@source_gems = []
|
64
|
-
process_requires
|
65
|
-
yardocs.uniq!
|
66
|
-
@pin_select_cache = {}
|
51
|
+
change required.to_set, directory, source_gems.to_set
|
67
52
|
end
|
68
53
|
|
69
54
|
# @return [Array<Solargraph::Pin::Base>]
|
@@ -76,25 +61,24 @@ module Solargraph
|
|
76
61
|
@with_dependencies
|
77
62
|
end
|
78
63
|
|
79
|
-
# @param new_requires [
|
80
|
-
# @param
|
64
|
+
# @param new_requires [Set<String>] Required paths to use for loading gems
|
65
|
+
# @param new_directory [String] The workspace directory
|
66
|
+
# @param new_source_gems [Set<String>] Gems under local development (i.e., part of the workspace)
|
81
67
|
# @return [Boolean]
|
82
|
-
def change new_requires,
|
68
|
+
def change new_requires, new_directory, new_source_gems
|
69
|
+
return false if new_requires == base_required && new_directory == @directory && new_source_gems == @source_gems
|
70
|
+
@gem_paths = {}
|
71
|
+
base_required.replace new_requires
|
72
|
+
required.replace new_requires
|
83
73
|
# HACK: Hardcoded YAML handling
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
process_requires
|
93
|
-
@rebindable_method_names = nil
|
94
|
-
@pin_class_hash = nil
|
95
|
-
@pin_select_cache = {}
|
96
|
-
true
|
97
|
-
end
|
74
|
+
required.add 'psych' if new_requires.include?('yaml')
|
75
|
+
@source_gems = new_source_gems
|
76
|
+
@directory = directory
|
77
|
+
process_requires
|
78
|
+
@rebindable_method_names = nil
|
79
|
+
@pin_class_hash = nil
|
80
|
+
@pin_select_cache = {}
|
81
|
+
true
|
98
82
|
end
|
99
83
|
|
100
84
|
# @return [Set<String>]
|
@@ -111,6 +95,11 @@ module Solargraph
|
|
111
95
|
@yardocs ||= []
|
112
96
|
end
|
113
97
|
|
98
|
+
# @return [Set<String>]
|
99
|
+
def required
|
100
|
+
@required ||= Set.new
|
101
|
+
end
|
102
|
+
|
114
103
|
# @return [Array<String>]
|
115
104
|
def unresolved_requires
|
116
105
|
@unresolved_requires ||= []
|
@@ -163,8 +152,16 @@ module Solargraph
|
|
163
152
|
@stdlib_pins ||= []
|
164
153
|
end
|
165
154
|
|
155
|
+
def base_required
|
156
|
+
@base_required ||= Set.new
|
157
|
+
end
|
158
|
+
|
166
159
|
private
|
167
160
|
|
161
|
+
def directory
|
162
|
+
@directory ||= ''
|
163
|
+
end
|
164
|
+
|
168
165
|
# @return [YardMap::Cache]
|
169
166
|
def cache
|
170
167
|
@cache ||= YardMap::Cache.new
|
@@ -193,6 +190,11 @@ module Solargraph
|
|
193
190
|
|
194
191
|
# @return [void]
|
195
192
|
def process_requires
|
193
|
+
@gemset = if required.include?('bundler/require')
|
194
|
+
require_from_bundle(directory)
|
195
|
+
else
|
196
|
+
{}
|
197
|
+
end
|
196
198
|
pins.replace core_pins
|
197
199
|
unresolved_requires.clear
|
198
200
|
stdlib_pins.clear
|
data/solargraph.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_runtime_dependency 'backport', '~> 1.1'
|
23
23
|
s.add_runtime_dependency 'benchmark'
|
24
24
|
s.add_runtime_dependency 'bundler', '>= 1.17.2'
|
25
|
+
s.add_runtime_dependency 'diff-lcs', '~> 1.4'
|
25
26
|
s.add_runtime_dependency 'e2mmap'
|
26
27
|
s.add_runtime_dependency 'jaro_winkler', '~> 1.5'
|
27
28
|
s.add_runtime_dependency 'kramdown', '~> 2.3'
|
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.
|
4
|
+
version: 0.42.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.17.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: diff-lcs
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.4'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: e2mmap
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|