solargraph 0.56.2 → 0.58.0

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.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +127 -0
  3. data/.github/workflows/plugins.yml +183 -7
  4. data/.github/workflows/rspec.yml +55 -5
  5. data/.github/workflows/typecheck.yml +6 -3
  6. data/.gitignore +5 -0
  7. data/.overcommit.yml +72 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +66 -0
  10. data/.rubocop_todo.yml +1279 -0
  11. data/.yardopts +1 -0
  12. data/CHANGELOG.md +69 -0
  13. data/README.md +8 -4
  14. data/Rakefile +125 -13
  15. data/bin/solargraph +8 -5
  16. data/lib/solargraph/api_map/cache.rb +3 -2
  17. data/lib/solargraph/api_map/constants.rb +279 -0
  18. data/lib/solargraph/api_map/index.rb +49 -31
  19. data/lib/solargraph/api_map/source_to_yard.rb +13 -4
  20. data/lib/solargraph/api_map/store.rb +144 -26
  21. data/lib/solargraph/api_map.rb +217 -245
  22. data/lib/solargraph/bench.rb +1 -0
  23. data/lib/solargraph/complex_type/type_methods.rb +6 -0
  24. data/lib/solargraph/complex_type/unique_type.rb +19 -12
  25. data/lib/solargraph/complex_type.rb +24 -3
  26. data/lib/solargraph/convention/active_support_concern.rb +111 -0
  27. data/lib/solargraph/convention/base.rb +17 -0
  28. data/lib/solargraph/convention/data_definition/data_assignment_node.rb +1 -0
  29. data/lib/solargraph/convention/data_definition/data_definition_node.rb +4 -2
  30. data/lib/solargraph/convention/data_definition.rb +2 -1
  31. data/lib/solargraph/convention/gemspec.rb +1 -1
  32. data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +1 -0
  33. data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +3 -1
  34. data/lib/solargraph/convention/struct_definition.rb +36 -13
  35. data/lib/solargraph/convention.rb +31 -2
  36. data/lib/solargraph/diagnostics/rubocop.rb +6 -1
  37. data/lib/solargraph/diagnostics/rubocop_helpers.rb +5 -3
  38. data/lib/solargraph/doc_map.rb +44 -13
  39. data/lib/solargraph/environ.rb +9 -2
  40. data/lib/solargraph/equality.rb +1 -0
  41. data/lib/solargraph/gem_pins.rb +21 -11
  42. data/lib/solargraph/language_server/host/dispatch.rb +2 -0
  43. data/lib/solargraph/language_server/host/message_worker.rb +3 -0
  44. data/lib/solargraph/language_server/host.rb +12 -5
  45. data/lib/solargraph/language_server/message/base.rb +2 -1
  46. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +1 -1
  47. data/lib/solargraph/language_server/message/text_document/definition.rb +2 -0
  48. data/lib/solargraph/language_server/message/text_document/formatting.rb +19 -2
  49. data/lib/solargraph/language_server/message/text_document/type_definition.rb +1 -0
  50. data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +2 -0
  51. data/lib/solargraph/language_server/progress.rb +8 -0
  52. data/lib/solargraph/language_server/request.rb +4 -1
  53. data/lib/solargraph/library.rb +11 -18
  54. data/lib/solargraph/location.rb +3 -0
  55. data/lib/solargraph/logging.rb +11 -2
  56. data/lib/solargraph/page.rb +3 -0
  57. data/lib/solargraph/parser/comment_ripper.rb +8 -1
  58. data/lib/solargraph/parser/flow_sensitive_typing.rb +33 -5
  59. data/lib/solargraph/parser/node_processor/base.rb +1 -1
  60. data/lib/solargraph/parser/node_processor.rb +6 -2
  61. data/lib/solargraph/parser/parser_gem/class_methods.rb +3 -13
  62. data/lib/solargraph/parser/parser_gem/flawed_builder.rb +1 -0
  63. data/lib/solargraph/parser/parser_gem/node_chainer.rb +3 -1
  64. data/lib/solargraph/parser/parser_gem/node_methods.rb +5 -16
  65. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +1 -0
  66. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +3 -2
  67. data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +2 -0
  68. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +3 -0
  69. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +64 -8
  70. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +12 -3
  71. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +36 -16
  72. data/lib/solargraph/parser/region.rb +3 -0
  73. data/lib/solargraph/parser/snippet.rb +2 -0
  74. data/lib/solargraph/pin/base.rb +77 -14
  75. data/lib/solargraph/pin/base_variable.rb +6 -5
  76. data/lib/solargraph/pin/block.rb +3 -2
  77. data/lib/solargraph/pin/callable.rb +14 -1
  78. data/lib/solargraph/pin/closure.rb +5 -7
  79. data/lib/solargraph/pin/common.rb +6 -2
  80. data/lib/solargraph/pin/constant.rb +2 -0
  81. data/lib/solargraph/pin/local_variable.rb +1 -2
  82. data/lib/solargraph/pin/method.rb +28 -9
  83. data/lib/solargraph/pin/method_alias.rb +3 -0
  84. data/lib/solargraph/pin/parameter.rb +24 -10
  85. data/lib/solargraph/pin/proxy_type.rb +5 -1
  86. data/lib/solargraph/pin/reference/override.rb +15 -1
  87. data/lib/solargraph/pin/reference/superclass.rb +5 -0
  88. data/lib/solargraph/pin/reference.rb +17 -0
  89. data/lib/solargraph/pin/search.rb +6 -1
  90. data/lib/solargraph/pin/signature.rb +2 -0
  91. data/lib/solargraph/pin/symbol.rb +5 -0
  92. data/lib/solargraph/pin_cache.rb +64 -4
  93. data/lib/solargraph/position.rb +3 -0
  94. data/lib/solargraph/range.rb +5 -0
  95. data/lib/solargraph/rbs_map/conversions.rb +29 -6
  96. data/lib/solargraph/rbs_map/core_fills.rb +18 -0
  97. data/lib/solargraph/rbs_map/core_map.rb +14 -7
  98. data/lib/solargraph/rbs_map.rb +14 -1
  99. data/lib/solargraph/shell.rb +85 -1
  100. data/lib/solargraph/source/chain/call.rb +7 -3
  101. data/lib/solargraph/source/chain/constant.rb +3 -66
  102. data/lib/solargraph/source/chain/if.rb +1 -1
  103. data/lib/solargraph/source/chain/link.rb +11 -2
  104. data/lib/solargraph/source/chain/or.rb +1 -1
  105. data/lib/solargraph/source/chain.rb +11 -2
  106. data/lib/solargraph/source/change.rb +2 -2
  107. data/lib/solargraph/source/cursor.rb +2 -3
  108. data/lib/solargraph/source/source_chainer.rb +1 -1
  109. data/lib/solargraph/source.rb +6 -3
  110. data/lib/solargraph/source_map/clip.rb +18 -26
  111. data/lib/solargraph/source_map/data.rb +4 -0
  112. data/lib/solargraph/source_map/mapper.rb +2 -2
  113. data/lib/solargraph/source_map.rb +28 -16
  114. data/lib/solargraph/type_checker/param_def.rb +2 -0
  115. data/lib/solargraph/type_checker/rules.rb +30 -8
  116. data/lib/solargraph/type_checker.rb +301 -186
  117. data/lib/solargraph/version.rb +1 -1
  118. data/lib/solargraph/workspace/config.rb +21 -5
  119. data/lib/solargraph/workspace/require_paths.rb +97 -0
  120. data/lib/solargraph/workspace.rb +30 -67
  121. data/lib/solargraph/yard_map/mapper/to_method.rb +4 -3
  122. data/lib/solargraph/yard_map/mapper/to_namespace.rb +1 -0
  123. data/lib/solargraph/yard_map/to_method.rb +2 -1
  124. data/lib/solargraph/yardoc.rb +39 -3
  125. data/lib/solargraph.rb +2 -0
  126. data/rbs/fills/bundler/0/bundler.rbs +4271 -0
  127. data/rbs/fills/open3/0/open3.rbs +172 -0
  128. data/rbs/fills/rubygems/0/basic_specification.rbs +326 -0
  129. data/rbs/fills/rubygems/0/errors.rbs +364 -0
  130. data/rbs/fills/rubygems/0/spec_fetcher.rbs +107 -0
  131. data/rbs/fills/rubygems/0/specification.rbs +1753 -0
  132. data/rbs/fills/{tuple.rbs → tuple/tuple.rbs} +2 -3
  133. data/rbs_collection.yaml +4 -4
  134. data/sig/shims/ast/0/node.rbs +5 -0
  135. data/sig/shims/ast/2.4/.rbs_meta.yaml +9 -0
  136. data/sig/shims/ast/2.4/ast.rbs +73 -0
  137. data/sig/shims/parser/3.2.0.1/builders/default.rbs +195 -0
  138. data/sig/shims/parser/3.2.0.1/manifest.yaml +7 -0
  139. data/sig/shims/parser/3.2.0.1/parser.rbs +201 -0
  140. data/sig/shims/parser/3.2.0.1/polyfill.rbs +4 -0
  141. data/sig/shims/thor/1.2.0.1/.rbs_meta.yaml +9 -0
  142. data/sig/shims/thor/1.2.0.1/manifest.yaml +7 -0
  143. data/sig/shims/thor/1.2.0.1/thor.rbs +17 -0
  144. data/solargraph.gemspec +26 -5
  145. metadata +181 -13
  146. data/lib/.rubocop.yml +0 -22
  147. data/lib/solargraph/parser/node_methods.rb +0 -97
