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