Skip to content

Commit 76cb299

Browse files
committed
docs(lua): more annotations updates
1 parent ed88d10 commit 76cb299

File tree

2 files changed

+35
-28
lines changed

2 files changed

+35
-28
lines changed

dist/lua/annotations.lua

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -111,28 +111,28 @@ function BufferControllerPromise:cancel() end
111111
function BufferControllerPromise:and_then(cb) end
112112

113113

114-
---@class (exact) CursorPromise : Promise
115-
local CursorPromise = {}
114+
---@class (exact) CursorEventPromise : Promise
115+
local CursorEventPromise = {}
116116
--- block until promise is ready and return value
117-
--- @return Cursor
118-
function CursorPromise:await() end
117+
--- @return CursorEvent
118+
function CursorEventPromise:await() end
119119
--- cancel promise execution
120-
function CursorPromise:cancel() end
121-
---@param cb fun(x: Cursor) callback to invoke
120+
function CursorEventPromise:cancel() end
121+
---@param cb fun(x: CursorEvent) callback to invoke
122122
---invoke callback asynchronously as soon as promise is ready
123-
function CursorPromise:and_then(cb) end
123+
function CursorEventPromise:and_then(cb) end
124124

125125

126-
---@class (exact) MaybeCursorPromise : Promise
127-
local MaybeCursorPromise = {}
126+
---@class (exact) MaybeCursorEventPromise : Promise
127+
local MaybeCursorEventPromise = {}
128128
--- block until promise is ready and return value
129-
--- @return Cursor | nil
130-
function MaybeCursorPromise:await() end
129+
--- @return CursorEvent | nil
130+
function MaybeCursorEventPromise:await() end
131131
--- cancel promise execution
132-
function MaybeCursorPromise:cancel() end
133-
---@param cb fun(x: Cursor | nil) callback to invoke
132+
function MaybeCursorEventPromise:cancel() end
133+
---@param cb fun(x: CursorEvent | nil) callback to invoke
134134
---invoke callback asynchronously as soon as promise is ready
135-
function MaybeCursorPromise:and_then(cb) end
135+
function MaybeCursorEventPromise:and_then(cb) end
136136

137137

138138
---@class (exact) BufferUpdatePromise : Promise
@@ -212,12 +212,13 @@ function Client:active_workspaces() end
212212
---refresh current user token if possible
213213
function Client:refresh() end
214214

215+
---@param user string workspace owning user
215216
---@param ws string workspace id to connect to
216217
---@return WorkspacePromise
217218
---@async
218219
---@nodiscard
219220
---join requested workspace if possible and subscribe to event bus
220-
function Client:attach_workspace(ws) end
221+
function Client:attach_workspace(user, ws) end
221222

222223
---@param ws string workspace id to create
223224
---@return NilPromise
@@ -226,9 +227,10 @@ function Client:attach_workspace(ws) end
226227
---create a new workspace with given id
227228
function Client:create_workspace(ws) end
228229

230+
---@param user string workspace owning user
229231
---@param ws string workspace id to leave
230232
---leave workspace with given id, detaching and disconnecting
231-
function Client:leave_workspace(ws) end
233+
function Client:leave_workspace(user, ws) end
232234

233235
---@param ws string workspace id to delete
234236
---@return NilPromise
@@ -505,30 +507,35 @@ function BufferController:ack(version) end
505507
---handle to a workspace's cursor channel, allowing send/recv operations
506508
local CursorController = {}
507509

510+
---a cursor selection span
508511
---@class Selection
509-
---@field buffer string relative path ("name") of buffer on which this cursor is
510-
---@field start_row integer
511-
---@field start_col integer
512-
---@field end_row integer
513-
---@field end_col integer
514-
---a cursor selected region, as row-col indices
512+
---@field start_row integer cursor position starting row in buffer
513+
---@field start_col integer cursor position starting column in buffer
514+
---@field end_row integer cursor position final row in buffer
515+
---@field end_col integer cursor position final column in buffer
515516

517+
---a cursor instantaneous state
516518
---@class Cursor
517-
---@field user string id of user owning this cursor
518-
---@field sel Selection selected region for this user
519+
---@field buffer string path of buffer this cursor is on
520+
---@field sel Selection[] the updated cursor selection(s)
519521

520-
---@param cursor Selection cursor position to broadcast
522+
---an event that occurred about a user's cursor
523+
---@class CursorEvent
524+
---@field user string user who sent this cursor
525+
---@field cursor Cursor cursor position data
526+
527+
---@param cursor Cursor cursor position to broadcast
521528
---update cursor position by sending a cursor event to server
522529
function CursorController:send(cursor) end
523530

524531

525-
---@return MaybeCursorPromise
532+
---@return MaybeCursorEventPromise
526533
---@async
527534
---@nodiscard
528535
---try to receive cursor events, returning nil if none is available
529536
function CursorController:try_recv() end
530537

531-
---@return CursorPromise
538+
---@return CursorEventPromise
532539
---@async
533540
---@nodiscard
534541
---block until next cursor event and return it

src/api/cursor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct CursorEvent {
1717
pub cursor: Cursor,
1818
}
1919

20-
/// An event that occurred about a user's cursor.
20+
/// A cursor instantaneous state
2121
#[derive(Clone, Debug, Default)]
2222
#[cfg_attr(feature = "js", napi_derive::napi(object))]
2323
#[cfg_attr(feature = "py", pyclass(get_all, from_py_object))]

0 commit comments

Comments
 (0)