Skip to content

Commit d9def2c

Browse files
committed
Change callbacks -> handlers
1 parent 9750f45 commit d9def2c

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ The plugin provides several utilities:
4949
update_current_function() -- Set/reset the b:lsp_current_function variable
5050
diagnostics() -- Return a table with all diagnostic counts for the current buffer
5151
messages() -- Return a table listing progress and other status messages for display
52-
register_progress() -- Register the provided callback for progress messages
52+
register_progress() -- Register the provided handler for progress messages
5353
register_client() -- Register a client for messages
5454
-- Integrate misc. LS protocol extensions into the messages framework
55-
-- Each extension table contains a set of callbacks and a setup() function
56-
-- returning said callbacks
55+
-- Each extension table contains a set of handlers and a setup() function
56+
-- returning said handlers
5757
extensions = { clangd, pyls_ms }
5858
-- Set up a client for use with lsp-status. Calls register_client() and sets up
5959
-- buffer autocommands
@@ -69,13 +69,13 @@ status() -- One example out-of-the-box statusline component (as shown in the ima
6969
[`clangd`](https://clangd.llvm.org/extensions.html#file-status) and [Microsoft's Python language
7070
server](https://github.com/Microsoft/python-language-server) (`python/setStatusBarMessage`,
7171
`python/beginProgress`, `python/reportProgress`, and `python/endProgress`). To use these extensions,
72-
register the callbacks provided in the `extensions` table (the keys for the callbacks are
72+
register the handlers provided in the `extensions` table (the keys for the handlers are
7373
the relevant LSP method name).
7474

7575
**Note:** For `clangd`, you must also set `init_options = { clangdFileStatus = true }`.
7676

7777
**New**: You can also call `lsp_status.extensions.<server name>.setup()` to return the full set of
78-
callbacks, as shown below.
78+
handlers, as shown below.
7979

8080
### Configuration
8181

@@ -84,7 +84,7 @@ configuration values. The following configuration options are supported:
8484

8585
- `kind_labels`: An optional map from LSP symbol kinds to label symbols. Used to decorate the current function
8686
name. Default: `{}`
87-
- `select_symbol`: An optional callback of the form `function(cursor_pos, document_symbol)` that
87+
- `select_symbol`: An optional handler of the form `function(cursor_pos, document_symbol)` that
8888
should return `true` if `document_symbol` (a `DocumentSymbol`) should be accepted as the symbol
8989
currently containing the cursor.
9090

@@ -126,7 +126,7 @@ local lsp_status = require('lsp-status')
126126
-- to the string you want to display as a label
127127
-- lsp_status.config { kind_labels = vim.g.completion_customize_lsp_label }
128128

129-
-- Register the progress callback
129+
-- Register the progress handler
130130
lsp_status.register_progress()
131131
```
132132

@@ -147,10 +147,10 @@ lsp_status.on_attach(client)
147147
**Specific client configuration (following `nvim-lsp` conventions):**
148148
```lua
149149
clangd = {
150-
callbacks = lsp_status.extensions.clangd.setup()
150+
handlers = lsp_status.extensions.clangd.setup()
151151
},
152152
pyls_ms = {
153-
callbacks = lsp_status.extensions.pyls_ms.setup()
153+
handlers = lsp_status.extensions.pyls_ms.setup()
154154
},
155155
```
156156

@@ -175,7 +175,7 @@ local nvim_lsp = require('nvim_lsp')
175175
176176
-- Some arbitrary servers
177177
nvim_lsp.clangd.setup({
178-
callbacks = lsp_status.extensions.clangd.setup(),
178+
handlers = lsp_status.extensions.clangd.setup(),
179179
init_options = {
180180
clangdFileStatus = true
181181
},
@@ -184,7 +184,7 @@ nvim_lsp.clangd.setup({
184184
})
185185
186186
nvim_lsp.pyls_ms.setup({
187-
callbacks = lsp_status.extensions.pyls_ms.setup(),
187+
handlers = lsp_status.extensions.pyls_ms.setup(),
188188
settings = { python = { workspaceSymbols = { enabled = true }}},
189189
on_attach = lsp_status.on_attach,
190190
capabilities = lsp_status.capabilities

doc/lsp-status.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ example:>
4545

4646
-- Some arbitrary servers
4747
nvim_lsp.clangd.setup({
48-
callbacks = lsp_status.extensions.clangd.setup(),
48+
handlers = lsp_status.extensions.clangd.setup(),
4949
init_options = {
5050
clangdFileStatus = true
5151
},
@@ -54,7 +54,7 @@ example:>
5454
})
5555

5656
nvim_lsp.pyls_ms.setup({
57-
callbacks = lsp_status.extensions.pyls_ms.setup(),
57+
handlers = lsp_status.extensions.pyls_ms.setup(),
5858
settings = { python = { workspaceSymbols = { enabled = true }}},
5959
on_attach = lsp_status.on_attach,
6060
capabilities = lsp_status.capabilities
@@ -163,7 +163,7 @@ register_client({id}, {name}) *lsp-status.register_client()*
163163
{name}(required, string) Client name
164164

165165
register_progress() *lsp-status.register_progress()*
166-
Register the progress callback with Neovim's LSP client. Call
166+
Register the progress handler with Neovim's LSP client. Call
167167
once before starting any servers
168168

169169
status() *lsp-status.status()*
@@ -187,21 +187,21 @@ update_current_function() *lsp-status.update_current_function()*
187187
Module: lsp-status.clangd *lsp-status-api-clangd*
188188

189189
setup() *lsp-status.extensions.clangd.setup()*
190-
Return the callback {LSP Method: callback} table for `clangd` 's `fileStatus` extension
190+
Return the handler {LSP Method: handler} table for `clangd` 's `fileStatus` extension
191191

192192
Return: ~
193-
Table of extension method callbacks, to be added to your
193+
Table of extension method handlers, to be added to your
194194
`clangd` config
195195

196196

197197
==============================================================================
198198
Module: lsp-status.pyls_ms *lsp-status-api-pyls_ms*
199199

200200
setup() *lsp-status.extensions.pyls_ms.setup()*
201-
Return the callback {LSP Method: callback} table for `MPLS` 's progress and statusbar message extensions
201+
Return the handler {LSP Method: handler} table for `MPLS` 's progress and statusbar message extensions
202202

203203
Return: ~
204-
Table of extension method callbacks, to be added to your
204+
Table of extension method handlers, to be added to your
205205
`pyls_ms` config
206206

207207
vim:tw=78:ts=2:ft=help:norl:

lua/lsp-status/extensions/clangd.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ local function ensure_init(id)
1212
util.ensure_init(messages, id, 'clangd')
1313
end
1414

15-
local callbacks = {
15+
local handlers = {
1616
['textDocument/clangd.fileStatus'] = function(_, _, statusMessage, client_id)
1717
ensure_init(client_id)
1818
messages[client_id].status = { uri = statusMessage.uri, content = statusMessage.state }
1919
vim.api.nvim_command('doautocmd User LspMessageUpdate')
2020
end,
2121
}
2222

23-
--- Return the callback {LSP Method: callback} table for `clangd`'s `fileStatus` extension
24-
--@returns Table of extension method callbacks, to be added to your `clangd` config
23+
--- Return the handler {LSP Method: handler} table for `clangd`'s `fileStatus` extension
24+
--@returns Table of extension method handlers, to be added to your `clangd` config
2525
local function setup()
26-
return callbacks
26+
return handlers
2727
end
2828

2929
local M = {
3030
_init = init,
3131
setup = setup
3232
}
3333

34-
M = vim.tbl_extend('error', M, callbacks)
34+
M = vim.tbl_extend('error', M, handlers)
3535

3636
return M

lua/lsp-status/extensions/pyls_ms.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local function ensure_init(id)
1111
util.ensure_init(messages, id, 'pyls_ms')
1212
end
1313

14-
local callbacks = {
14+
local handlers = {
1515
['python/setStatusBarMessage'] = function(_, _, message, client_id)
1616
ensure_init(client_id)
1717
messages[client_id].static_message = { content = message[1] }
@@ -34,18 +34,18 @@ local callbacks = {
3434
end,
3535
}
3636

37-
--- Return the callback {LSP Method: callback} table for `MPLS`'s progress and statusbar message
37+
--- Return the handler {LSP Method: handler} table for `MPLS`'s progress and statusbar message
3838
--- extensions
39-
--@returns Table of extension method callbacks, to be added to your `pyls_ms` config
39+
--@returns Table of extension method handlers, to be added to your `pyls_ms` config
4040
local function setup()
41-
return callbacks
41+
return handlers
4242
end
4343

4444
local M = {
4545
_init = init,
4646
setup = setup
4747
}
4848

49-
M = vim.tbl_extend('error', M, callbacks)
49+
M = vim.tbl_extend('error', M, handlers)
5050

5151
return M

lua/lsp-status/messaging.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ local function get_messages()
9595
return new_messages
9696
end
9797

98-
local function register_progress() vim.lsp.callbacks['$/progress'] = progress_callback end
98+
local function register_progress() vim.lsp.handlers['$/progress'] = progress_callback end
9999

100100
-- Client registration for messages
101101
local function register_client(id, name)

0 commit comments

Comments
 (0)