File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,10 +26,6 @@ M.connected_server = nil
2626--- Subscribe to `opencode`'s Server-Sent Events (SSE) to execute `OpencodeEvent:<event.type>` autocmds.
2727--- @param server opencode.cli.server.Server
2828function M .connect (server )
29- if not require (" opencode.config" ).opts .events .enabled then
30- return
31- end
32-
3329 M .disconnect ()
3430
3531 require (" opencode.promise" )
@@ -45,13 +41,15 @@ function M.connect(server)
4541 heartbeat_timer :start (OPENCODE_HEARTBEAT_INTERVAL_MS + 5000 , 0 , vim .schedule_wrap (M .disconnect ))
4642 end
4743
48- vim .api .nvim_exec_autocmds (" User" , {
49- pattern = " OpencodeEvent:" .. response .type ,
50- data = {
51- event = response ,
52- port = _server .port ,
53- },
54- })
44+ if require (" opencode.config" ).opts .events .enabled then
45+ vim .api .nvim_exec_autocmds (" User" , {
46+ pattern = " OpencodeEvent:" .. response .type ,
47+ data = {
48+ event = response ,
49+ port = _server .port ,
50+ },
51+ })
52+ end
5553 end ,
5654 function ()
5755 -- Server disappeared ungracefully, e.g. process killed, network error, etc.
You can’t perform that action at this time.
0 commit comments