@@ -7,7 +7,7 @@ local default_config = {
77 indicator_info = ' 🛈' ,
88 indicator_hint = ' ❗' ,
99 indicator_ok = ' ' ,
10- spinner_frames = { ' ⣾' , ' ⣽' , ' ⣻' , ' ⢿' , ' ⡿' , ' ⣟' , ' ⣯' , ' ⣷' },
10+ spinner_frames = {' ⣾' , ' ⣽' , ' ⣻' , ' ⢿' , ' ⡿' , ' ⣟' , ' ⣯' , ' ⣷' },
1111 status_symbol = ' 🇻' ,
1212 select_symbol = nil ,
1313 update_interval = 100
@@ -19,7 +19,7 @@ local messages = {}
1919-- Diagnostics
2020--- Get all diagnostics for the current buffer.
2121--- 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 `}
2323local function diagnostics () -- luacheck: no unused
2424 error () -- Stub for docs
2525end
@@ -32,16 +32,13 @@ local messaging = require('lsp-status/messaging')
3232-- LSP extensions
3333local pyls_ms = require (' lsp-status/extensions/pyls_ms' )
3434local 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 }
3936
4037-- Find current enclosing function
4138local current_function = require (' lsp-status/current_function' )
4239
4340-- Out-of-the-box statusline component
44- local timer = require (' lsp-status/timer ' )
41+ local redraw = require (' lsp-status/redraw ' )
4542local statusline = require (' lsp-status/statusline' )
4643
4744--- Configure lsp-status.nvim.
@@ -59,7 +56,7 @@ local statusline = require('lsp-status/statusline')
5956--- - `spinner_frames`: Animation frames for progress spinner in `status`. Default: { '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷' },
6057--- - `status_symbol`: Symbol to start the statusline segment in `status`. Default: ' 🇻',
6158---
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
6360--- omitting the relevant key.
6461local function config (user_config )
6562 _config = vim .tbl_extend (' keep' , user_config , _config , default_config )
@@ -68,7 +65,7 @@ local function config(user_config)
6865 messaging ._init (messages , _config )
6966 if _config .current_function then current_function ._init (messages , _config ) end
7067 statusline ._init (messages , _config )
71- timer ._init (messages , _config )
68+ redraw ._init (messages , _config )
7269 statusline = vim .tbl_extend (' keep' , statusline , statusline ._get_component_functions ())
7370end
7471
7774--- registers the server with `lsp-status` for progress message handling and current function
7875--- updating
7976---
80- -- @param client: (required, vim.lsp.client)
77+ -- @param client: (required, vim.lsp.client)
8178local function on_attach (client )
8279 -- Register the client for messages
8380 messaging .register_client (client .id , client .name )
8481 vim .api .nvim_command (' augroup lsp_aucmds' )
8582 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() ' )
8784
8885 -- If the client is a documentSymbolProvider, set up an autocommand
8986 -- to update the containing symbol
9087 if _config .current_function and client .resolved_capabilities .document_symbol then
9188 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()' )
9490 end
9591
9692 vim .api .nvim_command (' augroup END' )
97-
98- timer .register_timer ()
9993end
10094
10195config (_config )
130124--- Normal messages are tables of the form
131125--- `{ name = Server name, content = Message contents }`
132126---
133- -- @returns list of messages
127+ -- @returns list of messages
134128local function messages () -- luacheck: no unused
135129 error ()
136130end
144138--- Register a new server to receive messages.
145139--- Generally, you don't need to call this manually - `on_attach` sets it up for you
146140---
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
149143local function register_client (id , name ) -- luacheck: no unused
150144 error ()
151145end
156150--- Usable out of the box, but intended more as an example/template for modification to customize
157151--- to your own needs
158152---
159- -- @returns: statusline component string
153+ -- @returns: statusline component string
160154local function status () -- luacheck: no unused
161155 error ()
162156end
0 commit comments