solargraph 0.58.2 → 0.58.3
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/.github/workflows/plugins.yml +3 -2
- data/CHANGELOG.md +3 -0
- data/lib/solargraph/bench.rb +45 -45
- data/lib/solargraph/convention/data_definition/data_assignment_node.rb +61 -61
- data/lib/solargraph/convention/gemfile.rb +15 -15
- data/lib/solargraph/convention/gemspec.rb +23 -23
- data/lib/solargraph/convention/rakefile.rb +17 -17
- data/lib/solargraph/convention.rb +78 -78
- data/lib/solargraph/converters/dd.rb +17 -17
- data/lib/solargraph/converters/dl.rb +15 -15
- data/lib/solargraph/converters/dt.rb +15 -15
- data/lib/solargraph/converters/misc.rb +1 -1
- data/lib/solargraph/diagnostics/update_errors.rb +41 -41
- data/lib/solargraph/language_server/error_codes.rb +20 -20
- data/lib/solargraph/language_server/message/base.rb +97 -97
- data/lib/solargraph/language_server/message/client/register_capability.rb +15 -15
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +60 -60
- data/lib/solargraph/language_server/message/extended/document_gems.rb +32 -32
- data/lib/solargraph/language_server/message/extended/download_core.rb +19 -19
- data/lib/solargraph/language_server/message/extended/search.rb +20 -20
- data/lib/solargraph/language_server/message/initialize.rb +191 -191
- data/lib/solargraph/language_server/message/text_document/document_highlight.rb +16 -16
- data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +11 -11
- data/lib/solargraph/language_server/message/text_document/references.rb +16 -16
- data/lib/solargraph/language_server/message/text_document/rename.rb +19 -19
- data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +35 -35
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +40 -40
- data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +26 -26
- data/lib/solargraph/language_server/message.rb +94 -94
- data/lib/solargraph/language_server/request.rb +27 -27
- data/lib/solargraph/language_server/transport/data_reader.rb +74 -74
- data/lib/solargraph/language_server/uri_helpers.rb +49 -49
- data/lib/solargraph/page.rb +92 -92
- data/lib/solargraph/parser/parser_gem/flawed_builder.rb +19 -19
- data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +37 -37
- data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +29 -29
- data/lib/solargraph/parser/parser_gem.rb +12 -12
- data/lib/solargraph/parser.rb +23 -23
- data/lib/solargraph/pin/constant.rb +45 -45
- data/lib/solargraph/rbs_map/core_fills.rb +84 -84
- data/lib/solargraph/server_methods.rb +16 -16
- data/lib/solargraph/shell.rb +14 -3
- data/lib/solargraph/source/chain/array.rb +37 -37
- data/lib/solargraph/source/chain/class_variable.rb +13 -13
- data/lib/solargraph/source/chain/global_variable.rb +13 -13
- data/lib/solargraph/source/chain/link.rb +109 -109
- data/lib/solargraph/source/chain/q_call.rb +11 -11
- data/lib/solargraph/source/chain/variable.rb +13 -13
- data/lib/solargraph/source/chain/z_super.rb +30 -30
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/yard_tags.rb +20 -20
- metadata +2 -2
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
class RbsMap
|
|
5
|
-
# Override pins to fill gaps in RbsMap::CoreMap coverage
|
|
6
|
-
#
|
|
7
|
-
module CoreFills
|
|
8
|
-
Override = Pin::Reference::Override
|
|
9
|
-
|
|
10
|
-
KEYWORDS = [
|
|
11
|
-
'__ENCODING__', '__LINE__', '__FILE__', 'BEGIN', 'END', 'alias', 'and',
|
|
12
|
-
'begin', 'break', 'case', 'class', 'def', 'defined?', 'do', 'else',
|
|
13
|
-
'elsif', 'end', 'ensure', 'false', 'for', 'if', 'in', 'module', 'next',
|
|
14
|
-
'nil', 'not', 'or', 'redo', 'rescue', 'retry', 'return', 'self', 'super',
|
|
15
|
-
'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield'
|
|
16
|
-
].map { |k| Pin::Keyword.new(k, source: :core_fill) }
|
|
17
|
-
|
|
18
|
-
MISSING = [
|
|
19
|
-
Solargraph::Pin::Method.new(name: 'class', scope: :instance,
|
|
20
|
-
closure: Solargraph::Pin::Namespace.new(name: 'Object', source: :core_fill), comments: '@return [::Class<self>]',
|
|
21
|
-
source: :core_fill)
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
OVERRIDES = [
|
|
25
|
-
Override.from_comment('BasicObject#instance_eval', '@yieldreceiver [self]',
|
|
26
|
-
source: :core_fill),
|
|
27
|
-
Override.from_comment('BasicObject#instance_exec', '@yieldreceiver [self]',
|
|
28
|
-
source: :core_fill),
|
|
29
|
-
Override.from_comment('Module#define_method', '@yieldreceiver [::Object<self>]',
|
|
30
|
-
source: :core_fill),
|
|
31
|
-
Override.from_comment('Module#class_eval', '@yieldreceiver [::Class<self>]',
|
|
32
|
-
source: :core_fill),
|
|
33
|
-
Override.from_comment('Module#class_exec', '@yieldreceiver [::Class<self>]',
|
|
34
|
-
source: :core_fill),
|
|
35
|
-
Override.from_comment('Module#module_eval', '@yieldreceiver [::Module<self>]',
|
|
36
|
-
source: :core_fill),
|
|
37
|
-
Override.from_comment('Module#module_exec', '@yieldreceiver [::Module<self>]',
|
|
38
|
-
source: :core_fill),
|
|
39
|
-
# RBS does not define Class with a generic, so all calls to
|
|
40
|
-
# generic() return an 'untyped'. We can do better:
|
|
41
|
-
Override.method_return('Class#allocate', 'self', source: :core_fill),
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
# @todo I don't see any direct link in RBS to build this from -
|
|
45
|
-
# presumably RBS is using duck typing to match interfaces
|
|
46
|
-
# against concrete classes
|
|
47
|
-
INCLUDES = [
|
|
48
|
-
Solargraph::Pin::Reference::Include.new(name: '_ToAry',
|
|
49
|
-
closure: Solargraph::Pin::Namespace.new(name: 'Array', source: :core_fill),
|
|
50
|
-
generic_values: ['generic<Elem>'],
|
|
51
|
-
source: :core_fill),
|
|
52
|
-
Solargraph::Pin::Reference::Include.new(name: '_ToAry',
|
|
53
|
-
closure: Solargraph::Pin::Namespace.new(name: 'Set', source: :core_fill),
|
|
54
|
-
generic_values: ['generic<Elem>'],
|
|
55
|
-
source: :core_fill),
|
|
56
|
-
Solargraph::Pin::Reference::Include.new(name: '_Each',
|
|
57
|
-
closure: Solargraph::Pin::Namespace.new(name: 'Array', source: :core_fill),
|
|
58
|
-
generic_values: ['generic<Elem>'],
|
|
59
|
-
source: :core_fill),
|
|
60
|
-
Solargraph::Pin::Reference::Include.new(name: '_Each',
|
|
61
|
-
closure: Solargraph::Pin::Namespace.new(name: 'Set', source: :core_fill),
|
|
62
|
-
generic_values: ['generic<Elem>'],
|
|
63
|
-
source: :core_fill),
|
|
64
|
-
Solargraph::Pin::Reference::Include.new(name: '_ToS',
|
|
65
|
-
closure: Solargraph::Pin::Namespace.new(name: 'Object', source: :core_fill),
|
|
66
|
-
source: :core_fill),
|
|
67
|
-
Solargraph::Pin::Reference::Include.new(name: '_ToS',
|
|
68
|
-
closure: Solargraph::Pin::Namespace.new(name: 'String', source: :core_fill),
|
|
69
|
-
source: :core_fill)
|
|
70
|
-
]
|
|
71
|
-
|
|
72
|
-
# HACK: Add Errno exception classes
|
|
73
|
-
errno = Solargraph::Pin::Namespace.new(name: 'Errno', source: :core_fill)
|
|
74
|
-
errnos = []
|
|
75
|
-
Errno.constants.each do |const|
|
|
76
|
-
errnos.push Solargraph::Pin::Namespace.new(type: :class, name: const.to_s, closure: errno, source: :core_fill)
|
|
77
|
-
errnos.push Solargraph::Pin::Reference::Superclass.new(closure: errnos.last, name: 'SystemCallError', source: :core_fill)
|
|
78
|
-
end
|
|
79
|
-
ERRNOS = errnos
|
|
80
|
-
|
|
81
|
-
ALL = KEYWORDS + MISSING + OVERRIDES + ERRNOS + INCLUDES
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
class RbsMap
|
|
5
|
+
# Override pins to fill gaps in RbsMap::CoreMap coverage
|
|
6
|
+
#
|
|
7
|
+
module CoreFills
|
|
8
|
+
Override = Pin::Reference::Override
|
|
9
|
+
|
|
10
|
+
KEYWORDS = [
|
|
11
|
+
'__ENCODING__', '__LINE__', '__FILE__', 'BEGIN', 'END', 'alias', 'and',
|
|
12
|
+
'begin', 'break', 'case', 'class', 'def', 'defined?', 'do', 'else',
|
|
13
|
+
'elsif', 'end', 'ensure', 'false', 'for', 'if', 'in', 'module', 'next',
|
|
14
|
+
'nil', 'not', 'or', 'redo', 'rescue', 'retry', 'return', 'self', 'super',
|
|
15
|
+
'then', 'true', 'undef', 'unless', 'until', 'when', 'while', 'yield'
|
|
16
|
+
].map { |k| Pin::Keyword.new(k, source: :core_fill) }
|
|
17
|
+
|
|
18
|
+
MISSING = [
|
|
19
|
+
Solargraph::Pin::Method.new(name: 'class', scope: :instance,
|
|
20
|
+
closure: Solargraph::Pin::Namespace.new(name: 'Object', source: :core_fill), comments: '@return [::Class<self>]',
|
|
21
|
+
source: :core_fill)
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
OVERRIDES = [
|
|
25
|
+
Override.from_comment('BasicObject#instance_eval', '@yieldreceiver [self]',
|
|
26
|
+
source: :core_fill),
|
|
27
|
+
Override.from_comment('BasicObject#instance_exec', '@yieldreceiver [self]',
|
|
28
|
+
source: :core_fill),
|
|
29
|
+
Override.from_comment('Module#define_method', '@yieldreceiver [::Object<self>]',
|
|
30
|
+
source: :core_fill),
|
|
31
|
+
Override.from_comment('Module#class_eval', '@yieldreceiver [::Class<self>]',
|
|
32
|
+
source: :core_fill),
|
|
33
|
+
Override.from_comment('Module#class_exec', '@yieldreceiver [::Class<self>]',
|
|
34
|
+
source: :core_fill),
|
|
35
|
+
Override.from_comment('Module#module_eval', '@yieldreceiver [::Module<self>]',
|
|
36
|
+
source: :core_fill),
|
|
37
|
+
Override.from_comment('Module#module_exec', '@yieldreceiver [::Module<self>]',
|
|
38
|
+
source: :core_fill),
|
|
39
|
+
# RBS does not define Class with a generic, so all calls to
|
|
40
|
+
# generic() return an 'untyped'. We can do better:
|
|
41
|
+
Override.method_return('Class#allocate', 'self', source: :core_fill),
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
# @todo I don't see any direct link in RBS to build this from -
|
|
45
|
+
# presumably RBS is using duck typing to match interfaces
|
|
46
|
+
# against concrete classes
|
|
47
|
+
INCLUDES = [
|
|
48
|
+
Solargraph::Pin::Reference::Include.new(name: '_ToAry',
|
|
49
|
+
closure: Solargraph::Pin::Namespace.new(name: 'Array', source: :core_fill),
|
|
50
|
+
generic_values: ['generic<Elem>'],
|
|
51
|
+
source: :core_fill),
|
|
52
|
+
Solargraph::Pin::Reference::Include.new(name: '_ToAry',
|
|
53
|
+
closure: Solargraph::Pin::Namespace.new(name: 'Set', source: :core_fill),
|
|
54
|
+
generic_values: ['generic<Elem>'],
|
|
55
|
+
source: :core_fill),
|
|
56
|
+
Solargraph::Pin::Reference::Include.new(name: '_Each',
|
|
57
|
+
closure: Solargraph::Pin::Namespace.new(name: 'Array', source: :core_fill),
|
|
58
|
+
generic_values: ['generic<Elem>'],
|
|
59
|
+
source: :core_fill),
|
|
60
|
+
Solargraph::Pin::Reference::Include.new(name: '_Each',
|
|
61
|
+
closure: Solargraph::Pin::Namespace.new(name: 'Set', source: :core_fill),
|
|
62
|
+
generic_values: ['generic<Elem>'],
|
|
63
|
+
source: :core_fill),
|
|
64
|
+
Solargraph::Pin::Reference::Include.new(name: '_ToS',
|
|
65
|
+
closure: Solargraph::Pin::Namespace.new(name: 'Object', source: :core_fill),
|
|
66
|
+
source: :core_fill),
|
|
67
|
+
Solargraph::Pin::Reference::Include.new(name: '_ToS',
|
|
68
|
+
closure: Solargraph::Pin::Namespace.new(name: 'String', source: :core_fill),
|
|
69
|
+
source: :core_fill)
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
# HACK: Add Errno exception classes
|
|
73
|
+
errno = Solargraph::Pin::Namespace.new(name: 'Errno', source: :core_fill)
|
|
74
|
+
errnos = []
|
|
75
|
+
Errno.constants.each do |const|
|
|
76
|
+
errnos.push Solargraph::Pin::Namespace.new(type: :class, name: const.to_s, closure: errno, source: :core_fill)
|
|
77
|
+
errnos.push Solargraph::Pin::Reference::Superclass.new(closure: errnos.last, name: 'SystemCallError', source: :core_fill)
|
|
78
|
+
end
|
|
79
|
+
ERRNOS = errnos
|
|
80
|
+
|
|
81
|
+
ALL = KEYWORDS + MISSING + OVERRIDES + ERRNOS + INCLUDES
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'socket'
|
|
4
|
-
|
|
5
|
-
module Solargraph
|
|
6
|
-
module ServerMethods
|
|
7
|
-
# @return [Integer]
|
|
8
|
-
def available_port
|
|
9
|
-
socket = Socket.new(:INET, :STREAM, 0)
|
|
10
|
-
socket.bind(Addrinfo.tcp("127.0.0.1", 0))
|
|
11
|
-
port = socket.local_address.ip_port
|
|
12
|
-
socket.close
|
|
13
|
-
port
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'socket'
|
|
4
|
+
|
|
5
|
+
module Solargraph
|
|
6
|
+
module ServerMethods
|
|
7
|
+
# @return [Integer]
|
|
8
|
+
def available_port
|
|
9
|
+
socket = Socket.new(:INET, :STREAM, 0)
|
|
10
|
+
socket.bind(Addrinfo.tcp("127.0.0.1", 0))
|
|
11
|
+
port = socket.local_address.ip_port
|
|
12
|
+
socket.close
|
|
13
|
+
port
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/solargraph/shell.rb
CHANGED
|
@@ -104,9 +104,20 @@ module Solargraph
|
|
|
104
104
|
# @param gem [String]
|
|
105
105
|
# @param version [String, nil]
|
|
106
106
|
def cache gem, version = nil
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
gemspec = Gem::Specification.find_by_name(gem, version)
|
|
108
|
+
|
|
109
|
+
if options[:rebuild] || !PinCache.has_yard?(gemspec)
|
|
110
|
+
pins = GemPins.build_yard_pins(['yard-activesupport-concern'], gemspec)
|
|
111
|
+
PinCache.serialize_yard_gem(gemspec, pins)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
workspace = Solargraph::Workspace.new(Dir.pwd)
|
|
115
|
+
rbs_map = RbsMap.from_gemspec(gemspec, workspace.rbs_collection_path, workspace.rbs_collection_config_path)
|
|
116
|
+
if options[:rebuild] || !PinCache.has_rbs_collection?(gemspec, rbs_map.cache_key)
|
|
117
|
+
# cache pins even if result is zero, so we don't retry building pins
|
|
118
|
+
pins = rbs_map.pins || []
|
|
119
|
+
PinCache.serialize_rbs_collection_gem(gemspec, rbs_map.cache_key, pins)
|
|
120
|
+
end
|
|
110
121
|
end
|
|
111
122
|
|
|
112
123
|
desc 'uncache GEM [...GEM]', "Delete specific cached gem documentation"
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
module Solargraph
|
|
2
|
-
class Source
|
|
3
|
-
class Chain
|
|
4
|
-
class Array < Literal
|
|
5
|
-
# @param children [::Array<Chain>]
|
|
6
|
-
# @param node [Parser::AST::Node]
|
|
7
|
-
def initialize children, node
|
|
8
|
-
super('::Array', node)
|
|
9
|
-
@children = children
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def word
|
|
13
|
-
@word ||= "<#{@type}>"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# @param api_map [ApiMap]
|
|
17
|
-
# @param name_pin [Pin::Base]
|
|
18
|
-
# @param locals [::Array<Pin::Parameter, Pin::LocalVariable>]
|
|
19
|
-
def resolve api_map, name_pin, locals
|
|
20
|
-
child_types = @children.map do |child|
|
|
21
|
-
child.infer(api_map, name_pin, locals).simplify_literals
|
|
22
|
-
end
|
|
23
|
-
type = if child_types.length == 0 || child_types.any?(&:undefined?)
|
|
24
|
-
ComplexType::UniqueType.new('Array', rooted: true)
|
|
25
|
-
elsif child_types.uniq.length == 1 && child_types.first.defined?
|
|
26
|
-
ComplexType::UniqueType.new('Array', [], child_types.uniq, rooted: true, parameters_type: :list)
|
|
27
|
-
elsif child_types.length == 0
|
|
28
|
-
ComplexType::UniqueType.new('Array', rooted: true, parameters_type: :list)
|
|
29
|
-
else
|
|
30
|
-
ComplexType::UniqueType.new('Array', [], child_types, rooted: true, parameters_type: :fixed)
|
|
31
|
-
end
|
|
32
|
-
[Pin::ProxyType.anonymous(type, source: :chain)]
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
1
|
+
module Solargraph
|
|
2
|
+
class Source
|
|
3
|
+
class Chain
|
|
4
|
+
class Array < Literal
|
|
5
|
+
# @param children [::Array<Chain>]
|
|
6
|
+
# @param node [Parser::AST::Node]
|
|
7
|
+
def initialize children, node
|
|
8
|
+
super('::Array', node)
|
|
9
|
+
@children = children
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def word
|
|
13
|
+
@word ||= "<#{@type}>"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# @param api_map [ApiMap]
|
|
17
|
+
# @param name_pin [Pin::Base]
|
|
18
|
+
# @param locals [::Array<Pin::Parameter, Pin::LocalVariable>]
|
|
19
|
+
def resolve api_map, name_pin, locals
|
|
20
|
+
child_types = @children.map do |child|
|
|
21
|
+
child.infer(api_map, name_pin, locals).simplify_literals
|
|
22
|
+
end
|
|
23
|
+
type = if child_types.length == 0 || child_types.any?(&:undefined?)
|
|
24
|
+
ComplexType::UniqueType.new('Array', rooted: true)
|
|
25
|
+
elsif child_types.uniq.length == 1 && child_types.first.defined?
|
|
26
|
+
ComplexType::UniqueType.new('Array', [], child_types.uniq, rooted: true, parameters_type: :list)
|
|
27
|
+
elsif child_types.length == 0
|
|
28
|
+
ComplexType::UniqueType.new('Array', rooted: true, parameters_type: :list)
|
|
29
|
+
else
|
|
30
|
+
ComplexType::UniqueType.new('Array', [], child_types, rooted: true, parameters_type: :fixed)
|
|
31
|
+
end
|
|
32
|
+
[Pin::ProxyType.anonymous(type, source: :chain)]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
class Source
|
|
5
|
-
class Chain
|
|
6
|
-
class ClassVariable < Link
|
|
7
|
-
def resolve api_map, name_pin, locals
|
|
8
|
-
api_map.get_class_variable_pins(name_pin.context.namespace).select{|p| p.name == word}
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
class Source
|
|
5
|
+
class Chain
|
|
6
|
+
class ClassVariable < Link
|
|
7
|
+
def resolve api_map, name_pin, locals
|
|
8
|
+
api_map.get_class_variable_pins(name_pin.context.namespace).select{|p| p.name == word}
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
class Source
|
|
5
|
-
class Chain
|
|
6
|
-
class GlobalVariable < Link
|
|
7
|
-
def resolve api_map, name_pin, locals
|
|
8
|
-
api_map.get_global_variable_pins.select{|p| p.name == word}
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
class Source
|
|
5
|
+
class Chain
|
|
6
|
+
class GlobalVariable < Link
|
|
7
|
+
def resolve api_map, name_pin, locals
|
|
8
|
+
api_map.get_global_variable_pins.select{|p| p.name == word}
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
class Source
|
|
5
|
-
class Chain
|
|
6
|
-
class Link
|
|
7
|
-
include Equality
|
|
8
|
-
|
|
9
|
-
# @return [String]
|
|
10
|
-
attr_reader :word
|
|
11
|
-
|
|
12
|
-
# @return [Pin::Base]
|
|
13
|
-
attr_accessor :last_context
|
|
14
|
-
|
|
15
|
-
# @param word [String]
|
|
16
|
-
def initialize word = '<undefined>'
|
|
17
|
-
@word = word
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# @sg-ignore two problems - Declared return type
|
|
21
|
-
# ::Solargraph::Source::Chain::Array does not match inferred
|
|
22
|
-
# type ::Array(::Class<::Solargraph::Source::Chain::Link>,
|
|
23
|
-
# ::String) for
|
|
24
|
-
# Solargraph::Source::Chain::Link#equality_fields
|
|
25
|
-
# and
|
|
26
|
-
# Not enough arguments to Module#protected
|
|
27
|
-
protected def equality_fields
|
|
28
|
-
[self.class, word]
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def undefined?
|
|
32
|
-
word == '<undefined>'
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def constant?
|
|
36
|
-
is_a?(Chain::Constant)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# @param api_map [ApiMap]
|
|
40
|
-
# @param name_pin [Pin::Base]
|
|
41
|
-
# @param locals [::Array<Pin::Base>]
|
|
42
|
-
# @return [::Array<Pin::Base>]
|
|
43
|
-
def resolve api_map, name_pin, locals
|
|
44
|
-
[]
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# debugging description of contents; not for machine use
|
|
48
|
-
# @return [String]
|
|
49
|
-
def desc
|
|
50
|
-
word
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def to_s
|
|
54
|
-
desc
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def inspect
|
|
58
|
-
"#<#{self.class} - `#{self.desc}`>"
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def head?
|
|
62
|
-
@head ||= false
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# Make a copy of this link marked as the head of a chain
|
|
66
|
-
#
|
|
67
|
-
# @return [self]
|
|
68
|
-
def clone_head
|
|
69
|
-
clone.mark_head(true)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
# Make a copy of this link unmarked as the head of a chain
|
|
73
|
-
#
|
|
74
|
-
# @return [self]
|
|
75
|
-
def clone_body
|
|
76
|
-
clone.mark_head(false)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def nullable?
|
|
80
|
-
false
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# debugging description of contents; not for machine use
|
|
84
|
-
#
|
|
85
|
-
# @return [String]
|
|
86
|
-
def desc
|
|
87
|
-
word
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def inspect
|
|
91
|
-
"#<#{self.class} - `#{self.desc}`>"
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
include Logging
|
|
95
|
-
|
|
96
|
-
protected
|
|
97
|
-
|
|
98
|
-
# Mark whether this link is the head of a chain
|
|
99
|
-
#
|
|
100
|
-
# @param bool [Boolean]
|
|
101
|
-
# @return [self]
|
|
102
|
-
def mark_head bool
|
|
103
|
-
@head = bool
|
|
104
|
-
self
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
class Source
|
|
5
|
+
class Chain
|
|
6
|
+
class Link
|
|
7
|
+
include Equality
|
|
8
|
+
|
|
9
|
+
# @return [String]
|
|
10
|
+
attr_reader :word
|
|
11
|
+
|
|
12
|
+
# @return [Pin::Base]
|
|
13
|
+
attr_accessor :last_context
|
|
14
|
+
|
|
15
|
+
# @param word [String]
|
|
16
|
+
def initialize word = '<undefined>'
|
|
17
|
+
@word = word
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @sg-ignore two problems - Declared return type
|
|
21
|
+
# ::Solargraph::Source::Chain::Array does not match inferred
|
|
22
|
+
# type ::Array(::Class<::Solargraph::Source::Chain::Link>,
|
|
23
|
+
# ::String) for
|
|
24
|
+
# Solargraph::Source::Chain::Link#equality_fields
|
|
25
|
+
# and
|
|
26
|
+
# Not enough arguments to Module#protected
|
|
27
|
+
protected def equality_fields
|
|
28
|
+
[self.class, word]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def undefined?
|
|
32
|
+
word == '<undefined>'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def constant?
|
|
36
|
+
is_a?(Chain::Constant)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @param api_map [ApiMap]
|
|
40
|
+
# @param name_pin [Pin::Base]
|
|
41
|
+
# @param locals [::Array<Pin::Base>]
|
|
42
|
+
# @return [::Array<Pin::Base>]
|
|
43
|
+
def resolve api_map, name_pin, locals
|
|
44
|
+
[]
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# debugging description of contents; not for machine use
|
|
48
|
+
# @return [String]
|
|
49
|
+
def desc
|
|
50
|
+
word
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def to_s
|
|
54
|
+
desc
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def inspect
|
|
58
|
+
"#<#{self.class} - `#{self.desc}`>"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def head?
|
|
62
|
+
@head ||= false
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Make a copy of this link marked as the head of a chain
|
|
66
|
+
#
|
|
67
|
+
# @return [self]
|
|
68
|
+
def clone_head
|
|
69
|
+
clone.mark_head(true)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Make a copy of this link unmarked as the head of a chain
|
|
73
|
+
#
|
|
74
|
+
# @return [self]
|
|
75
|
+
def clone_body
|
|
76
|
+
clone.mark_head(false)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def nullable?
|
|
80
|
+
false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# debugging description of contents; not for machine use
|
|
84
|
+
#
|
|
85
|
+
# @return [String]
|
|
86
|
+
def desc
|
|
87
|
+
word
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def inspect
|
|
91
|
+
"#<#{self.class} - `#{self.desc}`>"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
include Logging
|
|
95
|
+
|
|
96
|
+
protected
|
|
97
|
+
|
|
98
|
+
# Mark whether this link is the head of a chain
|
|
99
|
+
#
|
|
100
|
+
# @param bool [Boolean]
|
|
101
|
+
# @return [self]
|
|
102
|
+
def mark_head bool
|
|
103
|
+
@head = bool
|
|
104
|
+
self
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Solargraph
|
|
2
|
-
class Source
|
|
3
|
-
class Chain
|
|
4
|
-
class QCall < Call
|
|
5
|
-
def nullable?
|
|
6
|
-
true
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
1
|
+
module Solargraph
|
|
2
|
+
class Source
|
|
3
|
+
class Chain
|
|
4
|
+
class QCall < Call
|
|
5
|
+
def nullable?
|
|
6
|
+
true
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Solargraph
|
|
4
|
-
class Source
|
|
5
|
-
class Chain
|
|
6
|
-
class Variable < Link
|
|
7
|
-
def resolve api_map, name_pin, locals
|
|
8
|
-
api_map.get_instance_variable_pins(name_pin.context.namespace, name_pin.context.scope).select{|p| p.name == word}
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Solargraph
|
|
4
|
+
class Source
|
|
5
|
+
class Chain
|
|
6
|
+
class Variable < Link
|
|
7
|
+
def resolve api_map, name_pin, locals
|
|
8
|
+
api_map.get_instance_variable_pins(name_pin.context.namespace, name_pin.context.scope).select{|p| p.name == word}
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|