solargraph 0.49.0 → 0.50.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +2 -4
- data/SPONSORS.md +3 -1
- data/lib/solargraph/cache.rb +3 -1
- data/lib/solargraph/complex_type.rb +2 -2
- data/lib/solargraph/language_server/host/cataloger.rb +1 -1
- data/lib/solargraph/library.rb +5 -1
- data/lib/solargraph/pin/base_variable.rb +1 -1
- data/lib/solargraph/shell.rb +16 -6
- data/lib/solargraph/source/chain/call.rb +1 -1
- data/lib/solargraph/source/chain.rb +1 -1
- data/lib/solargraph/source_map/mapper.rb +6 -4
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_map.rb +3 -3
- data/solargraph.gemspec +4 -1
- metadata +5 -3
- data/.travis.yml +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a6e7990068e276537a53e6af24d45685d73aba32af134def16d8a66ea671f64
|
4
|
+
data.tar.gz: 57292437f34d43394a161fe4909eb27931d5d33e1b367276faecc7b0132525e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d751b364593fa60cc51c3b9a67086c7a8006dcfe37107daaba4ca1db3f001da28eb289978d81fbe7e84c3a5c9add902417731479517be61269acd958456a057
|
7
|
+
data.tar.gz: 1c38faac70a696f81c5063d5ef64341a41a8d244c47c070ab557dbef8e4ca2180f5c22d5d0338c4b6f24598ea27850895bed2eab7c4d747b7bb2efeb71309eb2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## 0.50.0 - December 5, 2023
|
2
|
+
- Remove .travis.yml as its not longer used (#627)
|
3
|
+
- Fix empty string case when processing requires (#644)
|
4
|
+
- Fix scope() method call on wrong object (#670)
|
5
|
+
- Parse comments that start with multiple hashes (#667)
|
6
|
+
- Use XDG_CACHE_HOME if it exists (#664)
|
7
|
+
- Add rbs mention to readme (#693)
|
8
|
+
- Remove Atom from the readme (#692)
|
9
|
+
- Add more metadata to the gemspec (#691)
|
10
|
+
- Do not deprecate clear command
|
11
|
+
- Library#locate_ref returns nil for unresolved requires (#675)
|
12
|
+
- Hide deprecated commands
|
13
|
+
- List command
|
14
|
+
- Fixes (or ignores) ffi crash (#676)
|
15
|
+
- increase sleep time on cataloger (#677)
|
16
|
+
- YardMap ignores absolute paths (#678)
|
17
|
+
- Clarify macros vs. directives
|
18
|
+
- Infer complex types from method calls
|
19
|
+
- Default cache uses XDG_CACHE_HOME default (#664)
|
20
|
+
|
1
21
|
## 0.49.0 - April 9, 2023
|
2
22
|
- Better union type handling
|
3
23
|
- First version of RBS support
|
data/README.md
CHANGED
@@ -28,10 +28,6 @@ Plug-ins and extensions are available for the following editors:
|
|
28
28
|
* Extension: https://marketplace.visualstudio.com/items?itemName=castwide.solargraph
|
29
29
|
* GitHub: https://github.com/castwide/vscode-solargraph
|
30
30
|
|
31
|
-
* **Atom**
|
32
|
-
* Package: https://atom.io/packages/ruby-solargraph
|
33
|
-
* GitHub: https://github.com/castwide/atom-solargraph
|
34
|
-
|
35
31
|
* **Sublime Text**
|
36
32
|
* Extension: https://packagecontrol.io/packages/LSP
|
37
33
|
* GitHub: https://github.com/sublimelsp/LSP
|
@@ -71,6 +67,8 @@ As of version 0.33.0, Solargraph includes a [type checker](https://github.com/ca
|
|
71
67
|
|
72
68
|
### Updating Core Documentation
|
73
69
|
|
70
|
+
As of version 0.49.0, Solargraph uses [rbs](https://github.com/ruby/rbs) for core and stdlib documentation. The following only applies to prior versions.
|
71
|
+
|
74
72
|
The Solargraph gem ships with documentation for Ruby 2.2.2. You can download documentation for other Ruby versions from the command line.
|
75
73
|
|
76
74
|
$ solargraph list-cores # List the installed documentation versions
|
data/SPONSORS.md
CHANGED
@@ -7,9 +7,11 @@ The following people and organizations provide funding or other resources. [Beco
|
|
7
7
|
## Linked Sponsors
|
8
8
|
|
9
9
|
- **[Calyptix Security](https://www.calyptix.com/)**
|
10
|
+
- **[Lightward](https://lightward.com)**
|
10
11
|
|
11
12
|
## Named Sponsors
|
12
13
|
|
13
14
|
- Akira Yamada
|
15
|
+
- Jesus Castello
|
14
16
|
- Joel Drapper
|
15
|
-
-
|
17
|
+
- Spencer
|
data/lib/solargraph/cache.rb
CHANGED
@@ -9,7 +9,9 @@ module Solargraph
|
|
9
9
|
def base_dir
|
10
10
|
# The directory is not stored in a variable so it can be overridden
|
11
11
|
# in specs.
|
12
|
-
ENV['SOLARGRAPH_CACHE'] ||
|
12
|
+
ENV['SOLARGRAPH_CACHE'] ||
|
13
|
+
ENV['XDG_CACHE_HOME'] ? File.join(ENV['XDG_CACHE_HOME'], 'solargraph') :
|
14
|
+
File.join(Dir.home, '.cache', 'solargraph')
|
13
15
|
end
|
14
16
|
|
15
17
|
# The working directory for the current Ruby and Solargraph versions.
|
@@ -113,7 +113,7 @@ module Solargraph
|
|
113
113
|
return self unless selfy?
|
114
114
|
red = reduce_class(dst)
|
115
115
|
result = @items.map { |i| i.self_to red }
|
116
|
-
ComplexType.parse(*result.map(&:
|
116
|
+
ComplexType.parse(*result.map(&:to_s))
|
117
117
|
end
|
118
118
|
|
119
119
|
def nullable?
|
@@ -169,7 +169,7 @@ module Solargraph
|
|
169
169
|
paren_stack = 0
|
170
170
|
base = String.new
|
171
171
|
subtype_string = String.new
|
172
|
-
type_string
|
172
|
+
type_string&.each_char do |char|
|
173
173
|
if char == '='
|
174
174
|
#raise ComplexTypeError, "Invalid = in type #{type_string}" unless curly_stack > 0
|
175
175
|
elsif char == '<'
|
data/lib/solargraph/library.rb
CHANGED
@@ -258,6 +258,10 @@ module Solargraph
|
|
258
258
|
api_map.locate_pins(location).map { |pin| pin.realize(api_map) }
|
259
259
|
end
|
260
260
|
|
261
|
+
# Match a require reference to a file.
|
262
|
+
#
|
263
|
+
# @param location [Location]
|
264
|
+
# @return [Location, nil]
|
261
265
|
def locate_ref location
|
262
266
|
map = source_map_hash[location.filename]
|
263
267
|
return if map.nil?
|
@@ -268,7 +272,7 @@ module Solargraph
|
|
268
272
|
next unless source_map_hash.key?(full)
|
269
273
|
return Location.new(full, Solargraph::Range.from_to(0, 0, 0, 0))
|
270
274
|
end
|
271
|
-
|
275
|
+
nil
|
272
276
|
rescue FileNotFoundError
|
273
277
|
nil
|
274
278
|
end
|
data/lib/solargraph/shell.rb
CHANGED
@@ -71,7 +71,7 @@ module Solargraph
|
|
71
71
|
STDOUT.puts "Configuration file initialized."
|
72
72
|
end
|
73
73
|
|
74
|
-
desc 'download-core [VERSION]', 'Download core documentation [deprecated]'
|
74
|
+
desc 'download-core [VERSION]', 'Download core documentation [deprecated]', hide: true
|
75
75
|
long_desc %(
|
76
76
|
The `download-core` command is deprecated. Current versions of Solargraph
|
77
77
|
use RBS for core and stdlib documentation.
|
@@ -82,7 +82,7 @@ module Solargraph
|
|
82
82
|
puts 'Current versions of Solargraph use RBS for core and stdlib documentation.'
|
83
83
|
end
|
84
84
|
|
85
|
-
desc 'list-cores', 'List the local documentation versions [deprecated]'
|
85
|
+
desc 'list-cores', 'List the local documentation versions [deprecated]', hide: true
|
86
86
|
long_desc %(
|
87
87
|
The `list-cores` command is deprecated. Current versions of Solargraph use
|
88
88
|
RBS for core and stdlib documentation.
|
@@ -93,7 +93,7 @@ module Solargraph
|
|
93
93
|
puts 'Current versions of Solargraph use RBS for core and stdlib documentation.'
|
94
94
|
end
|
95
95
|
|
96
|
-
desc 'available-cores', 'List available documentation versions [deprecated]'
|
96
|
+
desc 'available-cores', 'List available documentation versions [deprecated]', hide: true
|
97
97
|
long_desc %(
|
98
98
|
The `available-cores` command is deprecated. Current versions of Solargraph
|
99
99
|
use RBS for core and stdlib documentation.
|
@@ -108,7 +108,6 @@ module Solargraph
|
|
108
108
|
long_desc %(
|
109
109
|
This command will delete all core and gem documentation from the cache.
|
110
110
|
)
|
111
|
-
# @deprecated
|
112
111
|
def clear
|
113
112
|
puts "Deleting the cached documentation"
|
114
113
|
Solargraph::Cache.clear
|
@@ -195,7 +194,18 @@ module Solargraph
|
|
195
194
|
puts "Scanned #{directory} (#{api_map.pins.length} pins) in #{time.real} seconds."
|
196
195
|
end
|
197
196
|
|
198
|
-
desc '
|
197
|
+
desc 'list', 'List the files in the workspace and the total count'
|
198
|
+
option :count, type: :boolean, aliases: :c, desc: 'Display the file count only', default: false
|
199
|
+
option :directory, type: :string, aliases: :d, desc: 'The directory to read', default: '.'
|
200
|
+
def list
|
201
|
+
workspace = Solargraph::Workspace.new(options[:directory])
|
202
|
+
unless options[:count]
|
203
|
+
workspace.filenames.each { |f| puts f }
|
204
|
+
end
|
205
|
+
puts "#{workspace.filenames.length} files total."
|
206
|
+
end
|
207
|
+
|
208
|
+
desc 'bundle', 'Generate documentation for bundled gems [deprecated]', hide: true
|
199
209
|
long_desc %(
|
200
210
|
The `bundle` command is deprecated. Solargraph currently uses RBS instead.
|
201
211
|
)
|
@@ -205,7 +215,7 @@ module Solargraph
|
|
205
215
|
puts 'The `bundle` command is deprecated. Solargraph currently uses RBS instead.'
|
206
216
|
end
|
207
217
|
|
208
|
-
desc 'rdoc GEM [VERSION]', 'Use RDoc to cache documentation [deprecated]'
|
218
|
+
desc 'rdoc GEM [VERSION]', 'Use RDoc to cache documentation [deprecated]', hide: true
|
209
219
|
long_desc %(
|
210
220
|
The `rdoc` command is deprecated. Solargraph currently uses RBS instead.
|
211
221
|
)
|
@@ -199,7 +199,7 @@ module Solargraph
|
|
199
199
|
# @param name_pin [Pin::Base]
|
200
200
|
# @return [Array<Pin::Base>]
|
201
201
|
def super_pins api_map, name_pin
|
202
|
-
pins = api_map.get_method_stack(name_pin.namespace, name_pin.name, scope: name_pin.scope)
|
202
|
+
pins = api_map.get_method_stack(name_pin.namespace, name_pin.name, scope: name_pin.context.scope)
|
203
203
|
pins.reject{|p| p.path == name_pin.path}
|
204
204
|
end
|
205
205
|
|
@@ -162,7 +162,7 @@ module Solargraph
|
|
162
162
|
sorted = possibles.map { |t| t.rooted? ? "::#{t}" : t.to_s }.sort { |a, _| a == 'nil' ? 1 : 0 }
|
163
163
|
ComplexType.parse(*sorted)
|
164
164
|
else
|
165
|
-
possibles.
|
165
|
+
ComplexType.parse(possibles.map(&:to_s).join(', '))
|
166
166
|
end
|
167
167
|
return type if context.nil? || context.return_type.undefined?
|
168
168
|
type.self_to(context.return_type.namespace)
|
@@ -12,7 +12,7 @@ module Solargraph
|
|
12
12
|
|
13
13
|
private_class_method :new
|
14
14
|
|
15
|
-
|
15
|
+
DIRECTIVE_REGEXP = /(@\!method|@\!attribute|@\!visibility|@\!domain|@\!macro|@\!parse|@\!override)/.freeze
|
16
16
|
|
17
17
|
# Generate the data.
|
18
18
|
#
|
@@ -65,7 +65,7 @@ module Solargraph
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def process_comment source_position, comment_position, comment
|
68
|
-
return unless comment.encode('UTF-8', invalid: :replace, replace: '?') =~
|
68
|
+
return unless comment.encode('UTF-8', invalid: :replace, replace: '?') =~ DIRECTIVE_REGEXP
|
69
69
|
cmnt = remove_inline_comment_hashes(comment)
|
70
70
|
parse = Solargraph::Source.parse_docstring(cmnt)
|
71
71
|
last_line = 0
|
@@ -198,6 +198,8 @@ module Solargraph
|
|
198
198
|
namespace.domains.concat directive.tag.types unless directive.tag.types.nil?
|
199
199
|
when 'override'
|
200
200
|
pins.push Pin::Reference::Override.new(location, directive.tag.name, docstring.tags)
|
201
|
+
when 'macro'
|
202
|
+
# @todo Handle macros
|
201
203
|
end
|
202
204
|
end
|
203
205
|
|
@@ -211,7 +213,7 @@ module Solargraph
|
|
211
213
|
started = false
|
212
214
|
comment.lines.each { |l|
|
213
215
|
# Trim the comment and minimum leading whitespace
|
214
|
-
p = l.encode('UTF-8', invalid: :replace, replace: '?').gsub(
|
216
|
+
p = l.encode('UTF-8', invalid: :replace, replace: '?').gsub(/^#+/, '')
|
215
217
|
if num.nil? && !p.strip.empty?
|
216
218
|
num = p.index(/[^ ]/)
|
217
219
|
started = true
|
@@ -226,7 +228,7 @@ module Solargraph
|
|
226
228
|
|
227
229
|
# @return [void]
|
228
230
|
def process_comment_directives
|
229
|
-
return unless @code.encode('UTF-8', invalid: :replace, replace: '?') =~
|
231
|
+
return unless @code.encode('UTF-8', invalid: :replace, replace: '?') =~ DIRECTIVE_REGEXP
|
230
232
|
code_lines = @code.lines
|
231
233
|
@source.associated_comments.each do |line, comments|
|
232
234
|
src_pos = line ? Position.new(line, code_lines[line].to_s.chomp.index(/[^\s]/) || 0) : Position.new(code_lines.length, 0)
|
data/lib/solargraph/version.rb
CHANGED
data/lib/solargraph/yard_map.rb
CHANGED
@@ -219,8 +219,8 @@ module Solargraph
|
|
219
219
|
def pins_for_require r, already_errored
|
220
220
|
result = []
|
221
221
|
begin
|
222
|
-
name = r.split('/').first
|
223
|
-
return [] if @source_gems.include?(name) || @gem_paths.key?(name)
|
222
|
+
name = r.split('/').first.to_s
|
223
|
+
return [] if name.empty? || @source_gems.include?(name) || @gem_paths.key?(name)
|
224
224
|
spec = spec_for_require(name)
|
225
225
|
@gem_paths[name] = spec.full_gem_path
|
226
226
|
|
@@ -282,7 +282,7 @@ module Solargraph
|
|
282
282
|
# @param path [String]
|
283
283
|
# @return [Gem::Specification]
|
284
284
|
def spec_for_require path
|
285
|
-
name = path.split('/').first
|
285
|
+
name = path.split('/').first.to_s
|
286
286
|
spec = Gem::Specification.find_by_name(name, @gemset[name])
|
287
287
|
|
288
288
|
# Avoid loading the spec again if it's going to be skipped anyway
|
data/solargraph.gemspec
CHANGED
@@ -16,7 +16,10 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.homepage = 'https://solargraph.org'
|
17
17
|
s.license = 'MIT'
|
18
18
|
s.executables = ['solargraph']
|
19
|
-
s.metadata["funding_uri"]
|
19
|
+
s.metadata["funding_uri"] = "https://www.patreon.com/castwide"
|
20
|
+
s.metadata["bug_tracker_uri"] = "https://github.com/castwide/solargraph/issues"
|
21
|
+
s.metadata["changelog_uri"] = "https://github.com/castwide/solargraph/blob/master/CHANGELOG.md"
|
22
|
+
s.metadata["source_code_uri"] = "https://github.com/castwide/solargraph"
|
20
23
|
|
21
24
|
s.required_ruby_version = '>= 2.6'
|
22
25
|
|
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.50.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: 2023-
|
11
|
+
date: 2023-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|
@@ -307,7 +307,6 @@ files:
|
|
307
307
|
- ".github/workflows/rspec.yml"
|
308
308
|
- ".gitignore"
|
309
309
|
- ".rspec"
|
310
|
-
- ".travis.yml"
|
311
310
|
- ".yardopts"
|
312
311
|
- CHANGELOG.md
|
313
312
|
- Gemfile
|
@@ -566,6 +565,9 @@ licenses:
|
|
566
565
|
- MIT
|
567
566
|
metadata:
|
568
567
|
funding_uri: https://www.patreon.com/castwide
|
568
|
+
bug_tracker_uri: https://github.com/castwide/solargraph/issues
|
569
|
+
changelog_uri: https://github.com/castwide/solargraph/blob/master/CHANGELOG.md
|
570
|
+
source_code_uri: https://github.com/castwide/solargraph
|
569
571
|
post_install_message:
|
570
572
|
rdoc_options: []
|
571
573
|
require_paths:
|
data/.travis.yml
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.4
|
4
|
-
- 2.5
|
5
|
-
- 2.6
|
6
|
-
- 2.7
|
7
|
-
- 3.0
|
8
|
-
- jruby-head
|
9
|
-
matrix:
|
10
|
-
include:
|
11
|
-
- rvm: 2.7
|
12
|
-
os: osx
|
13
|
-
allow_failures:
|
14
|
-
- rvm: jruby-head
|
15
|
-
before_install:
|
16
|
-
- gem update --system
|
17
|
-
- gem install bundler
|
18
|
-
before_script: yard gems
|
19
|
-
script: rspec
|