Add return type annotations to all void functions

This commit is contained in:
Jared Miller 2026-01-27 21:42:35 -05:00
parent 936428a029
commit a7c84ed9d5
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -20,13 +20,13 @@ var peer_match_ids: dict<number> = {}
# path to bridge script (adjust as needed)
const bridge_script = expand('<sfile>:p:h') .. '/bridge.ts'
def Send(msg: dict<any>)
def Send(msg: dict<any>): void
if bridge_channel != null_channel
ch_sendraw(bridge_channel, json_encode(msg) .. "\n")
endif
enddef
def OnOutput(ch: channel, msg: string)
def OnOutput(ch: channel, msg: string): void
if empty(msg)
return
endif
@ -56,7 +56,7 @@ def OnOutput(ch: channel, msg: string)
endif
enddef
def ApplyRemoteContent(content: string)
def ApplyRemoteContent(content: string): void
if suppressing
return
endif
@ -69,7 +69,7 @@ def ApplyRemoteContent(content: string)
suppressing = false
enddef
def SendBuffer()
def SendBuffer(): void
if !connected || suppressing
return
endif
@ -78,7 +78,7 @@ def SendBuffer()
Send({type: 'content', text: content})
enddef
def SendCursor()
def SendCursor(): void
if !connected
return
endif
@ -87,7 +87,7 @@ def SendCursor()
Send({type: 'cursor', line: pos[1] - 1, col: pos[2] - 1})
enddef
def ShowPeerCursor(data: dict<any>)
def ShowPeerCursor(data: dict<any>): void
const client_id = string(data.clientId)
# Clear previous highlight for this peer
@ -104,14 +104,14 @@ def ShowPeerCursor(data: dict<any>)
peer_match_ids[client_id] = matchadd('PeerCursor', pattern, 10)
enddef
def ClearPeerCursors()
def ClearPeerCursors(): void
for id in values(peer_match_ids)
silent! matchdelete(id)
endfor
peer_match_ids = {}
enddef
export def Connect(room_name: string)
export def Connect(room_name: string): void
if bridge_job != null_job
Disconnect()
endif
@ -148,7 +148,7 @@ export def Connect(room_name: string)
augroup END
enddef
export def Disconnect()
export def Disconnect(): void
if bridge_job != null_job
Send({type: 'disconnect'})
job_stop(bridge_job)
@ -165,7 +165,7 @@ export def Disconnect()
echom '[collab] disconnected'
enddef
export def Status()
export def Status(): void
if connected
echom '[collab] connected to room: ' .. room
else