spoom 1.7.12 → 1.7.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5cf816e6ecd86209b75a94d71474288762d94b97da6e6637f2b67bb80c5fcf0
4
- data.tar.gz: fafeb36ec7993a9632dfa0e7c1b47b7e671122e2e0a89358b1c1ab86dd611aca
3
+ metadata.gz: 7e36809d27f631413357c7b2287d7c51de3b8ed7d17ed7da03d4943bed071b23
4
+ data.tar.gz: b299e3da2929b3a80b1466566e22b207ddceeab71f8ee98ccbc85d259f39fcf8
5
5
  SHA512:
6
- metadata.gz: a28c07c9f9ddbd22a754d6f4619696d6a82caa6f8b355dd99fc90b27c42c14b8bbb4377e433ad593b7133fffe8397fa929c75e9d309dd9499a7aa105b2126fcb
7
- data.tar.gz: a098d8d9fba5cef4988d5e3e5fdc01493beec8c3ddd3a75e1b78353570872d447ab82f47a83d2cc3192b6f3699a7409f45b848e29d373eee03d273647e0afacf
6
+ metadata.gz: c39b635f9e3b26ca6bfa42ae4d89758d83e7f5c06bc4b7e263dae5f6b3b3debd7845e6cf90fdf54b854b1a8019957bc662dc36a05f2e560f6bb7e65a0dc224ba
7
+ data.tar.gz: f1ec06e214fc1f98ceb3915d659fe745951515e2edbd16219ebe1f77cb4d3ab79a28409b352dc35f92f9c9dbe85dcf176e696d7b1d48eae7bd665f21f12f997e
@@ -149,6 +149,7 @@ module Spoom
149
149
 
150
150
  #{Spoom::BundlerHelper.gem_requirement_from_real_bundle("rbs")}
151
151
  #{Spoom::BundlerHelper.gem_requirement_from_real_bundle("tapioca")}
152
+ #{Spoom::BundlerHelper.gem_requirement_from_real_bundle("sorbet-static-and-runtime")}
152
153
 
153
154
  gem "#{spec.name}", path: "#{copy_context.absolute_path}"
154
155
  GEMFILE
@@ -15,7 +15,7 @@ module Spoom
15
15
  config = context.sorbet_config
16
16
  config.allowed_extensions.push(".rb", ".rbi") if config.allowed_extensions.empty?
17
17
 
18
- new_config = config.copy
18
+ new_config = config.dup
19
19
  new_config.allowed_extensions.reject! { |ext| !rbi && ext == ".rbi" }
