@@ -22,11 +22,11 @@ local is_win = uv.os_uname().version:find "Windows"
22
22
--- @class Process
23
23
local Process = {}
24
24
25
- --- @param type ServerType
25
+ --- @param ttype ServerType
26
26
--- @param on_response fun ( response : table )
27
27
--- @param on_exit fun ( code : number , signal : number )
28
28
--- @return Process
29
- function Process .new (type , on_response , on_exit )
29
+ function Process .new (ttype , on_response , on_exit )
30
30
local self = setmetatable ({}, { __index = Process })
31
31
32
32
local tsserver_provider = TsserverProvider .get_instance ()
@@ -54,19 +54,38 @@ function Process.new(type, on_response, on_exit)
54
54
55
55
local plugins_path = tsserver_provider :get_plugins_path ()
56
56
57
- if plugins_path and # plugin_config .tsserver_plugins > 0 then
57
+ if plugin_config .tsserver_plugins and # plugin_config .tsserver_plugins > 0 then
58
+ local plugin_names = {}
59
+ local probe_locations = {}
60
+ local has_object_plugins = false
61
+
62
+ for _ , plugin in ipairs (plugin_config .tsserver_plugins ) do
63
+ if type (plugin ) == " table" then
64
+ has_object_plugins = true
65
+ local full_path = Path :new (plugin .path , plugin .name ):absolute ()
66
+ table.insert (plugin_names , plugin .name )
67
+ table.insert (probe_locations , full_path )
68
+ else
69
+ table.insert (plugin_names , plugin )
70
+ end
71
+ end
72
+
58
73
table.insert (self .args , " --pluginProbeLocations" )
59
- table.insert (self .args , plugins_path :absolute ())
74
+ if has_object_plugins then
75
+ table.insert (self .args , table.concat (probe_locations , " ," ))
76
+ else
77
+ table.insert (self .args , plugins_path :absolute ())
78
+ end
60
79
table.insert (self .args , " --globalPlugins" )
61
- table.insert (self .args , table.concat (plugin_config . tsserver_plugins , " ," ))
80
+ table.insert (self .args , table.concat (plugin_names , " ," ))
62
81
end
63
82
64
83
if plugin_config .tsserver_logs ~= " off" then
65
84
local log_dir = Path :new (uv .os_tmpdir ())
66
85
table.insert (self .args , " --logVerbosity" )
67
86
table.insert (self .args , plugin_config .tsserver_logs )
68
87
table.insert (self .args , " --logFile" )
69
- table.insert (self .args , log_dir :joinpath (" tsserver_" .. type .. " .log" ):absolute ())
88
+ table.insert (self .args , log_dir :joinpath (" tsserver_" .. ttype .. " .log" ):absolute ())
70
89
end
71
90
72
91
self :start ()
0 commit comments