@@ -7,7 +7,7 @@ local default_config = {
7
7
indicator_info = ' 🛈' ,
8
8
indicator_hint = ' ❗' ,
9
9
indicator_ok = ' ' ,
10
- spinner_frames = { ' ⣾' , ' ⣽' , ' ⣻' , ' ⢿' , ' ⡿' , ' ⣟' , ' ⣯' , ' ⣷' },
10
+ spinner_frames = {' ⣾' , ' ⣽' , ' ⣻' , ' ⢿' , ' ⡿' , ' ⣟' , ' ⣯' , ' ⣷' },
11
11
status_symbol = ' 🇻' ,
12
12
select_symbol = nil ,
13
13
update_interval = 100
@@ -19,7 +19,7 @@ local messages = {}
19
19
-- Diagnostics
20
20
--- Get all diagnostics for the current buffer.
21
21
--- Convenience function to retrieve all diagnostic counts for the current buffer.
22
- -- @returns `{ 'Error': error_count, 'Warning': warning_count', 'Info': info_count, 'Hint': hint_count `}
22
+ -- @returns `{ 'Error': error_count, 'Warning': warning_count', 'Info': info_count, 'Hint': hint_count `}
23
23
local function diagnostics () -- luacheck: no unused
24
24
error () -- Stub for docs
25
25
end
@@ -32,16 +32,13 @@ local messaging = require('lsp-status/messaging')
32
32
-- LSP extensions
33
33
local pyls_ms = require (' lsp-status/extensions/pyls_ms' )
34
34
local clangd = require (' lsp-status/extensions/clangd' )
35
- local extension_callbacks = {
36
- pyls_ms = pyls_ms ,
37
- clangd = clangd
38
- }
35
+ local extension_callbacks = {pyls_ms = pyls_ms , clangd = clangd }
39
36
40
37
-- Find current enclosing function
41
38
local current_function = require (' lsp-status/current_function' )
42
39
43
40
-- Out-of-the-box statusline component
44
- local timer = require (' lsp-status/timer ' )
41
+ local redraw = require (' lsp-status/redraw ' )
45
42
local statusline = require (' lsp-status/statusline' )
46
43
47
44
--- Configure lsp-status.nvim.
@@ -59,7 +56,7 @@ local statusline = require('lsp-status/statusline')
59
56
--- - `spinner_frames`: Animation frames for progress spinner in `status`. Default: { '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷' },
60
57
--- - `status_symbol`: Symbol to start the statusline segment in `status`. Default: ' 🇻',
61
58
---
62
- -- @param config: (required, table) Table of values; keys are as listed above. Accept defaults by
59
+ -- @param config: (required, table) Table of values; keys are as listed above. Accept defaults by
63
60
--- omitting the relevant key.
64
61
local function config (user_config )
65
62
_config = vim .tbl_extend (' keep' , user_config , _config , default_config )
@@ -68,7 +65,7 @@ local function config(user_config)
68
65
messaging ._init (messages , _config )
69
66
if _config .current_function then current_function ._init (messages , _config ) end
70
67
statusline ._init (messages , _config )
71
- timer ._init (messages , _config )
68
+ redraw ._init (messages , _config )
72
69
statusline = vim .tbl_extend (' keep' , statusline , statusline ._get_component_functions ())
73
70
end
74
71
77
74
--- registers the server with `lsp-status` for progress message handling and current function
78
75
--- updating
79
76
---
80
- -- @param client: (required, vim.lsp.client)
77
+ -- @param client: (required, vim.lsp.client)
81
78
local function on_attach (client )
82
79
-- Register the client for messages
83
80
messaging .register_client (client .id , client .name )
84
81
vim .api .nvim_command (' augroup lsp_aucmds' )
85
82
vim .api .nvim_command (' au! * <buffer>' )
86
- vim .api .nvim_command (' au User LspDiagnosticsChanged let g:lsp_status_redraw = v:true ' )
83
+ vim .api .nvim_command (' au User LspDiagnosticsChanged lua require("lsp-status/redraw").redraw() ' )
87
84
88
85
-- If the client is a documentSymbolProvider, set up an autocommand
89
86
-- to update the containing symbol
90
87
if _config .current_function and client .resolved_capabilities .document_symbol then
91
88
vim .api .nvim_command (
92
- ' au CursorHold <buffer> lua require("lsp-status").update_current_function()'
93
- )
89
+ ' au CursorHold <buffer> lua require("lsp-status").update_current_function()' )
94
90
end
95
91
96
92
vim .api .nvim_command (' augroup END' )
97
-
98
- timer .register_timer ()
99
93
end
100
94
101
95
config (_config )
130
124
--- Normal messages are tables of the form
131
125
--- `{ name = Server name, content = Message contents }`
132
126
---
133
- -- @returns list of messages
127
+ -- @returns list of messages
134
128
local function messages () -- luacheck: no unused
135
129
error ()
136
130
end
144
138
--- Register a new server to receive messages.
145
139
--- Generally, you don't need to call this manually - `on_attach` sets it up for you
146
140
---
147
- -- @param id: (required, number) Client ID
148
- -- @param name: (required, string) Client name
141
+ -- @param id: (required, number) Client ID
142
+ -- @param name: (required, string) Client name
149
143
local function register_client (id , name ) -- luacheck: no unused
150
144
error ()
151
145
end
156
150
--- Usable out of the box, but intended more as an example/template for modification to customize
157
151
--- to your own needs
158
152
---
159
- -- @returns: statusline component string
153
+ -- @returns: statusline component string
160
154
local function status () -- luacheck: no unused
161
155
error ()
162
156
end
0 commit comments