20
20
  flags = [
21
21
  "--no-config",
@@ -33,6 +33,12 @@ module Spoom
33
33
  if last_arg.is_a?(Prism::SymbolNode) || last_arg.is_a?(Prism::StringNode)
34
34
  @index.reference_method(last_arg.unescaped, send.location)
35
35
  end
36
+ when "dup"
37
+ @index.reference_method("initialize_dup", send.location)
38
+ @index.reference_method("initialize_copy", send.location)
39
+ when "clone"
40
+ @index.reference_method("initialize_clone", send.location)
41
+ @index.reference_method("initialize_copy", send.location)
36
42
  when "method"
37
43
  arg = send.args.first
38
44
  @index.reference_method(arg.unescaped, send.location) if arg.is_a?(Prism::SymbolNode)
@@ -40,14 +40,12 @@ module Spoom
40
40
  @no_stdlib = false #: bool
41
41
  end
42
42
 
43
- #: -> Config
44
- def copy
45
- new_config = Sorbet::Config.new
46
- new_config.paths.concat(@paths)
47
- new_config.ignore.concat(@ignore)
48
- new_config.allowed_extensions.concat(@allowed_extensions)
49
- new_config.no_stdlib = @no_stdlib
50
- new_config
43
+ #: (Config source) -> void
44
+ def initialize_copy(source)
45
+ super
46
+ @paths = @paths.dup
47
+ @ignore = @ignore.dup
48
+ @allowed_extensions = @allowed_extensions.dup
51
49
  end
52
50
 
53
51
  # Returns self as a string of options that can be passed to Sorbet
@@ -107,8 +105,8 @@ module Spoom
107
105
  when /^--dir=/
108
106
  config.paths << parse_option(line)
109
107
  next
110
- when /^--no-stdlib$/
111
- config.no_stdlib = true
108
+ when /^--no-stdlib(=|$)/
109
+ config.no_stdlib = parse_bool_option(line)
112
110
  next
113
111
  when /^--.*=/
114
112
  next
@@ -143,6 +141,17 @@ module Spoom
143
141
  def parse_option(line)
144
142
  T.must(line.split("=").last).strip
145
143
  end
144
+
145
+ #: (String line) -> bool
146
+ def parse_bool_option(line)
147
+ return true unless line.include?("=") # `--foo` is equivalent to `--foo=true`
148
+
149
+ case parse_option(line)
150
+ when "true", "True", "t", "T", "1" then true
151
+ when "false", "False", "f", "F", "0" then false
152
+ else raise ArgumentError, "invalid boolean value: #{parse_option(line).inspect}"
153
+ end
154
+ end
146
155
  end
147
156
  end
148
157
  end
@@ -13,35 +13,6 @@ module Spoom
13
13
  def accept_printer(printer) = raise NotImplementedError, "Abstract method called"
14
14
  end
15
15
 
16
- class Hover < T::Struct
17
- include PrintableSymbol
18
-
19
- const :contents, String
20
- const :range, T.nilable(Range)
21
-
22
- class << self
23
- #: (Hash[untyped, untyped] json) -> Hover
24
- def from_json(json)
25
- Hover.new(
26
- contents: json["contents"]["value"],
27
- range: json["range"] ? Range.from_json(json["range"]) : nil,
28
- )
29
- end
30
- end
31
-
32
- # @override
33
- #: (SymbolPrinter printer) -> void
34
- def accept_printer(printer)
35
- printer.print("#{contents}\n")
36
- printer.print_object(range) if range
37
- end
38
-
39
- #: -> String
40
- def to_s
41
- "#{contents} (#{range})."
42
- end
43
- end
44
-
45
16
  class Position < T::Struct
46
17
  include PrintableSymbol
47
18
 
@@ -100,6 +71,35 @@ module Spoom
100
71
  end
101
72
  end
102
73
 
74
+ class Hover < T::Struct
75
+ include PrintableSymbol
76
+
77
+ const :contents, String
78
+ const :range, T.nilable(Range)
79
+
80
+ class << self
81
+ #: (Hash[untyped, untyped] json) -> Hover
82
+ def from_json(json)
83
+ Hover.new(
84
+ contents: json["contents"]["value"],
85
+ range: json["range"] ? Range.from_json(json["range"]) : nil,
86
+ )
87
+ end
88
+ end
89
+
90
+ # @override
91
+ #: (SymbolPrinter printer) -> void
92
+ def accept_printer(printer)
93
+ printer.print("#{contents}\n")
94
+ printer.print_object(range) if range
95
+ end
96
+
97
+ #: -> String
98
+ def to_s
99
+ "#{contents} (#{range})."
100
+ end
101
+ end
102
+
103
103
  class Location < T::Struct
104
104
  include PrintableSymbol
105
105
 
@@ -305,7 +305,7 @@ module Spoom
305
305
  end
306
306
 
307
307
  if sigs.any? { |_, sig| sig.is_overridable }
308
- @rewriter << Source::Insert.new(insert_pos, "# @overridable\n")
308
+ @rewriter << Source::Insert.new(insert_pos, "# @overridable\n#{indent}")
309
309
  end
310
310
  end
311
311
 
data/lib/spoom/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Spoom
5
- VERSION = "1.7.12"
5
+ VERSION = "1.7.14"
6
6
  end
data/rbi/spoom.rbi CHANGED
@@ -1836,7 +1836,7 @@ class Spoom::LSP::Hover < ::T::Struct
1836
1836
  include ::Spoom::LSP::PrintableSymbol
1837
1837
 
1838
1838
  const :contents, ::String
1839
- const :range, T.nilable(T::Range[T.untyped])
1839
+ const :range, T.nilable(::Spoom::LSP::Range)
1840
1840
 
1841
1841
  sig { override.params(printer: ::Spoom::LSP::SymbolPrinter).void }
1842
1842
  def accept_printer(printer); end
@@ -2603,10 +2603,6 @@ class Spoom::Sorbet::Config
2603
2603
 
2604
2604
  def allowed_extensions; end
2605
2605
  def allowed_extensions=(_arg0); end
2606
-
2607
- sig { returns(::Spoom::Sorbet::Config) }
2608
- def copy; end
2609
-
2610
2606
  def ignore; end
2611
2607
  def ignore=(_arg0); end
2612
2608
 
@@ -2623,6 +2619,11 @@ class Spoom::Sorbet::Config
2623
2619
 
2624
2620
  def paths=(_arg0); end
2625
2621
 
2622
+ private
2623
+
2624
+ sig { params(source: ::Spoom::Sorbet::Config).void }
2625
+ def initialize_copy(source); end
2626
+
2626
2627
  class << self
2627
2628
  sig { params(sorbet_config_path: ::String).returns(::Spoom::Sorbet::Config) }
2628
2629
  def parse_file(sorbet_config_path); end
@@ -2632,6 +2633,9 @@ class Spoom::Sorbet::Config
2632
2633
 
2633
2634
  private
2634
2635
 
2636
+ sig { params(line: ::String).returns(T::Boolean) }
2637
+ def parse_bool_option(line); end
2638
+
2635
2639
  sig { params(line: ::String).returns(::String) }
2636
2640
  def parse_option(line); end
2637
2641
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.12
4
+ version: 1.7.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandre Terrasa
@@ -43,14 +43,14 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 13.3.0
46
+ version: 13.4.2
47
47
  type: :development
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 13.3.0
53
+ version: 13.4.2
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: erubi
56
56
  requirement: !ruby/object:Gem::Requirement