File tree 5 files changed +19
-1
lines changed
5 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ Command Description
123
123
`SCNvimStart` Start SuperCollider
124
124
`SCNvimStop` Stop SuperCollider
125
125
`SCNvimRecompile` Recompile SCClassLibrary
126
+ `SCNvimReboot` Reboot sclang interpreter
126
127
`SCNvimGenerateAssets` Generate syntax highlightning and snippets
127
128
`SCNvimHelp` <subject> Open HelpBrowser or window split for <subject>
128
129
`SCNvimStatusLine` Display server status in 'statusline' if configured.
Original file line number Diff line number Diff line change @@ -99,6 +99,11 @@ function scnvim.recompile()
99
99
sclang .recompile ()
100
100
end
101
101
102
+ --- Reboot sclang.
103
+ function scnvim .reboot ()
104
+ sclang .reboot ()
105
+ end
106
+
102
107
--- Determine if a sclang process is active.
103
108
--- @return True if sclang is running otherwise false.
104
109
function scnvim .is_running ()
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ return function()
17
17
add_command (' SCNvimStart' , sclang .start , ' Start the sclang interpreter' )
18
18
add_command (' SCNvimStop' , sclang .stop , ' Stop the sclang interpreter' )
19
19
add_command (' SCNvimRecompile' , sclang .recompile , ' Recompile the sclang interpreter' )
20
+ add_command (' SCNvimReboot' , sclang .reboot , ' Reboot sclang interpreter' )
20
21
add_command (' SCNvimStatusLine' , sclang .poll_server_status , ' Display the server status' )
21
22
add_command (' SCNvimGenerateAssets' , function ()
22
23
local on_done = function ()
Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ function M.start()
223
223
end
224
224
225
225
--- Stop the sclang process.
226
- function M .stop ()
226
+ function M .stop (callback )
227
227
if not M .is_running () then
228
228
return
229
229
end
@@ -235,15 +235,25 @@ function M.stop()
235
235
local ret = M .proc :kill ' sigkill'
236
236
if ret == 0 then
237
237
timer :close ()
238
+ if callback then
239
+ vim .schedule (callback )
240
+ end
238
241
M .proc = nil
239
242
end
240
243
else
241
244
-- process exited during timer loop
242
245
timer :close ()
246
+ if callback then
247
+ vim .schedule (callback )
248
+ end
243
249
end
244
250
end )
245
251
end
246
252
253
+ function M .reboot ()
254
+ M .stop (M .start )
255
+ end
256
+
247
257
--- Recompile the class library.
248
258
function M .recompile ()
249
259
if not M .is_running () then
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ describe('commands', function()
8
8
' SCNvimGenerateAssets' ,
9
9
' SCNvimHelp' ,
10
10
' SCNvimRecompile' ,
11
+ ' SCNvimReboot' ,
11
12
' SCNvimStart' ,
12
13
' SCNvimStatusLine' ,
13
14
' SCNvimStop' ,
You can’t perform that action at this time.
0 commit comments