solargraph 0.32.5 → 0.33.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -11
- data/lib/solargraph.rb +1 -2
- data/lib/solargraph/api_map.rb +93 -63
- data/lib/solargraph/api_map/cache.rb +16 -1
- data/lib/solargraph/api_map/source_to_yard.rb +16 -7
- data/lib/solargraph/api_map/store.rb +55 -12
- data/lib/solargraph/complex_type.rb +58 -14
- data/lib/solargraph/complex_type/type_methods.rb +2 -2
- data/lib/solargraph/complex_type/unique_type.rb +33 -4
- data/lib/solargraph/core_fills.rb +40 -12
- data/lib/solargraph/diagnostics.rb +4 -3
- data/lib/solargraph/diagnostics/base.rb +6 -0
- data/lib/solargraph/diagnostics/require_not_found.rb +17 -10
- data/lib/solargraph/diagnostics/rubocop_helpers.rb +2 -0
- data/lib/solargraph/diagnostics/type_check.rb +51 -0
- data/lib/solargraph/diagnostics/update_errors.rb +1 -0
- data/lib/solargraph/language_server/host.rb +55 -25
- data/lib/solargraph/language_server/host/diagnoser.rb +1 -2
- data/lib/solargraph/language_server/host/dispatch.rb +4 -8
- data/lib/solargraph/language_server/host/sources.rb +1 -1
- data/lib/solargraph/language_server/message.rb +1 -0
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +4 -2
- data/lib/solargraph/language_server/message/initialize.rb +9 -0
- data/lib/solargraph/language_server/message/initialized.rb +1 -0
- data/lib/solargraph/language_server/message/text_document.rb +1 -0
- data/lib/solargraph/language_server/message/text_document/code_action.rb +15 -0
- data/lib/solargraph/language_server/message/text_document/completion.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/definition.rb +25 -5
- data/lib/solargraph/language_server/message/text_document/hover.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/signature_help.rb +4 -0
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +8 -4
- data/lib/solargraph/language_server/transport/adapter.rb +12 -15
- data/lib/solargraph/library.rb +23 -6
- data/lib/solargraph/location.rb +4 -0
- data/lib/solargraph/pin.rb +7 -3
- data/lib/solargraph/pin/attribute.rb +14 -13
- data/lib/solargraph/pin/base.rb +56 -43
- data/lib/solargraph/pin/base_method.rb +41 -18
- data/lib/solargraph/pin/base_variable.rb +17 -15
- data/lib/solargraph/pin/block.rb +22 -4
- data/lib/solargraph/pin/closure.rb +28 -0
- data/lib/solargraph/pin/common.rb +59 -0
- data/lib/solargraph/pin/constant.rb +4 -4
- data/lib/solargraph/pin/conversions.rb +8 -8
- data/lib/solargraph/pin/duck_method.rb +3 -3
- data/lib/solargraph/pin/instance_variable.rb +30 -0
- data/lib/solargraph/pin/keyword.rb +1 -1
- data/lib/solargraph/pin/local_variable.rb +3 -3
- data/lib/solargraph/pin/localized.rb +9 -5
- data/lib/solargraph/pin/method.rb +26 -40
- data/lib/solargraph/pin/method_alias.rb +9 -6
- data/lib/solargraph/pin/namespace.rb +33 -10
- data/lib/solargraph/pin/parameter.rb +150 -0
- data/lib/solargraph/pin/proxy_type.rb +8 -8
- data/lib/solargraph/pin/reference.rb +1 -12
- data/lib/solargraph/pin/reference/override.rb +18 -0
- data/lib/solargraph/pin/reference/require.rb +2 -1
- data/lib/solargraph/pin/singleton.rb +9 -0
- data/lib/solargraph/pin/symbol.rb +9 -4
- data/lib/solargraph/pin/yard_pin/constant.rb +12 -3
- data/lib/solargraph/pin/yard_pin/method.rb +18 -6
- data/lib/solargraph/pin/yard_pin/namespace.rb +13 -1
- data/lib/solargraph/position.rb +1 -1
- data/lib/solargraph/range.rb +4 -0
- data/lib/solargraph/shell.rb +83 -4
- data/lib/solargraph/source.rb +32 -12
- data/lib/solargraph/source/chain.rb +48 -28
- data/lib/solargraph/source/chain/call.rb +37 -38
- data/lib/solargraph/source/chain/constant.rb +1 -1
- data/lib/solargraph/source/chain/head.rb +2 -8
- data/lib/solargraph/source/chain/instance_variable.rb +1 -1
- data/lib/solargraph/source/chain/link.rb +2 -0
- data/lib/solargraph/source/cursor.rb +59 -24
- data/lib/solargraph/source/node_chainer.rb +0 -2
- data/lib/solargraph/source/node_methods.rb +12 -6
- data/lib/solargraph/source/source_chainer.rb +38 -44
- data/lib/solargraph/source_map.rb +11 -18
- data/lib/solargraph/source_map/clip.rb +13 -15
- data/lib/solargraph/source_map/mapper.rb +37 -26
- data/lib/solargraph/source_map/node_processor.rb +13 -8
- data/lib/solargraph/source_map/node_processor/alias_node.rb +8 -8
- data/lib/solargraph/source_map/node_processor/args_node.rb +10 -16
- data/lib/solargraph/source_map/node_processor/base.rb +47 -4
- data/lib/solargraph/source_map/node_processor/block_node.rb +9 -4
- data/lib/solargraph/source_map/node_processor/casgn_node.rb +7 -2
- data/lib/solargraph/source_map/node_processor/cvasgn_node.rb +8 -3
- data/lib/solargraph/source_map/node_processor/def_node.rb +45 -38
- data/lib/solargraph/source_map/node_processor/defs_node.rb +16 -6
- data/lib/solargraph/source_map/node_processor/gvasgn_node.rb +8 -1
- data/lib/solargraph/source_map/node_processor/ivasgn_node.rb +20 -6
- data/lib/solargraph/source_map/node_processor/lvasgn_node.rb +10 -4
- data/lib/solargraph/source_map/node_processor/namespace_node.rb +18 -12
- data/lib/solargraph/source_map/node_processor/orasgn_node.rb +1 -1
- data/lib/solargraph/source_map/node_processor/resbody_node.rb +30 -0
- data/lib/solargraph/source_map/node_processor/sclass_node.rb +7 -1
- data/lib/solargraph/source_map/node_processor/send_node.rb +102 -52
- data/lib/solargraph/source_map/node_processor/sym_node.rb +4 -1
- data/lib/solargraph/source_map/region.rb +9 -8
- data/lib/solargraph/type_checker.rb +282 -0
- data/lib/solargraph/type_checker/param_def.rb +47 -0
- data/lib/solargraph/type_checker/problem.rb +25 -0
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/views/environment.erb +1 -1
- data/lib/solargraph/workspace.rb +2 -2
- data/lib/solargraph/workspace/config.rb +0 -8
- data/lib/solargraph/yard_map.rb +25 -69
- data/lib/solargraph/yard_map/core_docs.rb +8 -3
- data/lib/solargraph/yard_map/core_gen.rb +1 -3
- data/lib/solargraph/yard_map/mapper.rb +85 -0
- data/lib/yard-solargraph.rb +2 -0
- metadata +14 -14
- data/lib/solargraph/diagnostics/type_not_defined.rb +0 -108
- data/lib/solargraph/live_map.rb +0 -126
- data/lib/solargraph/live_map/cache.rb +0 -38
- data/lib/solargraph/pin/block_parameter.rb +0 -103
- data/lib/solargraph/pin/method_parameter.rb +0 -40
- data/lib/solargraph/pin/plugin/method.rb +0 -25
- data/lib/solargraph/plugin.rb +0 -8
- data/lib/solargraph/plugin/base.rb +0 -41
- data/lib/solargraph/plugin/canceler.rb +0 -11
- data/lib/solargraph/plugin/process.rb +0 -172
- data/lib/solargraph/plugin/runtime.rb +0 -134
- data/lib/yard-coregen.rb +0 -16
@@ -9,38 +9,21 @@ module Solargraph
|
|
9
9
|
# @return [Parser::AST::Node]
|
10
10
|
attr_reader :node
|
11
11
|
|
12
|
-
def initialize
|
13
|
-
super(
|
14
|
-
@scope = scope
|
15
|
-
@visibility = visibility
|
12
|
+
def initialize args: [], node: nil, **splat
|
13
|
+
super(splat)
|
16
14
|
@parameters = args
|
17
15
|
@node = node
|
18
16
|
end
|
19
17
|
|
20
18
|
# @return [Array<String>]
|
21
19
|
def parameter_names
|
22
|
-
@parameter_names ||= parameters.map{|p| p.split(/[ =:]/).first}
|
20
|
+
@parameter_names ||= parameters.map{|p| p.split(/[ =:]/).first.gsub(/^(\*{1,2}|&)/, '')}
|
23
21
|
end
|
24
22
|
|
25
23
|
def kind
|
26
24
|
Solargraph::Pin::METHOD
|
27
25
|
end
|
28
26
|
|
29
|
-
def path
|
30
|
-
@path ||= namespace + (scope == :instance ? '#' : '.') + name
|
31
|
-
end
|
32
|
-
|
33
|
-
def context
|
34
|
-
@context ||= begin
|
35
|
-
if scope == :class
|
36
|
-
# @todo Determine whether the namespace is a class or a module
|
37
|
-
ComplexType.try_parse("Class<#{namespace}>")
|
38
|
-
else
|
39
|
-
ComplexType.try_parse(namespace)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
27
|
def completion_item_kind
|
45
28
|
Solargraph::LanguageServer::CompletionItemKinds::METHOD
|
46
29
|
end
|
@@ -59,14 +42,14 @@ module Solargraph
|
|
59
42
|
lines = []
|
60
43
|
param_tags.each do |p|
|
61
44
|
l = "* #{p.name}"
|
62
|
-
l += " [#{p.types.join(', ')}]" unless p.types.nil? or p.types.empty?
|
45
|
+
l += " [#{p.types.map { |t| HTMLEntities.new.encode(t) }.join(', ')}]" unless p.types.nil? or p.types.empty?
|
63
46
|
l += " #{p.text}"
|
64
47
|
lines.push l
|
65
48
|
end
|
66
49
|
@documentation += lines.join("\n")
|
67
50
|
end
|
68
51
|
end
|
69
|
-
@documentation
|
52
|
+
@documentation.to_s
|
70
53
|
end
|
71
54
|
|
72
55
|
def nearly? other
|
@@ -80,14 +63,6 @@ module Solargraph
|
|
80
63
|
infer_from_return_nodes(api_map)
|
81
64
|
end
|
82
65
|
|
83
|
-
# @deprecated Use #typify and/or #probe instead
|
84
|
-
def infer api_map
|
85
|
-
Solargraph::Logging.logger.warn 'WARNING: Pin #infer methods are deprecated. Use #typify or #probe instead.'
|
86
|
-
type = typify(api_map)
|
87
|
-
return type unless type.undefined?
|
88
|
-
probe api_map
|
89
|
-
end
|
90
|
-
|
91
66
|
def try_merge! pin
|
92
67
|
return false unless super
|
93
68
|
@node = pin.node
|
@@ -96,7 +71,7 @@ module Solargraph
|
|
96
71
|
|
97
72
|
private
|
98
73
|
|
99
|
-
# @return [Parser::AST
|
74
|
+
# @return [Parser::AST::Node, nil]
|
100
75
|
def method_body_node
|
101
76
|
return nil if node.nil?
|
102
77
|
return node.children[2] if node.type == :def
|
@@ -108,18 +83,29 @@ module Solargraph
|
|
108
83
|
# @return [ComplexType]
|
109
84
|
def infer_from_return_nodes api_map
|
110
85
|
result = []
|
86
|
+
has_nil = false
|
111
87
|
returns_from(method_body_node).each do |n|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
)
|
117
|
-
|
118
|
-
|
119
|
-
|
88
|
+
if n.nil? || n.type == :nil
|
89
|
+
has_nil = true
|
90
|
+
next
|
91
|
+
end
|
92
|
+
literal = infer_literal_node_type(n)
|
93
|
+
if literal
|
94
|
+
result.push ComplexType.try_parse(literal)
|
95
|
+
else
|
96
|
+
next if n.loc.nil? || n.loc.expression.nil?
|
97
|
+
clip = api_map.clip_at(
|
98
|
+
location.filename,
|
99
|
+
[n.loc.expression.last_line, n.loc.expression.last_column]
|
100
|
+
)
|
101
|
+
chain = Solargraph::Source::NodeChainer.chain(n, location.filename)
|
102
|
+
type = chain.infer(api_map, self, clip.locals)
|
103
|
+
result.push type unless type.undefined?
|
104
|
+
end
|
120
105
|
end
|
106
|
+
result.push ComplexType::NIL if has_nil
|
121
107
|
return ComplexType::UNDEFINED if result.empty?
|
122
|
-
ComplexType.try_parse(*result.map(&:tag))
|
108
|
+
ComplexType.try_parse(*result.map(&:tag).uniq)
|
123
109
|
end
|
124
110
|
end
|
125
111
|
end
|
@@ -4,16 +4,15 @@ module Solargraph
|
|
4
4
|
# examples that defer mapping are aliases for superclass methods or
|
5
5
|
# methods from included modules.
|
6
6
|
#
|
7
|
-
class MethodAlias <
|
7
|
+
class MethodAlias < BaseMethod
|
8
|
+
# @return [::Symbol]
|
8
9
|
attr_reader :scope
|
9
10
|
|
11
|
+
# @return [String]
|
10
12
|
attr_reader :original
|
11
13
|
|
12
|
-
def initialize
|
13
|
-
|
14
|
-
# determine if the visibility is defined by the location of the
|
15
|
-
# alias call or the original method.
|
16
|
-
super(location, namespace, name, '')
|
14
|
+
def initialize scope: :instance, original: nil, **splat
|
15
|
+
super(splat)
|
17
16
|
@scope = scope
|
18
17
|
@original = original
|
19
18
|
end
|
@@ -22,6 +21,10 @@ module Solargraph
|
|
22
21
|
Pin::METHOD_ALIAS
|
23
22
|
end
|
24
23
|
|
24
|
+
def visibility
|
25
|
+
:public
|
26
|
+
end
|
27
|
+
|
25
28
|
def path
|
26
29
|
@path ||= namespace + (scope == :instance ? '#' : '.') + name
|
27
30
|
end
|
@@ -1,24 +1,47 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
|
-
class Namespace <
|
4
|
-
# @return [Symbol] :public or :private
|
3
|
+
class Namespace < Closure
|
4
|
+
# @return [::Symbol] :public or :private
|
5
5
|
attr_reader :visibility
|
6
6
|
|
7
|
-
# @return [Symbol] :class or :module
|
7
|
+
# @return [::Symbol] :class or :module
|
8
8
|
attr_reader :type
|
9
9
|
|
10
|
-
def initialize location, namespace, name, comments, type, visibility
|
11
|
-
|
10
|
+
# def initialize location, namespace, name, comments, type, visibility
|
11
|
+
def initialize type: :class, visibility: :public, **splat
|
12
|
+
# super(location, namespace, name, comments)
|
13
|
+
super(splat)
|
12
14
|
@type = type
|
13
15
|
@visibility = visibility
|
16
|
+
if name.start_with?('::')
|
17
|
+
@name = name[2..-1]
|
18
|
+
@closure = Pin::ROOT_PIN
|
19
|
+
end
|
20
|
+
@gate = @name
|
21
|
+
if @gate.include?('::')
|
22
|
+
parts = @gate.split('::')
|
23
|
+
@name = parts.last
|
24
|
+
adjusted = (@closure ? @closure.path : Pin::ROOT_PIN.path).split('::') + parts[0..-2]
|
25
|
+
# @closure = Pin::Base.new(kind: NAMESPACE, name: adjusted.join('::'))
|
26
|
+
@closure = Pin::Namespace.new(name: adjusted.join('::'))
|
27
|
+
@context = nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def namespace
|
32
|
+
context.namespace
|
14
33
|
end
|
15
34
|
|
16
35
|
def kind
|
17
36
|
Pin::NAMESPACE
|
18
37
|
end
|
19
38
|
|
20
|
-
def
|
21
|
-
@
|
39
|
+
def full_context
|
40
|
+
@full_context ||= ComplexType.try_parse("#{type.to_s.capitalize}<#{path}>")
|
41
|
+
end
|
42
|
+
|
43
|
+
def binder
|
44
|
+
full_context
|
22
45
|
end
|
23
46
|
|
24
47
|
def scope
|
@@ -38,8 +61,8 @@ module Solargraph
|
|
38
61
|
@path ||= (namespace.empty? ? '' : "#{namespace}::") + name
|
39
62
|
end
|
40
63
|
|
41
|
-
def
|
42
|
-
@
|
64
|
+
def return_type
|
65
|
+
@return_type ||= ComplexType.try_parse( (type == :class ? 'Class' : 'Module') + "<#{path}>" )
|
43
66
|
end
|
44
67
|
|
45
68
|
def domains
|
@@ -47,7 +70,7 @@ module Solargraph
|
|
47
70
|
end
|
48
71
|
|
49
72
|
def typify api_map
|
50
|
-
|
73
|
+
return_type
|
51
74
|
end
|
52
75
|
end
|
53
76
|
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
module Solargraph
|
2
|
+
module Pin
|
3
|
+
class Parameter < LocalVariable
|
4
|
+
def return_type
|
5
|
+
if @return_type.nil?
|
6
|
+
@return_type = ComplexType.new
|
7
|
+
found = param_tag
|
8
|
+
@return_type = ComplexType.try_parse(*found.types) unless found.nil? or found.types.nil?
|
9
|
+
end
|
10
|
+
super
|
11
|
+
@return_type
|
12
|
+
end
|
13
|
+
|
14
|
+
# The parameter's zero-based location in the block's signature.
|
15
|
+
#
|
16
|
+
# @return [Integer]
|
17
|
+
def index
|
18
|
+
closure.parameter_names.index(name)
|
19
|
+
end
|
20
|
+
|
21
|
+
# @param api_map [ApiMap]
|
22
|
+
def typify api_map
|
23
|
+
return return_type.qualify(api_map, closure.context.namespace) unless return_type.undefined?
|
24
|
+
closure.is_a?(Pin::Block) ? typify_block_param(api_map) : typify_method_param(api_map)
|
25
|
+
end
|
26
|
+
|
27
|
+
def try_merge! pin
|
28
|
+
return false unless super && closure.nearly?(pin.closure)
|
29
|
+
@return_type = pin.return_type
|
30
|
+
reset_conversions
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
def documentation
|
35
|
+
tag = param_tag
|
36
|
+
return '' if tag.nil? || tag.text.nil?
|
37
|
+
tag.text
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# @return [YARD::Tags::Tag]
|
43
|
+
def param_tag
|
44
|
+
found = nil
|
45
|
+
params = closure.docstring.tags(:param)
|
46
|
+
params.each do |p|
|
47
|
+
next unless p.name == name
|
48
|
+
found = p
|
49
|
+
break
|
50
|
+
end
|
51
|
+
if found.nil? and !index.nil?
|
52
|
+
found = params[index] if params[index] && (params[index].name.nil? || params[index].name.empty?)
|
53
|
+
end
|
54
|
+
found
|
55
|
+
end
|
56
|
+
|
57
|
+
# @param api_map [ApiMap]
|
58
|
+
# @return [ComplexType]
|
59
|
+
def typify_block_param api_map
|
60
|
+
if closure.is_a?(Pin::Block) && closure.receiver
|
61
|
+
chain = Source::NodeChainer.chain(closure.receiver, filename)
|
62
|
+
clip = api_map.clip_at(location.filename, location.range.start)
|
63
|
+
locals = clip.locals - [self]
|
64
|
+
meths = chain.define(api_map, closure, locals)
|
65
|
+
meths.each do |meth|
|
66
|
+
if (Solargraph::CoreFills::METHODS_WITH_YIELDPARAM_SUBTYPES.include?(meth.path))
|
67
|
+
bmeth = chain.base.define(api_map, closure, locals).first
|
68
|
+
return ComplexType::UNDEFINED if bmeth.nil? || bmeth.return_type.undefined? || bmeth.return_type.subtypes.empty?
|
69
|
+
return bmeth.return_type.subtypes.first.qualify(api_map, bmeth.context.namespace)
|
70
|
+
elsif (Solargraph::CoreFills::METHODS_WITH_YIELDPARAM_SELF.include?(meth.path))
|
71
|
+
bmeth = chain.base.define(api_map, closure, locals).first
|
72
|
+
return ComplexType::UNDEFINED if bmeth.nil?
|
73
|
+
return bmeth.typify(api_map)
|
74
|
+
else
|
75
|
+
yps = meth.docstring.tags(:yieldparam)
|
76
|
+
unless yps[index].nil? or yps[index].types.nil? or yps[index].types.empty?
|
77
|
+
return ComplexType.try_parse(yps[index].types.first).qualify(api_map, meth.context.namespace)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
ComplexType::UNDEFINED
|
83
|
+
end
|
84
|
+
|
85
|
+
# @param api_map [ApiMap]
|
86
|
+
# @return [ComplexType]
|
87
|
+
def typify_method_param api_map
|
88
|
+
meths = api_map.get_method_stack(closure.full_context.namespace, closure.name, scope: closure.scope)
|
89
|
+
# meths.shift # Ignore the first one
|
90
|
+
meths.each do |meth|
|
91
|
+
found = nil
|
92
|
+
params = meth.docstring.tags(:param)
|
93
|
+
if params.empty?
|
94
|
+
params = see_reference(docstring, api_map)
|
95
|
+
end
|
96
|
+
params.each do |p|
|
97
|
+
next unless p.name == name
|
98
|
+
found = p
|
99
|
+
break
|
100
|
+
end
|
101
|
+
if found.nil? and !index.nil?
|
102
|
+
found = params[index] if params[index] && (params[index].name.nil? || params[index].name.empty?)
|
103
|
+
end
|
104
|
+
return ComplexType.try_parse(*found.types).qualify(api_map, meth.context.namespace) unless found.nil? || found.types.nil?
|
105
|
+
end
|
106
|
+
ComplexType::UNDEFINED
|
107
|
+
end
|
108
|
+
|
109
|
+
# @param heredoc [YARD::Docstring]
|
110
|
+
# @param api_map [ApiMap]
|
111
|
+
# @param skip [Array]
|
112
|
+
# @return [ComplexType]
|
113
|
+
def see_reference heredoc, api_map, skip = []
|
114
|
+
heredoc.ref_tags.each do |ref|
|
115
|
+
next unless ref.tag_name == 'param' && ref.owner
|
116
|
+
result = resolve_reference(ref.owner.to_s, api_map, skip)
|
117
|
+
return result unless result.nil?
|
118
|
+
end
|
119
|
+
[]
|
120
|
+
end
|
121
|
+
|
122
|
+
# @param ref [String]
|
123
|
+
# @param api_map [ApiMap]
|
124
|
+
# @param skip [Array]
|
125
|
+
# @return [ComplexType]
|
126
|
+
def resolve_reference ref, api_map, skip
|
127
|
+
return nil if skip.include?(ref)
|
128
|
+
skip.push ref
|
129
|
+
parts = ref.split(/[\.#]/)
|
130
|
+
if parts.first.empty?
|
131
|
+
path = "#{namespace}#{ref}"
|
132
|
+
else
|
133
|
+
fqns = api_map.qualify(parts.first, namespace)
|
134
|
+
return ComplexType::UNDEFINED if fqns.nil?
|
135
|
+
path = fqns + ref[parts.first.length] + parts.last
|
136
|
+
end
|
137
|
+
pins = api_map.get_path_pins(path)
|
138
|
+
pins.each do |pin|
|
139
|
+
params = pin.docstring.tags(:param)
|
140
|
+
return params unless params.empty?
|
141
|
+
end
|
142
|
+
pins.each do |pin|
|
143
|
+
params = see_reference(pin.docstring, api_map, skip)
|
144
|
+
return params unless params.empty?
|
145
|
+
end
|
146
|
+
nil
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
module Solargraph
|
2
2
|
module Pin
|
3
3
|
class ProxyType < Base
|
4
|
-
# @param location [Solargraph::Location]
|
5
|
-
# @param namespace [String]
|
6
|
-
# @param name [String]
|
7
4
|
# @param return_type [ComplexType]
|
8
|
-
def initialize
|
9
|
-
super(
|
10
|
-
@
|
5
|
+
def initialize return_type: ComplexType::UNDEFINED, **splat
|
6
|
+
super(splat)
|
7
|
+
@return_type = return_type
|
11
8
|
end
|
12
9
|
|
13
10
|
def path
|
@@ -19,7 +16,7 @@ module Solargraph
|
|
19
16
|
end
|
20
17
|
|
21
18
|
def context
|
22
|
-
@
|
19
|
+
@return_type
|
23
20
|
end
|
24
21
|
|
25
22
|
# @param return_type [ComplexType]
|
@@ -28,7 +25,10 @@ module Solargraph
|
|
28
25
|
parts = return_type.namespace.split('::')
|
29
26
|
namespace = parts[0..-2].join('::').to_s
|
30
27
|
name = parts.last.to_s
|
31
|
-
ProxyType.new(nil, namespace, name, return_type)
|
28
|
+
# ProxyType.new(nil, namespace, name, return_type)
|
29
|
+
ProxyType.new(
|
30
|
+
closure: Solargraph::Pin::Namespace.new(name: namespace), return_type: return_type
|
31
|
+
)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -5,18 +5,7 @@ module Solargraph
|
|
5
5
|
autoload :Superclass, 'solargraph/pin/reference/superclass'
|
6
6
|
autoload :Include, 'solargraph/pin/reference/include'
|
7
7
|
autoload :Extend, 'solargraph/pin/reference/extend'
|
8
|
-
|
9
|
-
def initialize location, namespace, name
|
10
|
-
super(location, namespace, name, '')
|
11
|
-
end
|
12
|
-
|
13
|
-
# @todo Should Reference.new be protected?
|
14
|
-
# class << self
|
15
|
-
# protected
|
16
|
-
# def new *args
|
17
|
-
# super
|
18
|
-
# end
|
19
|
-
# end
|
8
|
+
autoload :Override, 'solargraph/pin/reference/override'
|
20
9
|
end
|
21
10
|
end
|
22
11
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Solargraph
|
2
|
+
module Pin
|
3
|
+
class Reference
|
4
|
+
class Override < Reference
|
5
|
+
attr_reader :tags
|
6
|
+
|
7
|
+
def initialize location, name, tags
|
8
|
+
super(location: location, name: name)
|
9
|
+
@tags = tags
|
10
|
+
end
|
11
|
+
|
12
|
+
def kind
|
13
|
+
Pin::OVERRIDE_REFERENCE
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|