@@ -45,7 +45,6 @@ module Solargraph
45
45
  | (7 index) -> H
46
46
  | (8 index) -> I
47
47
  | (9 index) -> J
48
- | (0 index) -> K
49
48
  | (int index) -> nil
50
49
 
51
50
  # <!--
@@ -133,7 +132,7 @@ module Solargraph
133
132
  | [T] (7 index, T default) -> (H | T)
134
133
  | [T] (8 index, T default) -> (I | T)
135
134
  | [T] (9 index, T default) -> (J | T)
136
- | [T] (int index, T default) -> (A | B | C | D | E | F |G | H | I | J | T)
135
+ | [T] (int index, T default) -> (A | B | C | D | E | F | G | H | I | J | T)
137
136
  | [T] (0 index) { (int index) -> T } -> (A | T)
138
137
  | [T] (1 index) { (int index) -> T } -> (B | T)
139
138
  | [T] (2 index) { (int index) -> T } -> (C | T)
@@ -144,7 +143,7 @@ module Solargraph
144
143
  | [T] (7 index) { (int index) -> T } -> (H | T)
145
144
  | [T] (8 index) { (int index) -> T } -> (I | T)
146
145
  | [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)
146
+ | [T] (int index) { (int index) -> T } -> (A | B | C | D | E | F | G | H | I | J | T)
148
147
  end
