tapioca 0.16.9 → 0.16.10
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 +35 -10
- data/lib/ruby_lsp/tapioca/server_addon.rb +3 -1
- data/lib/tapioca/cli.rb +15 -7
- 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: 9b1ddf8615a19929d81d7662c300a28ee8d49d08d7ba984fdaa7644bf70d5dfb
|
4
|
+
data.tar.gz: 4f2a79db13ce4a0e7614178d14423f5bd0fded127a6c5b6d0503bf7e2d73df7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a03a8d4866b5faf46af5cea289d4d7087540d58ee5b4eb759cb30cc23c540cc037c03bdd937cdf73e3f955407b2a47865600297fafe6b495e786e64b99f38942
|
7
|
+
data.tar.gz: 3a5bf689b47f198577480420b9ea0c1294a6c2170df0f5ba9a6e170a8f60b3d2de73827053f4b33002f1a6ae9f2501a73b70590c250c8306b86d52b244aa7f36
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.
|
4
|
+
RubyLsp::Addon.depend_on_ruby_lsp!(">= 0.23.10", "< 0.24")
|
5
5
|
|
6
6
|
begin
|
7
7
|
# The Tapioca add-on depends on the Rails add-on to add a runtime component to the runtime server. We can allow the
|
@@ -53,8 +53,11 @@ module RubyLsp
|
|
53
53
|
workspace_path: @global_state.workspace_path,
|
54
54
|
)
|
55
55
|
|
56
|
+
send_usage_telemetry("activated")
|
56
57
|
run_gem_rbi_check
|
57
58
|
rescue IncompatibleApiError
|
59
|
+
send_usage_telemetry("incompatible_api_error")
|
60
|
+
|
58
61
|
# The requested version for the Rails add-on no longer matches. We need to upgrade and fix the breaking
|
59
62
|
# changes
|
60
63
|
@outgoing_queue << Notification.window_log_message(
|
@@ -75,12 +78,12 @@ module RubyLsp
|
|
75
78
|
|
76
79
|
sig { override.returns(String) }
|
77
80
|
def version
|
78
|
-
"0.1.
|
81
|
+
"0.1.2"
|
79
82
|
end
|
80
83
|
|
81
84
|
sig { params(changes: T::Array[{ uri: String, type: Integer }]).void }
|
82
85
|
def workspace_did_change_watched_files(changes)
|
83
|
-
return unless
|
86
|
+
return unless @global_state&.enabled_feature?(:tapiocaAddon)
|
84
87
|
return unless @rails_runner_client.connected?
|
85
88
|
|
86
89
|
has_route_change = T.let(false, T::Boolean)
|
@@ -89,11 +92,10 @@ module RubyLsp
|
|
89
92
|
|
90
93
|
constants = changes.flat_map do |change|
|
91
94
|
path = URI(change[:uri]).to_standardized_path
|
92
|
-
next if path.end_with?("_test.rb", "_spec.rb")
|
93
95
|
next unless file_updated?(change, path)
|
94
96
|
|
95
|
-
if File.fnmatch
|
96
|
-
|
97
|
+
if File.fnmatch("**/fixtures/**/*.yml{,.erb}", path, File::FNM_PATHNAME | File::FNM_EXTGLOB)
|
98
|
+
has_fixtures_change = true
|
97
99
|
next
|
98
100
|
end
|
99
101
|
|
@@ -102,9 +104,10 @@ module RubyLsp
|
|
102
104
|
next
|
103
105
|
end
|
104
106
|
|
105
|
-
|
106
|
-
|
107
|
-
|
107
|
+
next if File.fnmatch?("**/{test,spec,features}/**/*", path, File::FNM_PATHNAME | File::FNM_EXTGLOB)
|
108
|
+
|
109
|
+
if File.fnmatch?("**/tapioca/**/compilers/**/*.rb", path, File::FNM_PATHNAME)
|
110
|
+
needs_compiler_reload = true
|
108
111
|
next
|
109
112
|
end
|
110
113
|
|
@@ -124,19 +127,22 @@ module RubyLsp
|
|
124
127
|
@rails_runner_client.delegate_notification(
|
125
128
|
server_addon_name: "Tapioca",
|
126
129
|
request_name: "reload_workspace_compilers",
|
127
|
-
workspace_path:
|
130
|
+
workspace_path: @global_state.workspace_path,
|
128
131
|
)
|
129
132
|
end
|
130
133
|
|
131
134
|
if has_route_change
|
135
|
+
send_usage_telemetry("route_dsl")
|
132
136
|
@rails_runner_client.delegate_notification(server_addon_name: "Tapioca", request_name: "route_dsl")
|
133
137
|
end
|
134
138
|
|
135
139
|
if has_fixtures_change
|
140
|
+
send_usage_telemetry("fixtures_dsl")
|
136
141
|
@rails_runner_client.delegate_notification(server_addon_name: "Tapioca", request_name: "fixtures_dsl")
|
137
142
|
end
|
138
143
|
|
139
144
|
if constants.any?
|
145
|
+
send_usage_telemetry("dsl")
|
140
146
|
@rails_runner_client.delegate_notification(
|
141
147
|
server_addon_name: "Tapioca",
|
142
148
|
request_name: "dsl",
|
@@ -147,6 +153,25 @@ module RubyLsp
|
|
147
153
|
|
148
154
|
private
|
149
155
|
|
156
|
+
sig { params(feature_name: String).void }
|
157
|
+
def send_usage_telemetry(feature_name)
|
158
|
+
return unless @outgoing_queue && @global_state
|
159
|
+
|
160
|
+
# Telemetry is not captured by default even if events are produced by the server
|
161
|
+
# See https://github.com/Shopify/ruby-lsp/tree/main/vscode#telemetry
|
162
|
+
@outgoing_queue << Notification.telemetry({
|
163
|
+
eventName: "tapioca_addon.feature_usage",
|
164
|
+
type: "data",
|
165
|
+
data: {
|
166
|
+
type: "counter",
|
167
|
+
attributes: {
|
168
|
+
label: feature_name,
|
169
|
+
machineId: @global_state.telemetry_machine_id,
|
170
|
+
},
|
171
|
+
},
|
172
|
+
})
|
173
|
+
end
|
174
|
+
|
150
175
|
sig { params(change: T::Hash[Symbol, T.untyped], path: String).returns(T::Boolean) }
|
151
176
|
def file_updated?(change, path)
|
152
177
|
case change[:type]
|
@@ -62,11 +62,13 @@ module RubyLsp
|
|
62
62
|
def dsl(constants, *args)
|
63
63
|
load("tapioca/cli.rb") # Reload the CLI to reset thor defaults between requests
|
64
64
|
|
65
|
+
::Tapioca::Cli.addon_mode!
|
66
|
+
|
65
67
|
# Order here is important to avoid having Thor confuse arguments. Do not put an array argument at the end before
|
66
68
|
# the list of constants
|
67
69
|
arguments = ["dsl"]
|
68
70
|
arguments.concat(args)
|
69
|
-
arguments.push("--
|
71
|
+
arguments.push("--workers=1")
|
70
72
|
arguments.concat(constants)
|
71
73
|
|
72
74
|
::Tapioca::Cli.start(arguments)
|
data/lib/tapioca/cli.rb
CHANGED
@@ -143,11 +143,6 @@ module Tapioca
|
|
143
143
|
type: :hash,
|
144
144
|
desc: "Options to pass to the DSL compilers",
|
145
145
|
default: {}
|
146
|
-
option :lsp_addon,
|
147
|
-
type: :boolean,
|
148
|
-
desc: "Generate DSL RBIs from the LSP add-on. Internal to Tapioca and not intended for end-users",
|
149
|
-
default: false,
|
150
|
-
hide: true
|
151
146
|
def dsl(*constant_or_paths)
|
152
147
|
set_environment(options)
|
153
148
|
|
@@ -170,7 +165,7 @@ module Tapioca
|
|
170
165
|
app_root: options[:app_root],
|
171
166
|
halt_upon_load_error: options[:halt_upon_load_error],
|
172
167
|
compiler_options: options[:compiler_options],
|
173
|
-
lsp_addon:
|
168
|
+
lsp_addon: self.class.addon_mode,
|
174
169
|
}
|
175
170
|
|
176
171
|
command = if options[:verify]
|
@@ -379,9 +374,22 @@ module Tapioca
|
|
379
374
|
end
|
380
375
|
|
381
376
|
no_commands do
|
377
|
+
@addon_mode = false
|
378
|
+
|
382
379
|
class << self
|
380
|
+
extend T::Sig
|
381
|
+
|
382
|
+
# Indicates that we are running from the LSP, set using the `addon_mode!` method
|
383
|
+
attr_reader :addon_mode
|
384
|
+
|
385
|
+
sig { void }
|
386
|
+
def addon_mode!
|
387
|
+
@addon_mode = true
|
388
|
+
end
|
389
|
+
|
390
|
+
sig { returns(T::Boolean) }
|
383
391
|
def exit_on_failure?
|
384
|
-
|
392
|
+
!@addon_mode
|
385
393
|
end
|
386
394
|
end
|
387
395
|
end
|
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.10
|
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-02-
|
13
|
+
date: 2025-02-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: benchmark
|