13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/ruby_lsp/tapioca/server_addon.rb', line 13
def execute(request, params)
case request
when "reload_workspace_compilers"
with_notification_wrapper("reload_workspace_compilers", "Reloading DSL compilers") do
@loader&.reload_custom_compilers
end
when "load_compilers_and_extensions"
with_notification_wrapper("load_compilers_and_extensions", "Loading DSL compilers") do
::Tapioca::Dsl::Compiler.extend(T::Generic)
@loader = ::Tapioca::Loaders::Dsl.new(
tapioca_path: ::Tapioca::TAPIOCA_DIR,
eager_load: false,
app_root: params[:workspace_path],
halt_upon_load_error: false,
)
@loader.load_dsl_extensions_and_compilers
end
when "dsl"
fork do
with_notification_wrapper("dsl", "Generating DSL RBIs") do
dsl(params[:constants])
end
end
when "route_dsl"
fork do
with_notification_wrapper("route_dsl", "Generating route DSL RBIs") do
constants = ::Tapioca::Dsl::Compilers::UrlHelpers.gather_constants
dsl(constants.map(&:name), "--only=Tapioca::Dsl::Compilers::UrlHelpers", "ActiveSupportConcern")
end
end
when "fixtures_dsl"
fork do
with_notification_wrapper("fixture_dsl", "Generating fixture DSL RBIs") do
constants = ::Tapioca::Dsl::Compilers::ActiveRecordFixtures.gather_constants
dsl(constants.map(&:name), "--only=Tapioca::Dsl::Compilers::ActiveRecordFixtures")
end
end
end
end
|