149
148
  end
150
149
  end
data/rbs_collection.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  # Download sources
2
2
  sources:
3
+ - type: local
4
+ name: shims
5
+ path: sig/shims
6
+
3
7
  - type: git
4
8
  name: ruby/gem_rbs_collection
5
9
  remote: https://github.com/ruby/gem_rbs_collection.git
6
10
  revision: main
7
11
  repo_dir: gems
8
12
 
9
- # You can specify local directories as sources also.
10
- # - type: local
11
- # path: path/to/your/local/repository
12
-
13
13
  # A directory to install the downloaded RBSs
14
14
  path: .gem_rbs_collection
15
15
 
@@ -0,0 +1,5 @@
1
+ module ::AST
2
+ class Node
3
+ def children: () -> [self, Integer, String, Symbol, nil]
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: ast
3
+ version: '2.4'
4
+ source:
5
+ type: git
6
+ name: ruby/gem_rbs_collection
7
+ revision: c604d278dd6c14a1bb6cf0c0051af643b268a981
8
+ remote: https://github.com/ruby/gem_rbs_collection.git
9
+ repo_dir: gems
@@ -0,0 +1,73 @@
1
+ module AST
2
+ interface _ToAst
3
+ def to_ast: () -> Node
4
+ end
5
+
6
+ interface _ToSym
7
+ def to_sym: () -> Symbol
8
+ end
9
+
10
+ class Node
11
+ public
12
+
13
+ attr_reader children: Array[self]
14
+ attr_reader hash: String
15
+ attr_reader type: Symbol
16
+
17
+ alias + concat
18
+
19
+ alias << append
20
+
21
+ def ==: (untyped other) -> bool
22
+
23
+ def append: (untyped element) -> self
24
+
25
+ alias clone dup
26
+
27
+ def concat: (_ToA[untyped] array) -> self
28
+
29
+ def dup: () -> self
30
+
31
+ def eql?: (untyped other) -> bool
32
+
33
+ def inspect: (?Integer indent) -> String
34
+
35
+ alias to_a children
36
+
37
+ def to_ast: () -> self
38
+
39
+ alias to_s to_sexp
40
+
41
+ def to_sexp: (?Integer indent) -> String
42
+
43
+ def to_sexp_array: () -> Array[untyped]
44
+
45
+ def updated: (?_ToSym? `type`, ?_ToA[untyped]? children, ?Hash[Symbol, untyped]? properties) -> self
46
+
47
+ private
48
+
49
+ def initialize: (_ToSym `type`, ?_ToA[untyped]? children, ?Hash[Symbol, untyped] properties) -> void
50
+
51
+ alias original_dup dup
52
+ end
53
+
54
+ class Processor
55
+ include Mixin
56
+
57
+ module Mixin
58
+ public
59
+
60
+ def handler_missing: (Node node) -> Node?
61
+
62
+ def process: (_ToAst? node) -> Node?
63
+
64
+ def process_all: (Array[_ToAst] nodes) -> Array[Node]
65
+ end
66
+ end
67
+
68
+ module Sexp
69
+ public
70
+
71
+ def s: (_ToSym `type`, *untyped children) -> Node
72
+ end
73
+ end
@@ -0,0 +1,195 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Parser
4
+ ##
5
+ # Default AST builder. Uses {AST::Node}s.
6
+ #
7
+ module Builders
8
+ class Default
9
+ ##
10
+ # AST compatibility attribute; since `-> {}` is not semantically
11
+ # equivalent to `lambda {}`, all new code should set this attribute
12
+ # to true.
13
+ #
14
+ # If set to false (the default), `-> {}` is emitted as
15
+ # `s(:block, s(:send, nil, :lambda), s(:args), nil)`.
16
+ #
17
+ # If set to true, `-> {}` is emitted as
18
+ # `s(:block, s(:lambda), s(:args), nil)`.
19
+ #
20
+ # @return [Boolean]
21
+ attr_accessor self.emit_lambda: bool
22
+
23
+ ##
24
+ # AST compatibility attribute; block arguments of `m { |a| }` are
25
+ # not semantically equivalent to block arguments of `m { |a,| }` or `m { |a, b| }`,
26
+ # all new code should set this attribute to true.
27
+ #
28
+ # If set to false (the default), arguments of `m { |a| }` are emitted as
29
+ # `s(:args, s(:arg, :a))`.
30
+ #
31
+ # If set to true, arguments of `m { |a| }` are emitted as
32
+ # `s(:args, s(:procarg0, :a)).
33
+ #
34
+ # @return [Boolean]
35
+ attr_accessor self.emit_procarg0: bool
36
+
37
+ ##
38
+ # AST compatibility attribute; locations of `__ENCODING__` are not the same
39
+ # as locations of `Encoding::UTF_8` causing problems during rewriting,
40
+ # all new code should set this attribute to true.
41
+ #
42
+ # If set to false (the default), `__ENCODING__` is emitted as
43
+ # ` s(:const, s(:const, nil, :Encoding), :UTF_8)`.
44
+ #
45
+ # If set to true, `__ENCODING__` is emitted as
46
+ # `s(:__ENCODING__)`.
47
+ #
48
+ # @return [Boolean]
49
+ attr_accessor self.emit_encoding: bool
50
+
51
+ ##
52
+ # AST compatibility attribute; indexed assignment, `x[] = 1`, is not
53
+ # semantically equivalent to calling the method directly, `x.[]=(1)`.
54
+ # Specifically, in the former case, the expression's value is always 1,
55
+ # and in the latter case, the expression's value is the return value
56
+ # of the `[]=` method.
57
+ #
58
+ # If set to false (the default), `self[1]` is emitted as
59
+ # `s(:send, s(:self), :[], s(:int, 1))`, and `self[1] = 2` is
60
+ # emitted as `s(:send, s(:self), :[]=, s(:int, 1), s(:int, 2))`.
61
+ #
62
+ # If set to true, `self[1]` is emitted as
63
+ # `s(:index, s(:self), s(:int, 1))`, and `self[1] = 2` is
64
+ # emitted as `s(:indexasgn, s(:self), s(:int, 1), s(:int, 2))`.
65
+ #
66
+ # @return [Boolean]
67
+ attr_accessor self.emit_index: bool
68
+
69
+ ##
70
+ # AST compatibility attribute; causes a single non-mlhs
71
+ # block argument to be wrapped in s(:procarg0).
72
+ #
73
+ # If set to false (the default), block arguments `|a|` are emitted as
74
+ # `s(:args, s(:procarg0, :a))`
75
+ #
76
+ # If set to true, block arguments `|a|` are emitted as
77
+ # `s(:args, s(:procarg0, s(:arg, :a))`
78
+ #
79
+ # @return [Boolean]
80
+ attr_accessor self.emit_arg_inside_procarg0: bool
81
+
82
+ ##
83
+ # AST compatibility attribute; arguments forwarding initially
84
+ # didn't have support for leading arguments
85
+ # (i.e. `def m(a, ...); end` was a syntax error). However, Ruby 3.0
86
+ # added support for any number of arguments in front of the `...`.
87
+ #
88
+ # If set to false (the default):
89
+ # 1. `def m(...) end` is emitted as
90
+ # s(:def, :m, s(:forward_args), nil)
91
+ # 2. `def m(a, b, ...) end` is emitted as
92
+ # s(:def, :m,
93
+ # s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
94
+ #
95
+ # If set to true it uses a single format:
96
+ # 1. `def m(...) end` is emitted as
97
+ # s(:def, :m, s(:args, s(:forward_arg)))
98
+ # 2. `def m(a, b, ...) end` is emitted as
99
+ # s(:def, :m, s(:args, s(:arg, :a), s(:arg, :b), s(:forward_arg)))
100
+ #
101
+ # It does't matter that much on 2.7 (because there can't be any leading arguments),
102
+ # but on 3.0 it should be better enabled to use a single AST format.
103
+ #
104
+ # @return [Boolean]
105
+ attr_accessor self.emit_forward_arg: bool
106
+
107
+ ##
108
+ # AST compatibility attribute; Starting from Ruby 2.7 keyword arguments
109
+ # of method calls that are passed explicitly as a hash (i.e. with curly braces)
110
+ # are treated as positional arguments and Ruby 2.7 emits a warning on such method
111
+ # call. Ruby 3.0 given an ArgumentError.
112
+ #
113
+ # If set to false (the default) the last hash argument is emitted as `hash`:
114
+ #
115
+ # ```
116
+ # (send nil :foo
117
+ # (hash
118
+ # (pair
119
+ # (sym :bar)
120
+ # (int 42))))
121
+ # ```
122
+ #
123
+ # If set to true it is emitted as `kwargs`:
124
+ #
125
+ # ```
126
+ # (send nil :foo
127
+ # (kwargs
128
+ # (pair
129
+ # (sym :bar)
130
+ # (int 42))))
131
+ # ```
132
+ #
133
+ # Note that `kwargs` node is just a replacement for `hash` argument,
134
+ # so if there's are multiple arguments (or a `kwsplat`) all of them
135
+ # are wrapped into `kwargs` instead of `hash`:
136
+ #
137
+ # ```
138
+ # (send nil :foo
139
+ # (kwargs
140
+ # (pair
141
+ # (sym :a)
142
+ # (int 42))
143
+ # (kwsplat
144
+ # (send nil :b))
145
+ # (pair
146
+ # (sym :c)
147
+ # (int 10))))
148
+ # ```
149
+ attr_accessor self.emit_kwargs: bool
150
+
151
+ ##
152
+ # AST compatibility attribute; Starting from 3.0 Ruby returns
153
+ # true/false from single-line pattern matching with `in` keyword.
154
+ #
155
+ # Before 3.0 there was an exception if given value doesn't match pattern.
156
+ #
157
+ # NOTE: This attribute affects only Ruby 2.7 grammar.
158
+ # 3.0 grammar always emits `match_pattern`/`match_pattern_p`
159
+ #
160
+ # If compatibility attribute set to false `foo in bar` is emitted as `in_match`:
161
+ #
162
+ # ```
163
+ # (in-match
164
+ # (send nil :foo)
165
+ # (match-var :bar))
166
+ # ```
167
+ #
168
+ # If set to true it's emitted as `match_pattern_p`:
169
+ # ```
170
+ # (match-pattern-p
171
+ # (send nil :foo)
172
+ # (match-var :bar))
173
+ # ```
174
+ attr_accessor self.emit_match_pattern: bool
175
+
176
+ ##
177
+ # If set to true (the default), `__FILE__` and `__LINE__` are transformed to
178
+ # literal nodes. For example, `s(:str, "lib/foo.rb")` and `s(:int, 10)`.
179
+ #
180
+ # If set to false, `__FILE__` and `__LINE__` are emitted as-is,
181
+ # i.e. as `s(:__FILE__)` and `s(:__LINE__)` nodes.
182
+ #
183
+ # Source maps are identical in both cases.
184
+ #
185
+ # @return [Boolean]
186
+ attr_accessor emit_file_line_as_literals: bool
187
+
188
+ def value: (untyped token) -> untyped
189
+
190
+ def string_value: (untyped token) -> String
191
+
192
+ def loc: (untyped token) -> untyped
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,7 @@
1
+ # manifest.yaml describes dependencies which do not appear in the gemspec.
2
+ # If this gem includes such dependencies, comment-out the following lines and
3
+ # declare the dependencies.
4
+ # If all dependencies appear in the gemspec, you should remove this file.
5
+ #
6
+ dependencies:
7
+ - name: ast
@@ -0,0 +1,201 @@
1
+ module Parser
2
+ CurrentRuby: Parser::Base
3
+
4
+ class SyntaxError < StandardError
5
+ end
6
+ class UnknownEncodingInMagicComment < StandardError
7
+ end
8
+
9
+ class Base < Racc::Parser
10
+ def version: -> Integer
11
+ def self.parse: (String string, ?String file, ?Integer line) -> Parser::AST::Node?
12
+ def self.parse_with_comments: (String string, ?String file, ?Integer line) -> [Parser::AST::Node?, Array[Source::Comment]]
13
+ def parse: (Parser::Source::Buffer source_buffer) -> Parser::AST::Node?
14
+ end
15
+
16
+ class Ruby18 < Base
17
+ end
18
+ class Ruby19 < Base
19
+ end
20
+ class Ruby20 < Base
21
+ end
22
+ class Ruby21 < Base
23
+ end
24
+ class Ruby22 < Base
25
+ end
26
+ class Ruby23 < Base
27
+ end
28
+ class Ruby24 < Base
29
+ end
30
+ class Ruby25 < Base
31
+ end
32
+ class Ruby26 < Base
33
+ end
34
+ class Ruby27 < Base
35
+ end
36
+ class Ruby30 < Base
37
+ end
38
+ class Ruby31 < Base
39
+ end
40
+ class Ruby32 < Base
41
+ end
42
+ class Ruby33 < Base
43
+ end
44
+
45
+ module AST
46
+ class Node < ::AST::Node
47
+ attr_reader location: Source::Map
48
+ alias loc location
49
+
50
+ def children: () -> Array[self]
51
+ end
52
+
53
+ class Processor
54
+ module Mixin
55
+ def process: (Node? node) -> Node?
56
+ end
57
+
58
+ include Mixin
59
+ end
60
+ end
61
+
62
+ module Source
63
+ class Range
64
+ attr_reader source_buffer: Buffer
65
+ attr_reader begin_pos: Integer
66
+ attr_reader end_pos: Integer
67
+ def begin: () -> Range
68
+ def end: () -> Range
69
+ def size: () -> Integer
70
+ alias length size
71
+ def line: () -> Integer
72
+ alias first_line line
73
+ def column: () -> Integer
74
+ def last_line: () -> Integer
75
+ def last_column: () -> Integer
76
+ def column_range: () -> ::Range[Integer]
77
+ def source_line: () -> String
78
+ def source: () -> String
79
+ def with: (?begin_pos: Integer, ?end_pos: Integer) -> Range
80
+ def adjust: (?begin_pos: Integer, ?end_pos: Integer) -> Range
81
+ def resize: (Integer new_size) -> Range
82
+ def join: (Range other) -> Range
83
+ def intersect: (Range other) -> Range?
84
+ def disjoint?: (Range other) -> bool
85
+ def overlaps?: (Range other) -> bool
86
+ def contains?: (Range other) -> bool
87
+ def contained?: (Range other) -> bool
88
+ def crossing?: (Range other) -> bool
89
+ def empty?: () -> bool
90
+ end
91
+
92
+ ##
93
+ # A buffer with source code. {Buffer} contains the source code itself,
94
+ # associated location information (name and first line), and takes care
95
+ # of encoding.
96
+ #
97
+ # A source buffer is immutable once populated.
98
+ #
99
+ # @!attribute [r] name
100
+ # Buffer name. If the buffer was created from a file, the name corresponds
101
+ # to relative path to the file.
102
+ # @return [String] buffer name
103
+ #
104
+ # @!attribute [r] first_line
105
+ # First line of the buffer, 1 by default.
106
+ # @return [Integer] first line
107
+ #
108
+ # @api public
109
+ #
110
+ class Buffer
111
+ attr_reader name: String
112
+ attr_reader first_line: Integer
113
+
114
+ def self.recognize_encoding: (String) -> Encoding
115
+ def self.reencode_string: (String) -> String
116
+
117
+ def initialize: (untyped name, ?Integer first_line, ?source: untyped) -> void
118
+ def read: () -> self
119
+ def source: () -> String
120
+ def source=: (String) -> String
121
+ def raw_source: (String) -> String
122
+ def decompose_position: (Integer) -> [Integer, Integer]
123
+ def source_lines: () -> Array[String]
124
+ def source_line: (Integer) -> String
125
+ def line_range: (Integer) -> ::Range[Integer]
126
+ def source_range: () -> ::Range[Integer]
127
+ def last_line: () -> Integer
128
+ end
129
+
130
+ class TreeRewriter
131
+ def replace: (Range range, String content) -> self
132
+ def remove: (Range range) -> self
133
+ def insert_before: (Range range, String content) -> self
134
+ def insert_after: (Range range, String content) -> self
135
+ end
136
+
137
+ class Map
138
+ attr_reader node: AST::Node | nil
139
+ attr_reader expression: Range
140
+ def line: () -> Integer
141
+ def first_line: () -> Integer
142
+ def last_line: () -> Integer
143
+ def column: () -> Integer
144
+ def last_column: () -> Integer
145
+ end
146
+
147
+ class Map::Collection < Map
148
+ attr_reader begin: Range?
149
+ attr_reader end: Range?
150
+ end
151
+
152
+ class Map::Condition < Map
153
+ attr_reader keyword: Range
154
+ attr_reader begin: Range?
155
+ attr_reader else: Range?
156
+ attr_reader end: Range
157
+ end
158
+
159
+ class Map::Heredoc < Map
160
+ attr_reader heredoc_body: Range
161
+ attr_reader heredoc_end: Range
162
+ end
163
+
164
+ class Map::Keyword < Map
165
+ attr_reader keyword: Range
166
+ attr_reader begin: Range?
167
+ attr_reader end: Range?
168
+ end
169
+
170
+ class Map::MethodDefinition < Map
171
+ attr_reader keyword: Range
172
+ attr_reader operator: Range?
173
+ attr_reader name: Range?
174
+ attr_reader end: Range?
175
+ attr_reader assignment: Range?
176
+ end
177
+
178
+ class Map::Operator < Map
179
+ attr_reader operator: Range?
180
+ end
181
+
182
+ class Map::Send < Map
183
+ attr_reader dot: Range?
184
+ attr_reader selector: Range
185
+ attr_reader operator: Range?
186
+ attr_reader begin: Range?
187
+ attr_reader end: Range?
188
+ end
189
+
190
+ class Map::Ternary < Map
191
+ attr_reader question: Range?
192
+ attr_reader colon: Range
193
+ end
194
+
195
+ class Comment
196
+ attr_reader text: String
197
+ attr_reader location: Map
198
+ alias loc location
199
+ end
200
+ end
201
+ end
@@ -0,0 +1,4 @@
1
+ module Racc
2
+ class Parser
3
+ end
4
+ end
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: thor
3
+ version: '1.2'
4
+ source:
5
+ type: git
6
+ name: ruby/gem_rbs_collection
7
+ revision: 98541aabafdf403b16ebae6fe4060d18bee75e93
8
+ remote: https://github.com/ruby/gem_rbs_collection.git
9
+ repo_dir: gems
@@ -0,0 +1,7 @@
1
+ # manifest.yaml describes dependencies which do not appear in the gemspec.
2
+ # If this gem includes such dependencies, comment-out the following lines and
3
+ # declare the dependencies.
4
+ # If all dependencies appear in the gemspec, you should remove this file.
5
+ #
6
+ # dependencies:
7
+ # - name: pathname
@@ -0,0 +1,17 @@
1
+ class Thor
2
+ class Group
3
+ end
4
+
5
+ module Actions
6
+ class CreateFile
7
+ end
8
+
9
+ def create_file: (String destination, String data, ?verbose: bool) -> String
10
+ | (String destination, ?verbose: bool) { () -> String } -> String
11
+ end
12
+
13
+ class Error
14
+ end
15
+
16
+ def self.start: (Array[String] given_args, ?Hash[Symbol, untyped] config) -> void
17
+ end
data/solargraph.gemspec CHANGED
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
2
2
  require 'solargraph/version'
