solargraph 0.54.4 → 0.56.2
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 +2 -0
- data/.github/workflows/typecheck.yml +3 -1
- data/.gitignore +2 -0
- data/CHANGELOG.md +62 -0
- data/README.md +13 -3
- data/lib/solargraph/api_map/index.rb +24 -16
- data/lib/solargraph/api_map/store.rb +48 -23
- data/lib/solargraph/api_map.rb +175 -77
- data/lib/solargraph/bench.rb +17 -1
- data/lib/solargraph/complex_type/type_methods.rb +6 -1
- data/lib/solargraph/complex_type/unique_type.rb +98 -9
- data/lib/solargraph/complex_type.rb +35 -6
- data/lib/solargraph/convention/base.rb +3 -3
- data/lib/solargraph/convention/data_definition/data_assignment_node.rb +60 -0
- data/lib/solargraph/convention/data_definition/data_definition_node.rb +89 -0
- data/lib/solargraph/convention/data_definition.rb +104 -0
- data/lib/solargraph/convention/gemspec.rb +2 -1
- data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +60 -0
- data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +100 -0
- data/lib/solargraph/convention/struct_definition.rb +141 -0
- data/lib/solargraph/convention.rb +5 -3
- data/lib/solargraph/doc_map.rb +277 -57
- data/lib/solargraph/gem_pins.rb +53 -37
- data/lib/solargraph/language_server/host/message_worker.rb +10 -7
- data/lib/solargraph/language_server/host.rb +12 -2
- data/lib/solargraph/language_server/message/extended/check_gem_version.rb +2 -0
- data/lib/solargraph/language_server/message/extended/document.rb +5 -2
- data/lib/solargraph/language_server/message/extended/document_gems.rb +3 -3
- data/lib/solargraph/library.rb +45 -17
- data/lib/solargraph/location.rb +21 -0
- data/lib/solargraph/logging.rb +1 -0
- data/lib/solargraph/parser/comment_ripper.rb +12 -6
- data/lib/solargraph/parser/flow_sensitive_typing.rb +227 -0
- data/lib/solargraph/parser/node_methods.rb +14 -0
- data/lib/solargraph/parser/node_processor/base.rb +9 -4
- data/lib/solargraph/parser/node_processor.rb +21 -8
- data/lib/solargraph/parser/parser_gem/class_methods.rb +16 -14
- data/lib/solargraph/parser/parser_gem/node_chainer.rb +10 -10
- data/lib/solargraph/parser/parser_gem/node_methods.rb +4 -2
- data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +2 -1
- data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +21 -0
- data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +4 -2
- data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +4 -2
- data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +2 -1
- data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +2 -1
- data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +6 -3
- data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +2 -1
- data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +2 -1
- data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +21 -0
- data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +4 -2
- data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +2 -1
- data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +4 -1
- data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +8 -7
- data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +42 -0
- data/lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb +1 -0
- data/lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb +3 -1
- data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +4 -3
- data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +28 -16
- data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +3 -1
- data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +29 -0
- data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +29 -0
- data/lib/solargraph/parser/parser_gem/node_processors.rb +14 -0
- data/lib/solargraph/parser/region.rb +1 -1
- data/lib/solargraph/parser.rb +1 -0
- data/lib/solargraph/pin/base.rb +316 -28
- data/lib/solargraph/pin/base_variable.rb +16 -9
- data/lib/solargraph/pin/block.rb +2 -0
- data/lib/solargraph/pin/breakable.rb +9 -0
- data/lib/solargraph/pin/callable.rb +74 -3
- data/lib/solargraph/pin/closure.rb +18 -1
- data/lib/solargraph/pin/common.rb +5 -0
- data/lib/solargraph/pin/delegated_method.rb +20 -1
- data/lib/solargraph/pin/documenting.rb +16 -0
- data/lib/solargraph/pin/keyword.rb +7 -2
- data/lib/solargraph/pin/local_variable.rb +15 -6
- data/lib/solargraph/pin/method.rb +169 -43
- data/lib/solargraph/pin/namespace.rb +17 -9
- data/lib/solargraph/pin/parameter.rb +60 -11
- data/lib/solargraph/pin/proxy_type.rb +12 -6
- data/lib/solargraph/pin/reference/override.rb +10 -6
- data/lib/solargraph/pin/reference/require.rb +2 -2
- data/lib/solargraph/pin/signature.rb +42 -0
- data/lib/solargraph/pin/singleton.rb +1 -1
- data/lib/solargraph/pin/symbol.rb +3 -2
- data/lib/solargraph/pin/until.rb +18 -0
- data/lib/solargraph/pin/while.rb +18 -0
- data/lib/solargraph/pin.rb +4 -1
- data/lib/solargraph/pin_cache.rb +185 -0
- data/lib/solargraph/position.rb +9 -0
- data/lib/solargraph/range.rb +9 -0
- data/lib/solargraph/rbs_map/conversions.rb +221 -67
- data/lib/solargraph/rbs_map/core_fills.rb +32 -16
- data/lib/solargraph/rbs_map/core_map.rb +34 -11
- data/lib/solargraph/rbs_map/stdlib_map.rb +15 -5
- data/lib/solargraph/rbs_map.rb +74 -17
- data/lib/solargraph/shell.rb +17 -18
- data/lib/solargraph/source/chain/array.rb +11 -7
- data/lib/solargraph/source/chain/block_symbol.rb +1 -1
- data/lib/solargraph/source/chain/block_variable.rb +1 -1
- data/lib/solargraph/source/chain/call.rb +53 -23
- data/lib/solargraph/source/chain/constant.rb +1 -1
- data/lib/solargraph/source/chain/hash.rb +4 -3
- data/lib/solargraph/source/chain/head.rb +1 -1
- data/lib/solargraph/source/chain/if.rb +1 -1
- data/lib/solargraph/source/chain/link.rb +2 -0
- data/lib/solargraph/source/chain/literal.rb +22 -2
- data/lib/solargraph/source/chain/or.rb +1 -1
- data/lib/solargraph/source/chain/z_super.rb +1 -1
- data/lib/solargraph/source/chain.rb +78 -48
- data/lib/solargraph/source/source_chainer.rb +2 -2
- data/lib/solargraph/source_map/clip.rb +3 -1
- data/lib/solargraph/source_map/mapper.rb +9 -5
- data/lib/solargraph/source_map.rb +0 -17
- data/lib/solargraph/type_checker/checks.rb +4 -0
- data/lib/solargraph/type_checker.rb +35 -8
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/views/_method.erb +10 -10
- data/lib/solargraph/views/_namespace.erb +3 -3
- data/lib/solargraph/views/document.erb +10 -10
- data/lib/solargraph/workspace/config.rb +1 -1
- data/lib/solargraph/workspace.rb +23 -5
- data/lib/solargraph/yard_map/helpers.rb +29 -1
- data/lib/solargraph/yard_map/mapper/to_constant.rb +7 -5
- data/lib/solargraph/yard_map/mapper/to_method.rb +53 -18
- data/lib/solargraph/yard_map/mapper/to_namespace.rb +9 -7
- data/lib/solargraph/yard_map/mapper.rb +4 -3
- data/lib/solargraph/yard_map/to_method.rb +4 -2
- data/lib/solargraph/yardoc.rb +7 -8
- data/lib/solargraph.rb +32 -1
- data/rbs/fills/tuple.rbs +150 -0
- data/rbs_collection.yaml +19 -0
- data/solargraph.gemspec +2 -1
- metadata +37 -9
- data/lib/solargraph/cache.rb +0 -77
@@ -6,6 +6,11 @@ module Solargraph
|
|
6
6
|
module ToMethod
|
7
7
|
extend YardMap::Helpers
|
8
8
|
|
9
|
+
VISIBILITY_OVERRIDE = {
|
10
|
+
# YARD pays attention to 'private' statements prior to class methods but shouldn't
|
11
|
+
["Rails::Engine", :class, "find_root_with_flag"] => :public
|
12
|
+
}
|
13
|
+
|
9
14
|
# @param code_object [YARD::CodeObjects::Base]
|
10
15
|
# @param name [String, nil]
|
11
16
|
# @param scope [Symbol, nil]
|
@@ -14,31 +19,60 @@ module Solargraph
|
|
14
19
|
# @param spec [Gem::Specification, nil]
|
15
20
|
# @return [Solargraph::Pin::Method]
|
16
21
|
def self.make code_object, name = nil, scope = nil, visibility = nil, closure = nil, spec = nil
|
17
|
-
closure ||=
|
18
|
-
name: code_object.namespace.to_s,
|
19
|
-
gates: [code_object.namespace.to_s]
|
20
|
-
)
|
22
|
+
closure ||= create_closure_namespace_for(code_object, spec)
|
21
23
|
location = object_location(code_object, spec)
|
22
24
|
name ||= code_object.name.to_s
|
23
25
|
return_type = ComplexType::SELF if name == 'new'
|
24
26
|
comments = code_object.docstring ? code_object.docstring.all.to_s : ''
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
final_scope = scope || code_object.scope
|
28
|
+
override_key = [closure.path, final_scope, name]
|
29
|
+
final_visibility = VISIBILITY_OVERRIDE[override_key]
|
30
|
+
final_visibility ||= VISIBILITY_OVERRIDE[override_key[0..-2]]
|
31
|
+
final_visibility ||= :private if closure.path == 'Kernel' && Kernel.private_instance_methods(false).include?(name)
|
32
|
+
final_visibility ||= visibility
|
33
|
+
final_visibility ||= :private if code_object.module_function? && final_scope == :instance
|
34
|
+
final_visibility ||= :public if code_object.module_function? && final_scope == :class
|
35
|
+
final_visibility ||= code_object.visibility
|
36
|
+
if code_object.is_alias?
|
37
|
+
origin_code_object = code_object.namespace.aliases[code_object]
|
38
|
+
pin = Pin::MethodAlias.new(
|
39
|
+
name: name,
|
40
|
+
location: location,
|
41
|
+
original: origin_code_object.name.to_s,
|
42
|
+
closure: closure,
|
43
|
+
comments: comments,
|
44
|
+
scope: final_scope,
|
45
|
+
visibility: final_visibility,
|
46
|
+
explicit: code_object.is_explicit?,
|
47
|
+
return_type: return_type,
|
48
|
+
parameters: [],
|
49
|
+
source: :yardoc,
|
50
|
+
)
|
51
|
+
else
|
52
|
+
pin = Pin::Method.new(
|
53
|
+
location: location,
|
54
|
+
closure: closure,
|
55
|
+
name: name,
|
56
|
+
comments: comments,
|
57
|
+
scope: final_scope,
|
58
|
+
visibility: final_visibility,
|
59
|
+
# @todo Might need to convert overloads to signatures
|
60
|
+
explicit: code_object.is_explicit?,
|
61
|
+
return_type: return_type,
|
62
|
+
attribute: code_object.is_attribute?,
|
63
|
+
parameters: [],
|
64
|
+
source: :yardoc,
|
65
|
+
)
|
66
|
+
pin.parameters.concat get_parameters(code_object, location, comments, pin)
|
67
|
+
pin.parameters.freeze
|
68
|
+
end
|
69
|
+
logger.debug { "ToMethod.make: Just created method pin: #{pin.inspect}" }
|
38
70
|
pin
|
39
71
|
end
|
40
72
|
|
41
73
|
class << self
|
74
|
+
include Logging
|
75
|
+
|
42
76
|
private
|
43
77
|
|
44
78
|
# @param code_object [YARD::CodeObjects::Base]
|
@@ -59,7 +93,8 @@ module Solargraph
|
|
59
93
|
name: arg_name(a),
|
60
94
|
presence: nil,
|
61
95
|
decl: arg_type(a),
|
62
|
-
asgn_code: a[1]
|
96
|
+
asgn_code: a[1],
|
97
|
+
source: :yardoc,
|
63
98
|
)
|
64
99
|
end
|
65
100
|
end
|
@@ -7,19 +7,21 @@ module Solargraph
|
|
7
7
|
extend YardMap::Helpers
|
8
8
|
|
9
9
|
# @param code_object [YARD::CodeObjects::NamespaceObject]
|
10
|
+
# @param spec [Gem::Specification, nil]
|
11
|
+
# @param closure [Pin::Closure, nil]
|
12
|
+
# @return [Pin::Namespace]
|
10
13
|
def self.make code_object, spec, closure = nil
|
11
|
-
closure ||=
|
12
|
-
|
13
|
-
|
14
|
-
gates: [code_object.namespace.to_s]
|
15
|
-
)
|
14
|
+
closure ||= create_closure_namespace_for(code_object, spec)
|
15
|
+
location = object_location(code_object, spec)
|
16
|
+
|
16
17
|
Pin::Namespace.new(
|
17
|
-
location:
|
18
|
+
location: location,
|
18
19
|
name: code_object.name.to_s,
|
19
20
|
comments: code_object.docstring ? code_object.docstring.all.to_s : '',
|
20
21
|
type: code_object.is_a?(YARD::CodeObjects::ClassObject) ? :class : :module,
|
21
22
|
visibility: code_object.visibility,
|
22
|
-
closure: closure
|
23
|
+
closure: closure,
|
24
|
+
source: :yardoc,
|
23
25
|
)
|
24
26
|
end
|
25
27
|
end
|
@@ -47,15 +47,16 @@ module Solargraph
|
|
47
47
|
else
|
48
48
|
code_object.superclass.to_s
|
49
49
|
end
|
50
|
-
result.push Solargraph::Pin::Reference::Superclass.new(name: superclass, closure: nspin)
|
50
|
+
result.push Solargraph::Pin::Reference::Superclass.new(name: superclass, closure: nspin, source: :yard_map)
|
51
51
|
end
|
52
52
|
code_object.class_mixins.each do |m|
|
53
|
-
result.push Solargraph::Pin::Reference::Extend.new(closure: nspin, name: m.path)
|
53
|
+
result.push Solargraph::Pin::Reference::Extend.new(closure: nspin, name: m.path, source: :yard_map)
|
54
54
|
end
|
55
55
|
code_object.instance_mixins.each do |m|
|
56
56
|
result.push Solargraph::Pin::Reference::Include.new(
|
57
57
|
closure: nspin, # @todo Fix this
|
58
|
-
name: m.path
|
58
|
+
name: m.path,
|
59
|
+
source: :yard_map
|
59
60
|
)
|
60
61
|
end
|
61
62
|
elsif code_object.is_a?(YARD::CodeObjects::MethodObject)
|
@@ -23,7 +23,8 @@ module Solargraph
|
|
23
23
|
name: arg_name(a),
|
24
24
|
presence: nil,
|
25
25
|
decl: arg_type(a),
|
26
|
-
asgn_code: a[1]
|
26
|
+
asgn_code: a[1],
|
27
|
+
source: :yard_map
|
27
28
|
)
|
28
29
|
end
|
29
30
|
end
|
@@ -78,7 +79,8 @@ module Solargraph
|
|
78
79
|
scope: scope || code_object.scope,
|
79
80
|
visibility: visibility || code_object.visibility,
|
80
81
|
parameters: InnerMethods.get_parameters(code_object, location, comments),
|
81
|
-
explicit: code_object.is_explicit
|
82
|
+
explicit: code_object.is_explicit?,
|
83
|
+
source: :yard_map
|
82
84
|
)
|
83
85
|
end
|
84
86
|
end
|
data/lib/solargraph/yardoc.rb
CHANGED
@@ -12,7 +12,7 @@ module Solargraph
|
|
12
12
|
# @param gemspec [Gem::Specification]
|
13
13
|
# @return [String] The path to the cached yardoc.
|
14
14
|
def cache(gemspec)
|
15
|
-
path =
|
15
|
+
path = PinCache.yardoc_path gemspec
|
16
16
|
return path if cached?(gemspec)
|
17
17
|
|
18
18
|
Solargraph.logger.info "Caching yardoc for #{gemspec.name} #{gemspec.version}"
|
@@ -26,16 +26,15 @@ module Solargraph
|
|
26
26
|
#
|
27
27
|
# @param gemspec [Gem::Specification]
|
28
28
|
def cached?(gemspec)
|
29
|
-
yardoc = File.join(
|
29
|
+
yardoc = File.join(PinCache.yardoc_path(gemspec), 'complete')
|
30
30
|
File.exist?(yardoc)
|
31
31
|
end
|
32
32
|
|
33
|
-
#
|
33
|
+
# True if another process is currently building the yardoc cache.
|
34
34
|
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
File.join(Solargraph::Cache.work_dir, 'gems', "#{gemspec.name}-#{gemspec.version}.yardoc")
|
35
|
+
def processing?(gemspec)
|
36
|
+
yardoc = File.join(PinCache.yardoc_path(gemspec), 'processing')
|
37
|
+
File.exist?(yardoc)
|
39
38
|
end
|
40
39
|
|
41
40
|
# Load a gem's yardoc and return its code objects.
|
@@ -45,7 +44,7 @@ module Solargraph
|
|
45
44
|
# @param gemspec [Gem::Specification]
|
46
45
|
# @return [Array<YARD::CodeObjects::Base>]
|
47
46
|
def load!(gemspec)
|
48
|
-
YARD::Registry.load!
|
47
|
+
YARD::Registry.load! PinCache.yardoc_path gemspec
|
49
48
|
YARD::Registry.all
|
50
49
|
end
|
51
50
|
end
|
data/lib/solargraph.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
Encoding.default_external = 'UTF-8'
|
4
4
|
|
5
|
+
require 'bundler'
|
5
6
|
require 'set'
|
6
7
|
require 'yard-solargraph'
|
7
8
|
require 'solargraph/yard_tags'
|
@@ -47,11 +48,32 @@ module Solargraph
|
|
47
48
|
autoload :Parser, 'solargraph/parser'
|
48
49
|
autoload :RbsMap, 'solargraph/rbs_map'
|
49
50
|
autoload :GemPins, 'solargraph/gem_pins'
|
50
|
-
autoload :
|
51
|
+
autoload :PinCache, 'solargraph/pin_cache'
|
51
52
|
|
52
53
|
dir = File.dirname(__FILE__)
|
53
54
|
VIEWS_PATH = File.join(dir, 'solargraph', 'views')
|
54
55
|
|
56
|
+
# @param type [Symbol] Type of assert.
|
57
|
+
def self.asserts_on?(type)
|
58
|
+
if ENV['SOLARGRAPH_ASSERTS'].nil? || ENV['SOLARGRAPH_ASSERTS'].empty?
|
59
|
+
false
|
60
|
+
elsif ENV['SOLARGRAPH_ASSERTS'] == 'on'
|
61
|
+
true
|
62
|
+
else
|
63
|
+
logger.warn "Unrecognized SOLARGRAPH_ASSERTS value: #{ENV['SOLARGRAPH_ASSERTS']}"
|
64
|
+
false
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# @param type [Symbol] The type of assertion to perform.
|
69
|
+
# @param msg [String, nil] An optional message to log
|
70
|
+
# @param block [Proc] A block that returns a message to log
|
71
|
+
# @return [void]
|
72
|
+
def self.assert_or_log(type, msg = nil, &block)
|
73
|
+
raise (msg || block.call) if asserts_on?(type) && ![:combine_with_visibility].include?(type)
|
74
|
+
logger.info msg, &block
|
75
|
+
end
|
76
|
+
|
55
77
|
# A convenience method for Solargraph::Logging.logger.
|
56
78
|
#
|
57
79
|
# @return [Logger]
|
@@ -61,6 +83,11 @@ module Solargraph
|
|
61
83
|
|
62
84
|
# A helper method that runs Bundler.with_unbundled_env or falls back to
|
63
85
|
# Bundler.with_clean_env for earlier versions of Bundler.
|
86
|
+
#
|
87
|
+
# @generic T
|
88
|
+
# @yieldreturn [generic<T>]
|
89
|
+
# @sg-ignore dynamic call, but both functions behave the same
|
90
|
+
# @return [generic<T>]
|
64
91
|
def self.with_clean_env &block
|
65
92
|
meth = if Bundler.respond_to?(:with_original_env)
|
66
93
|
:with_original_env
|
@@ -70,3 +97,7 @@ module Solargraph
|
|
70
97
|
Bundler.send meth, &block
|
71
98
|
end
|
72
99
|
end
|
100
|
+
|
101
|
+
# Ensure that ParserGem node processors are properly loaded to avoid conflicts
|
102
|
+
# with Convention node processors
|
103
|
+
require 'solargraph/parser/parser_gem/node_processors'
|
data/rbs/fills/tuple.rbs
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
# <-- liberally borrowed from
|
2
|
+
# https://github.com/ruby/rbs/blob/master/core/array.rbs, which
|
3
|
+
# was generated from
|
4
|
+
# https://github.com/ruby/ruby/blob/master/array.c
|
5
|
+
# -->
|
6
|
+
module Solargraph
|
7
|
+
module Fills
|
8
|
+
class Tuple[unchecked out A,
|
9
|
+
unchecked out B = A,
|
10
|
+
unchecked out C = A | B,
|
11
|
+
unchecked out D = A | B | C,
|
12
|
+
unchecked out E = A | B | C | D,
|
13
|
+
unchecked out F = A | B | C | D | E,
|
14
|
+
unchecked out G = A | B | C | D | E | F,
|
15
|
+
unchecked out H = A | B | C | D | E | F | G,
|
16
|
+
unchecked out I = A | B | C | D | E | F | G | H,
|
17
|
+
unchecked out J = A | B | C | D | E | F | G | H | I] < Array[A | B | C | D | E | F | G | H | I | J]
|
18
|
+
# <!--
|
19
|
+
# rdoc-file=array.c
|
20
|
+
# - self[index] -> object or nil
|
21
|
+
# -->
|
22
|
+
# Returns elements from `self`; does not modify `self`.
|
23
|
+
#
|
24
|
+
# In brief:
|
25
|
+
#
|
26
|
+
# a = [:foo, 'bar', 2]
|
27
|
+
#
|
28
|
+
# # Single argument index: returns one element.
|
29
|
+
# a[0] # => :foo # Zero-based index.
|
30
|
+
#
|
31
|
+
# When a single integer argument `index` is given, returns the element at offset
|
32
|
+
# `index`:
|
33
|
+
#
|
34
|
+
# a = [:foo, 'bar', 2]
|
35
|
+
# a[0] # => :foo
|
36
|
+
# a[2] # => 2
|
37
|
+
# a # => [:foo, "bar", 2]
|
38
|
+
def []: (0 index) -> A
|
39
|
+
| (1 index) -> B
|
40
|
+
| (2 index) -> C
|
41
|
+
| (3 index) -> D
|
42
|
+
| (4 index) -> E
|
43
|
+
| (5 index) -> F
|
44
|
+
| (6 index) -> G
|
45
|
+
| (7 index) -> H
|
46
|
+
| (8 index) -> I
|
47
|
+
| (9 index) -> J
|
48
|
+
| (0 index) -> K
|
49
|
+
| (int index) -> nil
|
50
|
+
|
51
|
+
# <!--
|
52
|
+
# rdoc-file=array.c
|
53
|
+
# - at(index) -> object or nil
|
54
|
+
# -->
|
55
|
+
# Returns the element of `self` specified by the given `index` or `nil` if there
|
56
|
+
# is no such element; `index` must be an [integer-convertible
|
57
|
+
# object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
|
58
|
+
#
|
59
|
+
# For non-negative `index`, returns the element of `self` at offset `index`:
|
60
|
+
#
|
61
|
+
# a = [:foo, 'bar', 2]
|
62
|
+
# a.at(0) # => :foo
|
63
|
+
# a.at(2) # => 2
|
64
|
+
# a.at(2.0) # => 2
|
65
|
+
#
|
66
|
+
# Related: Array#[]; see also [Methods for
|
67
|
+
# Fetching](rdoc-ref:Array@Methods+for+Fetching).
|
68
|
+
#
|
69
|
+
def at: (0 index) -> A
|
70
|
+
| (1 index) -> B
|
71
|
+
| (2 index) -> C
|
72
|
+
| (3 index) -> D
|
73
|
+
| (4 index) -> E
|
74
|
+
| (5 index) -> F
|
75
|
+
| (6 index) -> G
|
76
|
+
| (7 index) -> H
|
77
|
+
| (8 index) -> I
|
78
|
+
| (9 index) -> J
|
79
|
+
| (int index) -> nil
|
80
|
+
|
81
|
+
# <!--
|
82
|
+
# rdoc-file=array.c
|
83
|
+
# - fetch(index) -> element
|
84
|
+
# - fetch(index, default_value) -> element or default_value
|
85
|
+
# - fetch(index) {|index| ... } -> element or block_return_value
|
86
|
+
# -->
|
87
|
+
# Returns the element of `self` at offset `index` if `index` is in range;
|
88
|
+
# `index` must be an [integer-convertible
|
89
|
+
# object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
|
90
|
+
#
|
91
|
+
# With the single argument `index` and no block, returns the element at offset
|
92
|
+
# `index`:
|
93
|
+
#
|
94
|
+
# a = [:foo, 'bar', 2]
|
95
|
+
# a.fetch(1) # => "bar"
|
96
|
+
# a.fetch(1.1) # => "bar"
|
97
|
+
#
|
98
|
+
# With arguments `index` and `default_value` (which may be any object) and no
|
99
|
+
# block, returns `default_value` if `index` is out-of-range:
|
100
|
+
#
|
101
|
+
# a = [:foo, 'bar', 2]
|
102
|
+
# a.fetch(1, nil) # => "bar"
|
103
|
+
# a.fetch(3, :foo) # => :foo
|
104
|
+
#
|
105
|
+
# With argument `index` and a block, returns the element at offset `index` if
|
106
|
+
# index is in range (and the block is not called); otherwise calls the block
|
107
|
+
# with index and returns its return value:
|
108
|
+
#
|
109
|
+
# a = [:foo, 'bar', 2]
|
110
|
+
# a.fetch(1) {|index| raise 'Cannot happen' } # => "bar"
|
111
|
+
# a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"
|
112
|
+
#
|
113
|
+
# Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
|
114
|
+
#
|
115
|
+
def fetch: (0 index) -> A
|
116
|
+
| (1 index) -> B
|
117
|
+
| (2 index) -> C
|
118
|
+
| (3 index) -> D
|
119
|
+
| (4 index) -> E
|
120
|
+
| (5 index) -> F
|
121
|
+
| (6 index) -> G
|
122
|
+
| (7 index) -> H
|
123
|
+
| (8 index) -> I
|
124
|
+
| (9 index) -> J
|
125
|
+
| (int index) -> void
|
126
|
+
| [T] (0 index, T default) -> (A | T)
|
127
|
+
| [T] (1 index, T default) -> (B | T)
|
128
|
+
| [T] (2 index, T default) -> (C | T)
|
129
|
+
| [T] (3 index, T default) -> (D | T)
|
130
|
+
| [T] (4 index, T default) -> (E | T)
|
131
|
+
| [T] (5 index, T default) -> (F | T)
|
132
|
+
| [T] (6 index, T default) -> (G | T)
|
133
|
+
| [T] (7 index, T default) -> (H | T)
|
134
|
+
| [T] (8 index, T default) -> (I | T)
|
135
|
+
| [T] (9 index, T default) -> (J | T)
|
136
|
+
| [T] (int index, T default) -> (A | B | C | D | E | F |G | H | I | J | T)
|
137
|
+
| [T] (0 index) { (int index) -> T } -> (A | T)
|
138
|
+
| [T] (1 index) { (int index) -> T } -> (B | T)
|
139
|
+
| [T] (2 index) { (int index) -> T } -> (C | T)
|
140
|
+
| [T] (3 index) { (int index) -> T } -> (D | T)
|
141
|
+
| [T] (4 index) { (int index) -> T } -> (E | T)
|
142
|
+
| [T] (5 index) { (int index) -> T } -> (F | T)
|
143
|
+
| [T] (6 index) { (int index) -> T } -> (G | T)
|
144
|
+
| [T] (7 index) { (int index) -> T } -> (H | T)
|
145
|
+
| [T] (8 index) { (int index) -> T } -> (I | T)
|
146
|
+
| [T] (9 index) { (int index) -> T } -> (J | T)
|
147
|
+
| [T] (int index) { (int index) -> T } -> (A | B | C | D | E | F |G | H | I | J | T)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
data/rbs_collection.yaml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Download sources
|
2
|
+
sources:
|
3
|
+
- type: git
|
4
|
+
name: ruby/gem_rbs_collection
|
5
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
6
|
+
revision: main
|
7
|
+
repo_dir: gems
|
8
|
+
|
9
|
+
# You can specify local directories as sources also.
|
10
|
+
# - type: local
|
11
|
+
# path: path/to/your/local/repository
|
12
|
+
|
13
|
+
# A directory to install the downloaded RBSs
|
14
|
+
path: .gem_rbs_collection
|
15
|
+
|
16
|
+
# gems:
|
17
|
+
# # If you want to avoid installing rbs files for gems, you can specify them here.
|
18
|
+
# - name: GEM_NAME
|
19
|
+
# ignore: true
|
data/solargraph.gemspec
CHANGED
@@ -34,7 +34,8 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.add_runtime_dependency 'observer', '~> 0.1'
|
35
35
|
s.add_runtime_dependency 'ostruct', '~> 0.6'
|
36
36
|
s.add_runtime_dependency 'parser', '~> 3.0'
|
37
|
-
s.add_runtime_dependency '
|
37
|
+
s.add_runtime_dependency 'prism', '~> 1.4'
|
38
|
+
s.add_runtime_dependency 'rbs', '~> 3.6.1'
|
38
39
|
s.add_runtime_dependency 'reverse_markdown', '~> 3.0'
|
39
40
|
s.add_runtime_dependency 'rubocop', '~> 1.38'
|
40
41
|
s.add_runtime_dependency 'thor', '~> 1.0'
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solargraph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.56.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-07-29 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: backport
|
@@ -170,20 +169,34 @@ dependencies:
|
|
170
169
|
- - "~>"
|
171
170
|
- !ruby/object:Gem::Version
|
172
171
|
version: '3.0'
|
172
|
+
- !ruby/object:Gem::Dependency
|
173
|
+
name: prism
|
174
|
+
requirement: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '1.4'
|
179
|
+
type: :runtime
|
180
|
+
prerelease: false
|
181
|
+
version_requirements: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - "~>"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '1.4'
|
173
186
|
- !ruby/object:Gem::Dependency
|
174
187
|
name: rbs
|
175
188
|
requirement: !ruby/object:Gem::Requirement
|
176
189
|
requirements:
|
177
190
|
- - "~>"
|
178
191
|
- !ruby/object:Gem::Version
|
179
|
-
version:
|
192
|
+
version: 3.6.1
|
180
193
|
type: :runtime
|
181
194
|
prerelease: false
|
182
195
|
version_requirements: !ruby/object:Gem::Requirement
|
183
196
|
requirements:
|
184
197
|
- - "~>"
|
185
198
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
199
|
+
version: 3.6.1
|
187
200
|
- !ruby/object:Gem::Dependency
|
188
201
|
name: reverse_markdown
|
189
202
|
requirement: !ruby/object:Gem::Requirement
|
@@ -401,15 +414,20 @@ files:
|
|
401
414
|
- lib/solargraph/api_map/source_to_yard.rb
|
402
415
|
- lib/solargraph/api_map/store.rb
|
403
416
|
- lib/solargraph/bench.rb
|
404
|
-
- lib/solargraph/cache.rb
|
405
417
|
- lib/solargraph/complex_type.rb
|
406
418
|
- lib/solargraph/complex_type/type_methods.rb
|
407
419
|
- lib/solargraph/complex_type/unique_type.rb
|
408
420
|
- lib/solargraph/convention.rb
|
409
421
|
- lib/solargraph/convention/base.rb
|
422
|
+
- lib/solargraph/convention/data_definition.rb
|
423
|
+
- lib/solargraph/convention/data_definition/data_assignment_node.rb
|
424
|
+
- lib/solargraph/convention/data_definition/data_definition_node.rb
|
410
425
|
- lib/solargraph/convention/gemfile.rb
|
411
426
|
- lib/solargraph/convention/gemspec.rb
|
412
427
|
- lib/solargraph/convention/rakefile.rb
|
428
|
+
- lib/solargraph/convention/struct_definition.rb
|
429
|
+
- lib/solargraph/convention/struct_definition/struct_assignment_node.rb
|
430
|
+
- lib/solargraph/convention/struct_definition/struct_definition_node.rb
|
413
431
|
- lib/solargraph/converters/dd.rb
|
414
432
|
- lib/solargraph/converters/dl.rb
|
415
433
|
- lib/solargraph/converters/dt.rb
|
@@ -493,6 +511,7 @@ files:
|
|
493
511
|
- lib/solargraph/page.rb
|
494
512
|
- lib/solargraph/parser.rb
|
495
513
|
- lib/solargraph/parser/comment_ripper.rb
|
514
|
+
- lib/solargraph/parser/flow_sensitive_typing.rb
|
496
515
|
- lib/solargraph/parser/node_methods.rb
|
497
516
|
- lib/solargraph/parser/node_processor.rb
|
498
517
|
- lib/solargraph/parser/node_processor/base.rb
|
@@ -503,6 +522,7 @@ files:
|
|
503
522
|
- lib/solargraph/parser/parser_gem/node_methods.rb
|
504
523
|
- lib/solargraph/parser/parser_gem/node_processors.rb
|
505
524
|
- lib/solargraph/parser/parser_gem/node_processors/alias_node.rb
|
525
|
+
- lib/solargraph/parser/parser_gem/node_processors/and_node.rb
|
506
526
|
- lib/solargraph/parser/parser_gem/node_processors/args_node.rb
|
507
527
|
- lib/solargraph/parser/parser_gem/node_processors/begin_node.rb
|
508
528
|
- lib/solargraph/parser/parser_gem/node_processors/block_node.rb
|
@@ -511,21 +531,26 @@ files:
|
|
511
531
|
- lib/solargraph/parser/parser_gem/node_processors/def_node.rb
|
512
532
|
- lib/solargraph/parser/parser_gem/node_processors/defs_node.rb
|
513
533
|
- lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb
|
534
|
+
- lib/solargraph/parser/parser_gem/node_processors/if_node.rb
|
514
535
|
- lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb
|
515
536
|
- lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb
|
516
537
|
- lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb
|
517
538
|
- lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb
|
539
|
+
- lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb
|
518
540
|
- lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb
|
519
541
|
- lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb
|
520
542
|
- lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb
|
521
543
|
- lib/solargraph/parser/parser_gem/node_processors/send_node.rb
|
522
544
|
- lib/solargraph/parser/parser_gem/node_processors/sym_node.rb
|
545
|
+
- lib/solargraph/parser/parser_gem/node_processors/until_node.rb
|
546
|
+
- lib/solargraph/parser/parser_gem/node_processors/while_node.rb
|
523
547
|
- lib/solargraph/parser/region.rb
|
524
548
|
- lib/solargraph/parser/snippet.rb
|
525
549
|
- lib/solargraph/pin.rb
|
526
550
|
- lib/solargraph/pin/base.rb
|
527
551
|
- lib/solargraph/pin/base_variable.rb
|
528
552
|
- lib/solargraph/pin/block.rb
|
553
|
+
- lib/solargraph/pin/breakable.rb
|
529
554
|
- lib/solargraph/pin/callable.rb
|
530
555
|
- lib/solargraph/pin/class_variable.rb
|
531
556
|
- lib/solargraph/pin/closure.rb
|
@@ -556,6 +581,9 @@ files:
|
|
556
581
|
- lib/solargraph/pin/signature.rb
|
557
582
|
- lib/solargraph/pin/singleton.rb
|
558
583
|
- lib/solargraph/pin/symbol.rb
|
584
|
+
- lib/solargraph/pin/until.rb
|
585
|
+
- lib/solargraph/pin/while.rb
|
586
|
+
- lib/solargraph/pin_cache.rb
|
559
587
|
- lib/solargraph/position.rb
|
560
588
|
- lib/solargraph/range.rb
|
561
589
|
- lib/solargraph/rbs_map.rb
|
@@ -619,6 +647,8 @@ files:
|
|
619
647
|
- lib/solargraph/yard_map/to_method.rb
|
620
648
|
- lib/solargraph/yard_tags.rb
|
621
649
|
- lib/solargraph/yardoc.rb
|
650
|
+
- rbs/fills/tuple.rbs
|
651
|
+
- rbs_collection.yaml
|
622
652
|
- solargraph.gemspec
|
623
653
|
homepage: https://solargraph.org
|
624
654
|
licenses:
|
@@ -628,7 +658,6 @@ metadata:
|
|
628
658
|
bug_tracker_uri: https://github.com/castwide/solargraph/issues
|
629
659
|
changelog_uri: https://github.com/castwide/solargraph/blob/master/CHANGELOG.md
|
630
660
|
source_code_uri: https://github.com/castwide/solargraph
|
631
|
-
post_install_message:
|
632
661
|
rdoc_options: []
|
633
662
|
require_paths:
|
634
663
|
- lib
|
@@ -643,8 +672,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
643
672
|
- !ruby/object:Gem::Version
|
644
673
|
version: '0'
|
645
674
|
requirements: []
|
646
|
-
rubygems_version: 3.
|
647
|
-
signing_key:
|
675
|
+
rubygems_version: 3.6.7
|
648
676
|
specification_version: 4
|
649
677
|
summary: A Ruby language server
|
650
678
|
test_files: []
|