Skip to content

Commit db04eea

Browse files
authored
Add and document component_separator (#57)
1 parent f18f7d6 commit db04eea

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ lsp_status.config {
130130
indicator_ok = 'Ok',
131131
})
132132
```
133+
- `indicator_separator`: a string which goes between each diagnostic group symbol and its count.
134+
Defaults to whitespace.
135+
- `component_separator`: a string which goes between each "chunk" of the statusline component (i.e.
136+
different diagnostic groups, messages). Defaults to whitespace.
133137
- `diagnostics`: Boolean, `true` by default. If `false`, the default statusline component does not
134138
display LSP diagnostics.
135139

doc/lsp-status.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ config({config}) *lsp-status.config()*
105105
should be updated and displayed in the default statusline
106106
component. Shows the current function, method, class,
107107
struct, interface, enum, module, or namespace.
108+
`indicator_separator`: a string which goes between each
109+
diagnostic group symbol and its count. Defaults to whitespace.
110+
`component_separator`: a string which goes between each
111+
"chunk" of the statusline component (i.e. different diagnostic
112+
groups, messages). Defaults to whitespace.
108113
`indicator_errors` : Symbol to place next to the error count
109114
in `status` . Default: '',•
110115
`indicator_warnings` : Symbol to place next to the warning

lua/lsp-status.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ local default_config = {
33
current_function = true,
44
diagnostics = true,
55
indicator_separator = ' ',
6+
component_separator = ' ',
67
indicator_errors = '',
78
indicator_warnings = '',
89
indicator_info = '🛈',

lua/lsp-status/statusline.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ local function get_lsp_statusline(bufnr)
104104
table.insert(msgs, client_name .. ' ' .. contents)
105105
end
106106

107-
local base_status = vim.trim(table.concat(status_parts, ' ') .. ' ' .. table.concat(msgs, ' '))
107+
local base_status = vim.trim(table.concat(status_parts, config.component_separator) .. ' ' ..
108+
table.concat(msgs, config.component_separator))
108109
local symbol = config.status_symbol .. ((some_diagnostics and only_hint) and '' or ' ')
109110
if config.current_function then
110111
local current_function = vim.b.lsp_current_function
111112
if current_function and current_function ~= '' then
112-
symbol = symbol .. '(' .. current_function .. ') '
113+
symbol = symbol .. '(' .. current_function .. ')' .. config.component_separator
113114
end
114115
end
115116

0 commit comments

Comments
 (0)