3
3
  require 'date'
4
4
 
5
+ # @param s [Gem::Specification]
5
6
  Gem::Specification.new do |s|
6
7
  s.name = 'solargraph'
7
8
  s.version = Solargraph::VERSION
@@ -11,7 +12,10 @@ Gem::Specification.new do |s|
11
12
  s.authors = ["Fred Snyder"]
12
13
  s.email = 'admin@castwide.com'
13
14
  s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
14
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+ # @sg-ignore Need backtick support
16
+ # @type [String]
17
+ all_files = `git ls-files -z`
18
+ all_files.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
19
  end
16
20
  s.homepage = 'https://solargraph.org'
17
21
  s.license = 'MIT'
@@ -20,12 +24,14 @@ Gem::Specification.new do |s|
20
24
  s.metadata["bug_tracker_uri"] = "https://github.com/castwide/solargraph/issues"
21
25
  s.metadata["changelog_uri"] = "https://github.com/castwide/solargraph/blob/master/CHANGELOG.md"
22
26
  s.metadata["source_code_uri"] = "https://github.com/castwide/solargraph"
27
+ s.metadata["rubygems_mfa_required"] = "true"
23
28
 
24
29
  s.required_ruby_version = '>= 3.0'
25
30
 
31
+ s.add_runtime_dependency 'ast', '~> 2.4.3'
26
32
  s.add_runtime_dependency 'backport', '~> 1.2'
