@@ -8,9 +8,7 @@ local icons
88
99local diagnostics = require (' lsp-status/diagnostics' )
1010local messages = require (' lsp-status/messaging' ).messages
11- local aliases = {
12- pyls_ms = ' MPLS' ,
13- }
11+ local aliases = {pyls_ms = ' MPLS' }
1412
1513local function make_statusline_component (diagnostics_key )
1614 return function (bufh )
@@ -27,7 +25,7 @@ local function init(_, _config)
2725 errors = config .indicator_errors ,
2826 warnings = config .indicator_warnings ,
2927 hints = config .indicator_hint ,
30- info = config .indicator_info ,
28+ info = config .indicator_info
3129 }
3230
3331 _errors = make_statusline_component (' errors' )
3836
3937local function get_lsp_statusline (bufnr )
4038 bufnr = bufnr or 0
41- if # vim .lsp .buf_get_clients (bufnr ) == 0 then
42- return ' '
43- end
44-
39+ if # vim .lsp .buf_get_clients (bufnr ) == 0 then return ' ' end
4540 local buf_diagnostics = diagnostics (bufnr )
4641 local buf_messages = messages ()
4742 local only_hint = true
4843 local some_diagnostics = false
4944 local status_parts = {}
5045 if buf_diagnostics .errors and buf_diagnostics .errors > 0 then
51- table.insert (status_parts , config .indicator_errors .. config .indicator_separator .. buf_diagnostics .errors )
46+ table.insert (status_parts ,
47+ config .indicator_errors .. config .indicator_separator .. buf_diagnostics .errors )
5248 only_hint = false
5349 some_diagnostics = true
5450 end
5551
5652 if buf_diagnostics .warnings and buf_diagnostics .warnings > 0 then
57- table.insert (status_parts , config .indicator_warnings .. config .indicator_separator .. buf_diagnostics .warnings )
53+ table.insert (status_parts , config .indicator_warnings .. config .indicator_separator ..
54+ buf_diagnostics .warnings )
5855 only_hint = false
5956 some_diagnostics = true
6057 end
6158
6259 if buf_diagnostics .info and buf_diagnostics .info > 0 then
63- table.insert (status_parts , config .indicator_info .. config .indicator_separator .. buf_diagnostics .info )
60+ table.insert (status_parts ,
61+ config .indicator_info .. config .indicator_separator .. buf_diagnostics .info )
6462 only_hint = false
6563 some_diagnostics = true
6664 end
6765
6866 if buf_diagnostics .hints and buf_diagnostics .hints > 0 then
69- table.insert (status_parts , config .indicator_hint .. config .indicator_separator .. buf_diagnostics .hints )
67+ table.insert (status_parts ,
68+ config .indicator_hint .. config .indicator_separator .. buf_diagnostics .hints )
7069 some_diagnostics = true
7170 end
7271
@@ -77,26 +76,21 @@ local function get_lsp_statusline(bufnr)
7776 local contents
7877 if msg .progress then
7978 contents = msg .title
80- if msg .message then
81- contents = contents .. ' ' .. msg .message
82- end
79+ if msg .message then contents = contents .. ' ' .. msg .message end
8380
84- if msg .percentage then
85- contents = contents .. ' (' .. msg .percentage .. ' )'
86- end
81+ if msg .percentage then contents = contents .. ' (' .. msg .percentage .. ' )' end
8782
8883 if msg .spinner then
89- contents = config .spinner_frames [(msg .spinner % # config .spinner_frames ) + 1 ] .. ' ' .. contents
84+ contents = config .spinner_frames [(msg .spinner % # config .spinner_frames ) + 1 ] .. ' ' ..
85+ contents
9086 end
9187 elseif msg .status then
9288 contents = msg .content
9389 if msg .uri then
9490 local filename = vim .uri_to_fname (msg .uri )
9591 filename = vim .fn .fnamemodify (filename , ' :~:.' )
9692 local space = math.min (60 , math.floor (0.6 * vim .fn .winwidth (0 )))
97- if # filename > space then
98- filename = vim .fn .pathshorten (filename )
99- end
93+ if # filename > space then filename = vim .fn .pathshorten (filename ) end
10094
10195 contents = ' (' .. filename .. ' ) ' .. contents
10296 end
@@ -116,26 +110,16 @@ local function get_lsp_statusline(bufnr)
116110 end
117111 end
118112
119- if base_status ~= ' ' then
120- return symbol .. base_status .. ' '
121- end
122-
113+ if base_status ~= ' ' then return symbol .. base_status .. ' ' end
123114 return symbol .. config .indicator_ok .. ' '
124115end
125116
126117local function get_component_functions ()
127- return {
128- errors = _errors ,
129- warnings = _warnings ,
130- hints = _hints ,
131- info = _info ,
132- }
118+ return {errors = _errors , warnings = _warnings , hints = _hints , info = _info }
133119end
134120
135121-- Status line component for nvim-lsp
136- local function lsp_status ()
137- return vim .b .lsp_status_statusline or ' '
138- end
122+ local function lsp_status () return vim .g .lsp_status_statusline or ' ' end
139123
140124local M = {
141125 _init = init ,
0 commit comments