solargraph 0.54.4 → 0.57.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 (178) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +125 -0
  3. data/.github/workflows/plugins.yml +149 -5
  4. data/.github/workflows/rspec.yml +39 -4
  5. data/.github/workflows/typecheck.yml +8 -3
  6. data/.gitignore +7 -0
  7. data/.overcommit.yml +72 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +66 -0
  10. data/.rubocop_todo.yml +2627 -0
  11. data/.yardopts +1 -0
  12. data/CHANGELOG.md +104 -0
  13. data/README.md +20 -6
  14. data/Rakefile +125 -13
  15. data/lib/solargraph/api_map/cache.rb +3 -2
  16. data/lib/solargraph/api_map/constants.rb +218 -0
  17. data/lib/solargraph/api_map/index.rb +44 -42
  18. data/lib/solargraph/api_map/source_to_yard.rb +10 -4
  19. data/lib/solargraph/api_map/store.rb +165 -32
  20. data/lib/solargraph/api_map.rb +319 -243
  21. data/lib/solargraph/bench.rb +18 -1
  22. data/lib/solargraph/complex_type/type_methods.rb +7 -1
  23. data/lib/solargraph/complex_type/unique_type.rb +105 -16
  24. data/lib/solargraph/complex_type.rb +40 -7
  25. data/lib/solargraph/convention/active_support_concern.rb +111 -0
  26. data/lib/solargraph/convention/base.rb +20 -3
  27. data/lib/solargraph/convention/data_definition/data_assignment_node.rb +61 -0
  28. data/lib/solargraph/convention/data_definition/data_definition_node.rb +91 -0
  29. data/lib/solargraph/convention/data_definition.rb +105 -0
  30. data/lib/solargraph/convention/gemspec.rb +3 -2
  31. data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +61 -0
  32. data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +102 -0
  33. data/lib/solargraph/convention/struct_definition.rb +164 -0
  34. data/lib/solargraph/convention.rb +35 -4
  35. data/lib/solargraph/diagnostics/rubocop.rb +6 -1
  36. data/lib/solargraph/diagnostics/rubocop_helpers.rb +1 -1
  37. data/lib/solargraph/doc_map.rb +313 -65
  38. data/lib/solargraph/environ.rb +9 -2
  39. data/lib/solargraph/gem_pins.rb +60 -38
  40. data/lib/solargraph/language_server/host/dispatch.rb +2 -0
  41. data/lib/solargraph/language_server/host/message_worker.rb +13 -7
  42. data/lib/solargraph/language_server/host.rb +14 -3
  43. data/lib/solargraph/language_server/message/base.rb +2 -1
  44. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +2 -0
  45. data/lib/solargraph/language_server/message/extended/document.rb +5 -2
  46. data/lib/solargraph/language_server/message/extended/document_gems.rb +3 -3
  47. data/lib/solargraph/language_server/message/text_document/definition.rb +2 -0
  48. data/lib/solargraph/language_server/message/text_document/formatting.rb +16 -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 +1 -0
  53. data/lib/solargraph/library.rb +53 -32
  54. data/lib/solargraph/location.rb +23 -0
  55. data/lib/solargraph/logging.rb +12 -2
  56. data/lib/solargraph/page.rb +4 -0
  57. data/lib/solargraph/parser/comment_ripper.rb +20 -7
  58. data/lib/solargraph/parser/flow_sensitive_typing.rb +255 -0
  59. data/lib/solargraph/parser/node_methods.rb +16 -2
  60. data/lib/solargraph/parser/node_processor/base.rb +10 -5
  61. data/lib/solargraph/parser/node_processor.rb +26 -9
  62. data/lib/solargraph/parser/parser_gem/class_methods.rb +17 -15
  63. data/lib/solargraph/parser/parser_gem/flawed_builder.rb +1 -0
  64. data/lib/solargraph/parser/parser_gem/node_chainer.rb +13 -11
  65. data/lib/solargraph/parser/parser_gem/node_methods.rb +8 -4
  66. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +2 -1
  67. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +21 -0
  68. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +4 -2
  69. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +7 -4
  70. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +2 -1
  71. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +2 -1
  72. data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +6 -3
  73. data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +2 -1
  74. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +2 -1
  75. data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +23 -0
  76. data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +4 -2
  77. data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +2 -1
  78. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +7 -1
  79. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +8 -7
  80. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +42 -0
  81. data/lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb +1 -0
  82. data/lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb +3 -1
  83. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +4 -3
  84. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +63 -30
  85. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +3 -1
  86. data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +29 -0
  87. data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +29 -0
  88. data/lib/solargraph/parser/parser_gem/node_processors.rb +14 -0
  89. data/lib/solargraph/parser/region.rb +4 -1
  90. data/lib/solargraph/parser/snippet.rb +2 -0
  91. data/lib/solargraph/parser.rb +1 -0
  92. data/lib/solargraph/pin/base.rb +360 -30
  93. data/lib/solargraph/pin/base_variable.rb +16 -10
  94. data/lib/solargraph/pin/block.rb +2 -0
  95. data/lib/solargraph/pin/breakable.rb +9 -0
  96. data/lib/solargraph/pin/callable.rb +83 -3
  97. data/lib/solargraph/pin/closure.rb +20 -1
  98. data/lib/solargraph/pin/common.rb +10 -1
  99. data/lib/solargraph/pin/constant.rb +2 -0
  100. data/lib/solargraph/pin/delegated_method.rb +21 -1
  101. data/lib/solargraph/pin/documenting.rb +16 -0
  102. data/lib/solargraph/pin/keyword.rb +7 -2
  103. data/lib/solargraph/pin/local_variable.rb +18 -6
  104. data/lib/solargraph/pin/method.rb +175 -46
  105. data/lib/solargraph/pin/method_alias.rb +3 -0
  106. data/lib/solargraph/pin/namespace.rb +17 -9
  107. data/lib/solargraph/pin/parameter.rb +78 -19
  108. data/lib/solargraph/pin/proxy_type.rb +13 -6
  109. data/lib/solargraph/pin/reference/override.rb +24 -6
  110. data/lib/solargraph/pin/reference/require.rb +2 -2
  111. data/lib/solargraph/pin/reference/superclass.rb +5 -0
  112. data/lib/solargraph/pin/reference.rb +26 -0
  113. data/lib/solargraph/pin/search.rb +3 -1
  114. data/lib/solargraph/pin/signature.rb +44 -0
  115. data/lib/solargraph/pin/singleton.rb +1 -1
  116. data/lib/solargraph/pin/symbol.rb +8 -2
  117. data/lib/solargraph/pin/until.rb +18 -0
  118. data/lib/solargraph/pin/while.rb +18 -0
  119. data/lib/solargraph/pin.rb +4 -1
  120. data/lib/solargraph/pin_cache.rb +245 -0
  121. data/lib/solargraph/position.rb +11 -0
  122. data/lib/solargraph/range.rb +10 -0
  123. data/lib/solargraph/rbs_map/conversions.rb +226 -70
  124. data/lib/solargraph/rbs_map/core_fills.rb +32 -16
  125. data/lib/solargraph/rbs_map/core_map.rb +37 -11
  126. data/lib/solargraph/rbs_map/stdlib_map.rb +15 -5
  127. data/lib/solargraph/rbs_map.rb +88 -18
  128. data/lib/solargraph/shell.rb +20 -18
  129. data/lib/solargraph/source/chain/array.rb +11 -7
  130. data/lib/solargraph/source/chain/block_symbol.rb +1 -1
  131. data/lib/solargraph/source/chain/block_variable.rb +1 -1
  132. data/lib/solargraph/source/chain/call.rb +53 -23
  133. data/lib/solargraph/source/chain/constant.rb +1 -1
  134. data/lib/solargraph/source/chain/hash.rb +4 -3
  135. data/lib/solargraph/source/chain/head.rb +1 -1
  136. data/lib/solargraph/source/chain/if.rb +1 -1
  137. data/lib/solargraph/source/chain/link.rb +12 -1
  138. data/lib/solargraph/source/chain/literal.rb +22 -2
  139. data/lib/solargraph/source/chain/or.rb +1 -1
  140. data/lib/solargraph/source/chain/z_super.rb +1 -1
  141. data/lib/solargraph/source/chain.rb +84 -47
  142. data/lib/solargraph/source/change.rb +2 -2
  143. data/lib/solargraph/source/cursor.rb +2 -3
  144. data/lib/solargraph/source/source_chainer.rb +3 -3
  145. data/lib/solargraph/source.rb +5 -2
  146. data/lib/solargraph/source_map/clip.rb +4 -2
  147. data/lib/solargraph/source_map/data.rb +4 -0
  148. data/lib/solargraph/source_map/mapper.rb +13 -7
  149. data/lib/solargraph/source_map.rb +21 -31
  150. data/lib/solargraph/type_checker/checks.rb +4 -0
  151. data/lib/solargraph/type_checker/param_def.rb +2 -0
  152. data/lib/solargraph/type_checker/rules.rb +8 -0
  153. data/lib/solargraph/type_checker.rb +208 -128
  154. data/lib/solargraph/version.rb +1 -1
  155. data/lib/solargraph/views/_method.erb +10 -10
  156. data/lib/solargraph/views/_namespace.erb +3 -3
  157. data/lib/solargraph/views/document.erb +10 -10
  158. data/lib/solargraph/workspace/config.rb +1 -3
  159. data/lib/solargraph/workspace/require_paths.rb +98 -0
  160. data/lib/solargraph/workspace.rb +38 -52
  161. data/lib/solargraph/yard_map/helpers.rb +29 -1
  162. data/lib/solargraph/yard_map/mapper/to_constant.rb +7 -5
  163. data/lib/solargraph/yard_map/mapper/to_method.rb +53 -18
  164. data/lib/solargraph/yard_map/mapper/to_namespace.rb +9 -7
  165. data/lib/solargraph/yard_map/mapper.rb +4 -3
  166. data/lib/solargraph/yard_map/to_method.rb +4 -2
  167. data/lib/solargraph/yardoc.rb +22 -10
  168. data/lib/solargraph.rb +34 -1
  169. data/rbs/fills/tuple.rbs +149 -0
  170. data/rbs_collection.yaml +19 -0
  171. data/sig/shims/parser/3.2.0.1/builders/default.rbs +195 -0
  172. data/sig/shims/thor/1.2.0.1/.rbs_meta.yaml +9 -0
  173. data/sig/shims/thor/1.2.0.1/manifest.yaml +7 -0
  174. data/sig/shims/thor/1.2.0.1/thor.rbs +17 -0
  175. data/solargraph.gemspec +15 -4
  176. metadata +157 -15
  177. data/lib/.rubocop.yml +0 -22
  178. data/lib/solargraph/cache.rb +0 -77
