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 +4 -4
- data/lib/ruby_lsp/tapioca/addon.rb +5 -0
- data/lib/ruby_lsp/tapioca/server_addon.rb +9 -0
- data/lib/tapioca/commands/abstract_dsl.rb +3 -1
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +8 -3
- data/lib/tapioca/dsl/helpers/active_record_column_type_helper.rb +5 -0
- data/lib/tapioca/loaders/dsl.rb +3 -10
- data/lib/tapioca/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9011a32f92aa24ce99e2ae84c523d45b390925a30fe43e49c92036c06bbb33d
|
4
|
+
data.tar.gz: 46e11aa96fc7cb29053f33d2c4a5bc79760d315801f6ba06296e57703bd6d2e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
(
|
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
|
408
|
+
when :sum
|
404
409
|
klass.create_method(
|
405
|
-
|
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),
|
data/lib/tapioca/loaders/dsl.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/tapioca/version.rb
CHANGED
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.
|
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-
|
13
|
+
date: 2025-01-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: benchmark
|