27
33
  s.add_runtime_dependency 'benchmark', '~> 0.4'
28
- s.add_runtime_dependency 'bundler', '~> 2.0'
34
+ s.add_runtime_dependency 'bundler', '>= 2.0'
29
35
  s.add_runtime_dependency 'diff-lcs', '~> 1.4'
30
36
  s.add_runtime_dependency 'jaro_winkler', '~> 1.6', '>= 1.6.1'
31
37
  s.add_runtime_dependency 'kramdown', '~> 2.3'
@@ -33,21 +39,36 @@ Gem::Specification.new do |s|
33
39
  s.add_runtime_dependency 'logger', '~> 1.6'
34
40
  s.add_runtime_dependency 'observer', '~> 0.1'
35
41
  s.add_runtime_dependency 'ostruct', '~> 0.6'
42
+ s.add_runtime_dependency 'open3', '~> 0.2.1'
36
43
  s.add_runtime_dependency 'parser', '~> 3.0'
37
44
  s.add_runtime_dependency 'prism', '~> 1.4'
38
- s.add_runtime_dependency 'rbs', '~> 3.6.1'
45
+ s.add_runtime_dependency 'rbs', ['>= 3.6.1', '<= 4.0.0.dev.4']
39
46
  s.add_runtime_dependency 'reverse_markdown', '~> 3.0'