@@ -0,0 +1,149 @@
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
+ | (int index) -> nil
49
+
50
+ # <!--
51
+ # rdoc-file=array.c
52
+ # - at(index) -> object or nil
53
+ # -->
54
+ # Returns the element of `self` specified by the given `index` or `nil` if there
55
+ # is no such element; `index` must be an [integer-convertible
56
+ # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
57
+ #
58
+ # For non-negative `index`, returns the element of `self` at offset `index`:
59
+ #
60
+ # a = [:foo, 'bar', 2]
61
+ # a.at(0) # => :foo
62
+ # a.at(2) # => 2
63
+ # a.at(2.0) # => 2
64
+ #
65
+ # Related: Array#[]; see also [Methods for
66
+ # Fetching](rdoc-ref:Array@Methods+for+Fetching).
67
+ #
68
+ def at: (0 index) -> A
69
+ | (1 index) -> B
70
+ | (2 index) -> C
71
+ | (3 index) -> D
72
+ | (4 index) -> E
73
+ | (5 index) -> F
74
+ | (6 index) -> G
75
+ | (7 index) -> H
76
+ | (8 index) -> I
77
+ | (9 index) -> J
78
+ | (int index) -> nil
79
+
80
+ # <!--
81
+ # rdoc-file=array.c
82
+ # - fetch(index) -> element
83
+ # - fetch(index, default_value) -> element or default_value
84
+ # - fetch(index) {|index| ... } -> element or block_return_value
85
+ # -->
86
+ # Returns the element of `self` at offset `index` if `index` is in range;
87
+ # `index` must be an [integer-convertible
88
+ # object](rdoc-ref:implicit_conversion.rdoc@Integer-Convertible+Objects).
89
+ #
90
+ # With the single argument `index` and no block, returns the element at offset
91
+ # `index`:
92
+ #
93
+ # a = [:foo, 'bar', 2]
94
+ # a.fetch(1) # => "bar"
95
+ # a.fetch(1.1) # => "bar"
96
+ #
97
+ # With arguments `index` and `default_value` (which may be any object) and no
98
+ # block, returns `default_value` if `index` is out-of-range:
99
+ #
100
+ # a = [:foo, 'bar', 2]
101
+ # a.fetch(1, nil) # => "bar"
102
+ # a.fetch(3, :foo) # => :foo
103
+ #
104
+ # With argument `index` and a block, returns the element at offset `index` if
105
+ # index is in range (and the block is not called); otherwise calls the block
106
+ # with index and returns its return value:
107
+ #
108
+ # a = [:foo, 'bar', 2]
109
+ # a.fetch(1) {|index| raise 'Cannot happen' } # => "bar"
110
+ # a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"
111
+ #
112
+ # Related: see [Methods for Fetching](rdoc-ref:Array@Methods+for+Fetching).
113
+ #
114
+ def fetch: (0 index) -> A
115
+ | (1 index) -> B
116
+ | (2 index) -> C
117
+ | (3 index) -> D
118
+ | (4 index) -> E
119
+ | (5 index) -> F
120
+ | (6 index) -> G
121
+ | (7 index) -> H
122
+ | (8 index) -> I
123
+ | (9 index) -> J
124
+ | (int index) -> void
125
+ | [T] (0 index, T default) -> (A | T)
126
+ | [T] (1 index, T default) -> (B | T)
127
+ | [T] (2 index, T default) -> (C | T)
128
+ | [T] (3 index, T default) -> (D | T)
129
+ | [T] (4 index, T default) -> (E | T)
130
+ | [T] (5 index, T default) -> (F | T)
131
+ | [T] (6 index, T default) -> (G | T)
132
+ | [T] (7 index, T default) -> (H | T)
133
+ | [T] (8 index, T default) -> (I | T)
134
+ | [T] (9 index, T default) -> (J | T)
135
+ | [T] (int index, T default) -> (A | B | C | D | E | F | G | H | I | J | T)
136
+ | [T] (0 index) { (int index) -> T } -> (A | T)
137
+ | [T] (1 index) { (int index) -> T } -> (B | T)
138
+ | [T] (2 index) { (int index) -> T } -> (C | T)
139
+ | [T] (3 index) { (int index) -> T } -> (D | T)
140
+ | [T] (4 index) { (int index) -> T } -> (E | T)
141
+ | [T] (5 index) { (int index) -> T } -> (F | T)
142
+ | [T] (6 index) { (int index) -> T } -> (G | T)
143
+ | [T] (7 index) { (int index) -> T } -> (H | T)
144
+ | [T] (8 index) { (int index) -> T } -> (I | T)
145
+ | [T] (9 index) { (int index) -> T } -> (J | T)
146
+ | [T] (int index) { (int index) -> T } -> (A | B | C | D | E | F | G | H | I | J | T)
147
+ end
148
+ end
149
+ end
@@ -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
@@ -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,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
@@ -11,7 +11,10 @@ Gem::Specification.new do |s|
11
11
  s.authors = ["Fred Snyder"]
