tapioca 0.16.7 → 0.16.8

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: 72d868353abd88ee0f1b29b098a89259e9ff1ec4248ae2a5d23f4cfa599f24b3
4
- data.tar.gz: 721b57e0409ed03b3d10571cd49c7f258afd3fdd405cf6c61dfde5d339539169
3
+ metadata.gz: c9011a32f92aa24ce99e2ae84c523d45b390925a30fe43e49c92036c06bbb33d
4
+ data.tar.gz: 46e11aa96fc7cb29053f33d2c4a5bc79760d315801f6ba06296e57703bd6d2e6
5
5
  SHA512:
6
- metadata.gz: 8fab73b06ace7ab4c6efab4ac0d0b9566d629f4f02bbce249d8b786136c89212f2e35087402067a984b2ac40e29b8ea26aa4aa1f9caf0d543fbdee6938f87a68
7
- data.tar.gz: '07609a1bd007962ff193ae2bdd2d1cf8c97b0504d4d3c0932697f45fd134833ddefca9197dc280a816598ee573ad2c4f0c314f1131929eea1a15e6eda3546b3c'
6
+ metadata.gz: b6d5161d0b4301d62c544cebe5d923867f2530dceb67864a945000998d4eac78737e3ee5eb5ac213b61a7dc00e5e88e92739dcf2fafff900badffdacc8d49315
7
+ data.tar.gz: 4f8a54219803ed296644fa9e6fb5312ed7dc7ba57c7f9b89b2bb8a6e25a71920834ed5a0d0d905bc8f1fe26dbcd1a1257bb5d6e203d41ee87adc7d44f5726171
@@ -45,6 +45,11 @@ module RubyLsp
45
45
  @rails_runner_client = addon.rails_runner_client
46
46
  @outgoing_queue << Notification.window_log_message("Activating Tapioca add-on v#{version}")
47
47
  @rails_runner_client.register_server_addon(File.expand_path("server_addon.rb", __dir__))
48
+ @rails_runner_client.delegate_notification(
49
+ server_addon_name: "Tapioca",
50
+ request_name: "load_compilers_and_extensions",
51
+ workspace_path: @global_state.workspace_path,
52
+ )
48
53
  rescue IncompatibleApiError
49
54
  # The requested version for the Rails add-on no longer matches. We need to upgrade and fix the breaking
50
55
  # changes
@@ -12,6 +12,15 @@ module RubyLsp
12
12
 
13
13
  def execute(request, params)
14
14
  case request
15
+ when "load_compilers_and_extensions"
16
+ # Load DSL extensions and compilers ahead of time, so that we don't have to pay the price of invoking
17
+ # `Gem.find_files` on every execution, which is quite expensive
18
+ ::Tapioca::Loaders::Dsl.new(
19
+ tapioca_path: ::Tapioca::TAPIOCA_DIR,
20
+ eager_load: false,
21
+ app_root: params[:workspace_path],
22
+ halt_upon_load_error: false,
23
+ ).load_dsl_extensions_and_compilers
15
24
  when "dsl"
16
25
  fork do
17
26
  dsl(params)
@@ -118,12 +118,14 @@ module Tapioca
118
118
 
119
119
  sig { void }
120
120
  def load_application
121
+ # Loaded ahead of time when using the add-on to avoid reloading multiple times
122
+ return if @lsp_addon
123
+
121
124
  Loaders::Dsl.load_application(
122
125
  tapioca_path: @tapioca_path,
123
126
  eager_load: @requested_constants.empty? && @requested_paths.empty?,
124
127
  app_root: @app_root,
125
128
  halt_upon_load_error: @halt_upon_load_error,
126
- lsp_addon: @lsp_addon,
127
129
  )
128
130
  end
129
131
 
@@ -372,7 +372,12 @@ module Tapioca
372
372
  return_type: "T.self_type",
373
373
  )
374
374
 
375
- (CALCULATION_METHODS + [:size]).each do |method_name|
375
+ klass.create_method(
376
+ "size",
377
+ return_type: "Integer",
378
+ )
379
+
380
+ CALCULATION_METHODS.each do |method_name|
376
381
  case method_name
377
382
  when :average, :maximum, :minimum
378
383
  klass.create_method(
@@ -400,9 +405,9 @@ module Tapioca
400
405
  ],
401
406
  return_type: "T::Hash[T.untyped, Integer]",
402
407
  )
403
- when :sum, :size
408
+ when :sum
404
409
  klass.create_method(
405
- method_name.to_s,
410
+ "sum",
406
411
  parameters: [
407
412
  create_opt_param("column_name", type: "T.nilable(T.any(String, Symbol))", default: "nil"),
408
413
  create_block_param("block", type: "T.nilable(T.proc.params(record: T.untyped).returns(T.untyped))"),
@@ -216,6 +216,11 @@ module Tapioca
216
216
  ActiveRecord::Locking::LockingType === type
217
217
  }
218
218
  as_non_nilable_if_persisted_and_not_nullable("::Integer", column_nullability:)
219
+ when ->(type) {
220
+ defined?(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Enum) &&
221
+ ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Enum === type
222
+ }
223
+ "::String"
219
224
  else
220
225
  as_non_nilable_if_persisted_and_not_nullable(
221
226
  ActiveModelTypeHelper.type_for(column_type),
@@ -15,27 +15,20 @@ module Tapioca
15
15
  eager_load: T::Boolean,
16
16
  app_root: String,
17
17
  halt_upon_load_error: T::Boolean,
18
- lsp_addon: T::Boolean,
19
18
  ).void
20
19
  end
21
20
  def load_application(
22
21
  tapioca_path:,
23
22
  eager_load: true,
24
23
  app_root: ".",
25
- halt_upon_load_error: true,
26
- lsp_addon: false
24
+ halt_upon_load_error: true
27
25
  )
28
- loader = new(
26
+ new(
29
27
  tapioca_path: tapioca_path,
30
28
  eager_load: eager_load,
31
29
  app_root: app_root,
32
30
  halt_upon_load_error: halt_upon_load_error,
33
- )
34
- if lsp_addon
35
- loader.load_dsl_extensions_and_compilers
36
- else
37
- loader.load
38
- end
31
+ ).load
39
32
  end
40
33
  end
41
34
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Tapioca
5
- VERSION = "0.16.7"
5
+ VERSION = "0.16.8"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapioca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.7
4
+ version: 0.16.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu
@@ -10,7 +10,7 @@ authors:
10
10
  - Peter Zhu
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2025-01-09 00:00:00.000000000 Z
13
+ date: 2025-01-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: benchmark