solargraph 0.40.3 → 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 +34 -0
- data/README.md +15 -0
- data/SPONSORS.md +1 -0
- data/lib/.rubocop.yml +4 -3
- data/lib/solargraph.rb +8 -7
- data/lib/solargraph/api_map.rb +40 -111
- data/lib/solargraph/api_map/store.rb +5 -0
- data/lib/solargraph/bench.rb +13 -16
- data/lib/solargraph/compat.rb +15 -1
- data/lib/solargraph/diagnostics/rubocop.rb +10 -2
- data/lib/solargraph/diagnostics/rubocop_helpers.rb +18 -0
- data/lib/solargraph/diagnostics/type_check.rb +1 -1
- data/lib/solargraph/language_server/host.rb +108 -7
- data/lib/solargraph/language_server/host/diagnoser.rb +9 -1
- data/lib/solargraph/language_server/host/sources.rb +1 -1
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +1 -0
- data/lib/solargraph/language_server/message/extended/environment.rb +3 -3
- data/lib/solargraph/language_server/message/initialize.rb +37 -35
- data/lib/solargraph/language_server/message/text_document/formatting.rb +28 -7
- data/lib/solargraph/language_server/message/text_document/hover.rb +1 -1
- data/lib/solargraph/library.rb +132 -22
- data/lib/solargraph/parser/rubyvm/node_chainer.rb +0 -1
- data/lib/solargraph/parser/rubyvm/node_processors/args_node.rb +11 -12
- data/lib/solargraph/parser/rubyvm/node_processors/opt_arg_node.rb +1 -6
- data/lib/solargraph/shell.rb +5 -1
- data/lib/solargraph/source.rb +1 -1
- data/lib/solargraph/source/chain/head.rb +0 -16
- data/lib/solargraph/source/source_chainer.rb +1 -0
- data/lib/solargraph/source_map/mapper.rb +0 -5
- data/lib/solargraph/type_checker.rb +2 -2
- data/lib/solargraph/type_checker/checks.rb +4 -4
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/workspace.rb +1 -0
- data/lib/solargraph/workspace/config.rb +4 -3
- data/lib/solargraph/yard_map.rb +41 -39
- data/lib/solargraph/yard_map/core_fills.rb +1 -0
- data/solargraph.gemspec +1 -0
- metadata +16 -2
data/lib/solargraph/version.rb
CHANGED
data/lib/solargraph/workspace.rb
CHANGED
@@ -170,9 +170,10 @@ module Solargraph
|
|
170
170
|
# @param globs [Array<String>]
|
171
171
|
# @return [Array<String>]
|
172
172
|
def process_globs globs
|
173
|
-
result =
|
174
|
-
|
175
|
-
|
173
|
+
result = globs.flat_map do |glob|
|
174
|
+
Dir[File.join directory, glob]
|
175
|
+
.map{ |f| f.gsub(/\\/, '/') }
|
176
|
+
.select { |f| File.file?(f) }
|
176
177
|
end
|
177
178
|
result
|
178
179
|
end
|
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-
|
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
|