solargraph 0.39.4 → 0.39.5
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/lib/solargraph/documentor.rb +2 -0
- data/lib/solargraph/language_server/uri_helpers.rb +22 -3
- data/lib/solargraph/parser/rubyvm/node_processors.rb +1 -0
- data/lib/solargraph/parser/rubyvm/node_processors/send_node.rb +1 -39
- data/lib/solargraph/pin/attribute.rb +1 -1
- data/lib/solargraph/pin/base_method.rb +1 -1
- data/lib/solargraph/pin/base_variable.rb +1 -1
- data/lib/solargraph/pin/block.rb +1 -1
- data/lib/solargraph/pin/closure.rb +1 -1
- data/lib/solargraph/pin/constant.rb +1 -1
- data/lib/solargraph/pin/local_variable.rb +1 -1
- data/lib/solargraph/pin/method.rb +1 -1
- data/lib/solargraph/pin/method_alias.rb +1 -1
- data/lib/solargraph/pin/namespace.rb +1 -1
- data/lib/solargraph/pin/parameter.rb +1 -1
- data/lib/solargraph/pin/proxy_type.rb +1 -1
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/views/_name_type_tag.erb +1 -1
- data/lib/solargraph/workspace.rb +1 -1
- data/lib/solargraph/yard_map/mapper.rb +3 -0
- data/lib/solargraph/yard_map/rdoc_to_yard.rb +2 -0
- 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: 42d82e12b3dbc74f908e6fd15757e8856c7c3af088ccbfbc6724f390884f878d
|
4
|
+
data.tar.gz: df04fa34d85b0633d05ab8fd216873264a4cdaa148089ffa3af909ec68a227a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1972e824e94ad830815eb780629ef985a5be4b21247f426b603e209cecc60d6c5c02219c63cdc2c6c9ab184013d72e1798c29ef90b5a91d77a92f8dd35e1295
|
7
|
+
data.tar.gz: 7f5564c3de416999a40e381d853746e759898da6fa09eb6d967735478a24635f1af3cee6695894b7213c8b6746e73d8e3d57d3adc141ab505040e0eb4c8134cd
|
@@ -5,6 +5,7 @@ require 'json'
|
|
5
5
|
require 'open3'
|
6
6
|
require 'shellwords'
|
7
7
|
require 'yard'
|
8
|
+
require 'fileutils'
|
8
9
|
|
9
10
|
module Solargraph
|
10
11
|
class Documentor
|
@@ -25,6 +26,7 @@ module Solargraph
|
|
25
26
|
Documentor.specs_from_bundle(@directory).each_pair do |name, version|
|
26
27
|
yd = YARD::Registry.yardoc_file_for_gem(name, "= #{version}")
|
27
28
|
if !yd || @rebuild
|
29
|
+
FileUtils.safe_unlink File.join(YardMap::CoreDocs.cache_dir, 'gems', "#{name}-#{version}.ser")
|
28
30
|
@out.puts "Documenting #{name} #{version}"
|
29
31
|
`yard gems #{name} #{version} #{@rebuild ? '--rebuild' : ''}`
|
30
32
|
yd = YARD::Registry.yardoc_file_for_gem(name, "= #{version}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'cgi'
|
4
4
|
|
5
5
|
module Solargraph
|
6
6
|
module LanguageServer
|
@@ -14,7 +14,7 @@ module Solargraph
|
|
14
14
|
# @param uri [String]
|
15
15
|
# @return [String]
|
16
16
|
def uri_to_file uri
|
17
|
-
|
17
|
+
decode(uri).sub(/^file\:\/\//, '').sub(/^\/([a-z]\:)/i, '\1')
|
18
18
|
end
|
19
19
|
|
20
20
|
# Convert a file path to a URI.
|
@@ -22,7 +22,26 @@ module Solargraph
|
|
22
22
|
# @param file [String]
|
23
23
|
# @return [String]
|
24
24
|
def file_to_uri file
|
25
|
-
"file://#{
|
25
|
+
"file://#{encode(file.gsub(/^([a-z]\:)/i, '/\1'))}"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Encode text to be used as a URI path component in LSP.
|
29
|
+
#
|
30
|
+
# @param text [String]
|
31
|
+
# @return [String]
|
32
|
+
def encode text
|
33
|
+
CGI.escape(text)
|
34
|
+
.gsub('%3A', ':')
|
35
|
+
.gsub('%5C', '\\')
|
36
|
+
.gsub('%2F', '/')
|
37
|
+
end
|
38
|
+
|
39
|
+
# Decode text from a URI path component in LSP.
|
40
|
+
#
|
41
|
+
# @param text [String]
|
42
|
+
# @return [String]
|
43
|
+
def decode text
|
44
|
+
CGI.unescape(text)
|
26
45
|
end
|
27
46
|
end
|
28
47
|
end
|
@@ -36,6 +36,7 @@ module Solargraph
|
|
36
36
|
register :RESBODY, Rubyvm::NodeProcessors::ResbodyNode
|
37
37
|
register :DEFN, Rubyvm::NodeProcessors::DefNode
|
38
38
|
register :DEFS, Rubyvm::NodeProcessors::DefsNode
|
39
|
+
register :CALL, Rubyvm::NodeProcessors::SendNode
|
39
40
|
register :FCALL, Rubyvm::NodeProcessors::SendNode
|
40
41
|
register :VCALL, Rubyvm::NodeProcessors::SendNode
|
41
42
|
register :CLASS, Rubyvm::NodeProcessors::NamespaceNode
|
@@ -43,45 +43,7 @@ module Solargraph
|
|
43
43
|
process_prepend
|
44
44
|
elsif node.children[0] == :private_constant
|
45
45
|
process_private_constant
|
46
|
-
|
47
|
-
process_children
|
48
|
-
return
|
49
|
-
# @todo Get rid of legacy
|
50
|
-
if node.children[0].nil?
|
51
|
-
if [:private, :public, :protected].include?(node.children[1])
|
52
|
-
if (node.children.length > 2)
|
53
|
-
node.children[2..-1].each do |child|
|
54
|
-
next unless child.is_a?(AST::Node) && (child.type == :sym || child.type == :str)
|
55
|
-
name = child.children[0].to_s
|
56
|
-
matches = pins.select{ |pin| pin.is_a?(Pin::BaseMethod) && pin.name == name && pin.namespace == region.closure.full_context.namespace && pin.context.scope == (region.scope || :instance)}
|
57
|
-
matches.each do |pin|
|
58
|
-
# @todo Smelly instance variable access
|
59
|
-
pin.instance_variable_set(:@visibility, node.children[1])
|
60
|
-
end
|
61
|
-
end
|
62
|
-
else
|
63
|
-
# @todo Smelly instance variable access
|
64
|
-
region.instance_variable_set(:@visibility, node.children[1])
|
65
|
-
end
|
66
|
-
elsif node.children[1] == :module_function
|
67
|
-
process_module_function
|
68
|
-
elsif [:attr_reader, :attr_writer, :attr_accessor].include?(node.children[1])
|
69
|
-
process_attribute
|
70
|
-
elsif node.children[1] == :include
|
71
|
-
process_include
|
72
|
-
elsif node.children[1] == :extend
|
73
|
-
process_extend
|
74
|
-
elsif node.children[1] == :require
|
75
|
-
process_require
|
76
|
-
elsif node.children[1] == :private_constant
|
77
|
-
process_private_constant
|
78
|
-
elsif node.children[1] == :alias_method && node.children[2] && node.children[2] && node.children[2].type == :sym && node.children[3] && node.children[3].type == :sym
|
79
|
-
process_alias_method
|
80
|
-
elsif node.children[1] == :private_class_method && node.children[2].is_a?(AST::Node)
|
81
|
-
# Processing a private class can potentially handle children on its own
|
82
|
-
return if process_private_class_method
|
83
|
-
end
|
84
|
-
elsif node.children[1] == :require && node.children[0].to_s == '(const nil :Bundler)'
|
46
|
+
elsif node.children[1] == :require && unpack_name(node.children[0]) == 'Bundler'
|
85
47
|
pins.push Pin::Reference::Require.new(Solargraph::Location.new(region.filename, Solargraph::Range.from_to(0, 0, 0, 0)), 'bundler/require')
|
86
48
|
end
|
87
49
|
process_children
|
@@ -14,7 +14,7 @@ module Solargraph
|
|
14
14
|
# @param visibility [::Symbol] :public, :protected, or :private
|
15
15
|
# @param explicit [Boolean]
|
16
16
|
def initialize visibility: :public, explicit: true, **splat
|
17
|
-
super(splat)
|
17
|
+
super(**splat)
|
18
18
|
@visibility = visibility
|
19
19
|
@explicit = explicit
|
20
20
|
end
|
data/lib/solargraph/pin/block.rb
CHANGED
@@ -14,7 +14,7 @@ module Solargraph
|
|
14
14
|
# @param gates [Array<String>]
|
15
15
|
def initialize type: :class, visibility: :public, gates: [''], **splat
|
16
16
|
# super(location, namespace, name, comments)
|
17
|
-
super(splat)
|
17
|
+
super(**splat)
|
18
18
|
@type = type
|
19
19
|
@visibility = visibility
|
20
20
|
if name.start_with?('::')
|
data/lib/solargraph/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<% unless tag.types.nil? or tag.types.empty? %>
|
3
3
|
[<%= escape(tag.types.join(', ')) %>]
|
4
4
|
<% end %>
|
5
|
-
<% unless tag.text.empty? %>
|
5
|
+
<% unless tag.text.nil? || tag.text.empty? %>
|
6
6
|
<% unless (tag.name.nil? or tag.name.empty?) and (tag.types.nil? or tag.types.empty?) %>
|
7
7
|
-
|
8
8
|
<% end %>
|
data/lib/solargraph/workspace.rb
CHANGED
@@ -170,7 +170,7 @@ module Solargraph
|
|
170
170
|
Dir.chdir base do
|
171
171
|
begin
|
172
172
|
# @type [Gem::Specification]
|
173
|
-
spec = eval(File.read(file),
|
173
|
+
spec = eval(File.read(file), nil, file)
|
174
174
|
next unless Gem::Specification === spec
|
175
175
|
@gemnames.push spec.name
|
176
176
|
result.concat(spec.require_paths.map { |path| File.join(base, path) })
|
@@ -17,6 +17,9 @@ module Solargraph
|
|
17
17
|
@code_objects.each do |co|
|
18
18
|
@pins.concat generate_pins co
|
19
19
|
end
|
20
|
+
# Some yardocs contain documentation for dependencies that can be
|
21
|
+
# ignored here. The YardMap will load dependencies separately.
|
22
|
+
@pins.keep_if { |pin| pin.location.nil? || File.file?(pin.location.filename) } if @spec
|
20
23
|
@pins
|
21
24
|
end
|
22
25
|
|
@@ -95,6 +95,8 @@ module Solargraph
|
|
95
95
|
FileUtils.mkdir_p cache_dir
|
96
96
|
# @todo Should merge be true?
|
97
97
|
YARD::Registry.save true, cache_dir
|
98
|
+
# Clear the serialized cache if it exists
|
99
|
+
FileUtils.safe_unlink File.join(CoreDocs.cache_dir, 'gems', "#{spec.name}-#{spec.version}.ser")
|
98
100
|
end
|
99
101
|
end
|
100
102
|
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.5
|
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-05-
|
11
|
+
date: 2020-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|