12
12
  s.email = 'admin@castwide.com'
13
13
  s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
14
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
14
+ # @sg-ignore Need backtick support
15
+ # @type [String]
16
+ all_files = `git ls-files -z`
17
+ all_files.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
18
  end
16
19
  s.homepage = 'https://solargraph.org'
17
20
  s.license = 'MIT'
@@ -34,19 +37,27 @@ Gem::Specification.new do |s|
34
37
  s.add_runtime_dependency 'observer', '~> 0.1'
35
38
  s.add_runtime_dependency 'ostruct', '~> 0.6'
36
39
  s.add_runtime_dependency 'parser', '~> 3.0'
37
- s.add_runtime_dependency 'rbs', '~> 3.3'
40
+ s.add_runtime_dependency 'prism', '~> 1.4'
41
+ s.add_runtime_dependency 'rbs', ['>= 3.6.1', '<= 4.0.0.dev.4']
38
42
  s.add_runtime_dependency 'reverse_markdown', '~> 3.0'
39
- s.add_runtime_dependency 'rubocop', '~> 1.38'
43
+ s.add_runtime_dependency 'rubocop', '~> 1.76'
40
44
  s.add_runtime_dependency 'thor', '~> 1.0'
41
45
  s.add_runtime_dependency 'tilt', '~> 2.0'
