tapioca 0.17.4 → 0.17.6
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/server_addon.rb +9 -7
- data/lib/tapioca/dsl/compilers/active_record_delegated_types.rb +1 -1
- data/lib/tapioca/dsl/compilers/active_record_relations.rb +9 -1
- data/lib/tapioca/dsl/compilers/smart_properties.rb +20 -16
- data/lib/tapioca/rbs/rewriter.rb +1 -1
- data/lib/tapioca/sorbet_ext/name_patch.rb +1 -1
- data/lib/tapioca/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcd84d6187e59dc5b8e2a824d4e9e82182c242710a030fec89393e2c10f4419c
|
4
|
+
data.tar.gz: 4e92febe4971b06ac111faa2a544fc404a3b6f718734ac0c06cec97ee631e24e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a8b2f9f6b3b69bd3241d5a0503cbf1866288e9dc92c821d410e031bcd91fcf801e003dd54036a1cd6552708d997f0ffb8c989eb5f033758412dca85c7d358e
|
7
|
+
data.tar.gz: 05101b64f9d9dab404aea76bf51c9966626efaf024ac31a07a181cdcc9cc276e6175f1e0824c8e4724b0795c36130adec8509d960b40eba39b97533fa89dba0c
|
@@ -19,13 +19,15 @@ module RubyLsp
|
|
19
19
|
when "load_compilers_and_extensions"
|
20
20
|
# Load DSL extensions and compilers ahead of time, so that we don't have to pay the price of invoking
|
21
21
|
# `Gem.find_files` on every execution, which is quite expensive
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
with_notification_wrapper("load_compilers_and_extensions", "Loading DSL compilers") do
|
23
|
+
@loader = ::Tapioca::Loaders::Dsl.new(
|
24
|
+
tapioca_path: ::Tapioca::TAPIOCA_DIR,
|
25
|
+
eager_load: false,
|
26
|
+
app_root: params[:workspace_path],
|
27
|
+
halt_upon_load_error: false,
|
28
|
+
)
|
29
|
+
@loader.load_dsl_extensions_and_compilers
|
30
|
+
end
|
29
31
|
when "dsl"
|
30
32
|
fork do
|
31
33
|
with_notification_wrapper("dsl", "Generating DSL RBIs") do
|
@@ -116,7 +116,7 @@ module Tapioca
|
|
116
116
|
mod.create_method(
|
117
117
|
"build_#{role}",
|
118
118
|
parameters: [create_rest_param("args", type: "T.untyped")],
|
119
|
-
return_type: "T.any(#{types.join(", ")})",
|
119
|
+
return_type: types.size == 1 ? types.first : "T.any(#{types.join(", ")})",
|
120
120
|
)
|
121
121
|
end
|
122
122
|
|
@@ -836,7 +836,15 @@ module Tapioca
|
|
836
836
|
end
|
837
837
|
end
|
838
838
|
when :ids
|
839
|
-
|
839
|
+
if constant.table_exists?
|
840
|
+
primary_key_type = constant.type_for_attribute(constant.primary_key)
|
841
|
+
type = Tapioca::Dsl::Helpers::ActiveModelTypeHelper.type_for(primary_key_type)
|
842
|
+
type = RBIHelper.as_non_nilable_type(type)
|
843
|
+
create_common_method("ids", return_type: "T::Array[#{type}]")
|
844
|
+
else
|
845
|
+
create_common_method("ids", return_type: "Array")
|
846
|
+
end
|
847
|
+
|
840
848
|
when :pick, :pluck
|
841
849
|
create_common_method(
|
842
850
|
method_name,
|
@@ -29,29 +29,33 @@ module Tapioca
|
|
29
29
|
# # post.rbi
|
30
30
|
# # typed: true
|
31
31
|
# class Post
|
32
|
-
#
|
33
|
-
# def title; end
|
32
|
+
# include SmartPropertiesGeneratedMethods
|
34
33
|
#
|
35
|
-
#
|
36
|
-
#
|
34
|
+
# module SmartPropertiesGeneratedMethods
|
35
|
+
# sig { returns(T.nilable(::String)) }
|
36
|
+
# def title; end
|
37
37
|
#
|
38
|
-
#
|
39
|
-
#
|
38
|
+
# sig { params(title: T.nilable(::String)).returns(T.nilable(::String)) }
|
39
|
+
# def title=(title); end
|
40
40
|
#
|
41
|
-
#
|
42
|
-
#
|
41
|
+
# sig { returns(::String) }
|
42
|
+
# def description; end
|
43
43
|
#
|
44
|
-
#
|
45
|
-
#
|
44
|
+
# sig { params(description: ::String).returns(::String) }
|
45
|
+
# def description=(description); end
|
46
46
|
#
|
47
|
-
#
|
48
|
-
#
|
47
|
+
# sig { returns(T.nilable(T::Boolean)) }
|
48
|
+
# def published?; end
|
49
49
|
#
|
50
|
-
#
|
51
|
-
#
|
50
|
+
# sig { params(published: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) }
|
51
|
+
# def published=(published); end
|
52
52
|
#
|
53
|
-
#
|
54
|
-
#
|
53
|
+
# sig { returns(T.nilable(T::Boolean)) }
|
54
|
+
# def enabled; end
|
55
|
+
#
|
56
|
+
# sig { params(enabled: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) }
|
57
|
+
# def enabled=(enabled); end
|
58
|
+
# end
|
55
59
|
# end
|
56
60
|
# ~~~
|
57
61
|
#: [ConstantType = singleton(::SmartProperties)]
|
data/lib/tapioca/rbs/rewriter.rb
CHANGED
@@ -43,7 +43,7 @@ Module.include(T::Sig)
|
|
43
43
|
# Trigger the source transformation for each Ruby file being loaded.
|
44
44
|
RequireHooks.source_transform(patterns: ["**/*.rb"]) do |path, source|
|
45
45
|
# The source is most likely nil since no `source_transform` hook was triggered before this one.
|
46
|
-
source ||= File.read(path)
|
46
|
+
source ||= File.read(path, encoding: "UTF-8")
|
47
47
|
|
48
48
|
# For performance reasons, we only rewrite files that use Sorbet.
|
49
49
|
if source =~ /^\s*#\s*typed: (ignore|false|true|strict|strong|__STDLIB_INTERNAL)/
|
data/lib/tapioca/version.rb
CHANGED