40
- s.add_runtime_dependency 'rubocop', '~> 1.38'
47
+ s.add_runtime_dependency 'rubocop', '~> 1.76'
41
48
  s.add_runtime_dependency 'thor', '~> 1.0'
42
49
  s.add_runtime_dependency 'tilt', '~> 2.0'
43
50
  s.add_runtime_dependency 'yard', '~> 0.9', '>= 0.9.24'
44
51
  s.add_runtime_dependency 'yard-solargraph', '~> 0.1'
52
+ s.add_runtime_dependency 'yard-activesupport-concern', '~> 0.0'
45
53
 
46
54
  s.add_development_dependency 'pry', '~> 0.15'
47
55
  s.add_development_dependency 'public_suffix', '~> 3.1'
48
56
  s.add_development_dependency 'rake', '~> 13.2'
49
57
  s.add_development_dependency 'rspec', '~> 3.5'
50
- s.add_development_dependency 'simplecov', '~> 0.14'
58
+ #
59
+ # very specific development-time RuboCop version patterns for CI
60
+ # stability - feel free to update in an isolated PR
61
+ #
62
+ # even more specific on RuboCop itself, which is written into _todo
63
+ # file.
64
+ s.add_development_dependency 'rubocop', '~> 1.80.0.0'
65
+ s.add_development_dependency 'rubocop-rake', '~> 0.7.1'
66
+ s.add_development_dependency 'rubocop-rspec', '~> 3.6.0'
67
+ s.add_development_dependency 'rubocop-yard', '~> 1.0.0'
68
+ s.add_development_dependency 'simplecov', '~> 0.21'
69
+ s.add_development_dependency 'simplecov-lcov', '~> 0.8'
70
+ s.add_development_dependency 'undercover', '~> 0.7'
71
+ s.add_development_dependency 'overcommit', '~> 0.68.0'
51
72
  s.add_development_dependency 'webmock', '~> 3.6'
52
73
  # work around missing yard dependency needed as of Ruby 3.5
53
74
  s.add_development_dependency 'irb', '~> 1.15'