42
46
  s.add_runtime_dependency 'yard', '~> 0.9', '>= 0.9.24'
43
47
  s.add_runtime_dependency 'yard-solargraph', '~> 0.1'
48
+ s.add_runtime_dependency 'yard-activesupport-concern', '~> 0.0'
44
49
 
45
50
  s.add_development_dependency 'pry', '~> 0.15'
46
51
  s.add_development_dependency 'public_suffix', '~> 3.1'
47
52
  s.add_development_dependency 'rake', '~> 13.2'
48
53
  s.add_development_dependency 'rspec', '~> 3.5'
49
- s.add_development_dependency 'simplecov', '~> 0.14'
54
+ s.add_development_dependency 'rubocop-rake', '~> 0.7'
55
+ s.add_development_dependency 'rubocop-rspec', '~> 3.6'
56
+ s.add_development_dependency 'rubocop-yard', '~> 1.0'
57
+ s.add_development_dependency 'simplecov', '~> 0.21'
58
+ s.add_development_dependency 'simplecov-lcov', '~> 0.8'
59
+ s.add_development_dependency 'undercover', '~> 0.7'
60
+ s.add_development_dependency 'overcommit', '~> 0.68.0'
50
61
  s.add_development_dependency 'webmock', '~> 3.6'
51
62
  # work around missing yard dependency needed as of Ruby 3.5
52
63
  s.add_development_dependency 'irb', '~> 1.15'