File tree Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Expand file tree Collapse file tree 4 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,8 @@ lsp_status.config {
111
111
end
112
112
}
113
113
```
114
+ - ` current_function ` : Boolean, ` true ` if the current function should be updated and displayed in the
115
+ default statusline component.
114
116
115
117
## Example Use
116
118
Original file line number Diff line number Diff line change @@ -97,6 +97,9 @@ config({config}) *lsp-status.config()*
97
97
`function(cursor_pos, document_symbol)` that should return
98
98
`true` if `document_symbol` (a `DocumentSymbol` ) should be
99
99
accepted as the symbol currently containing the cursor.•
100
+ • `current_function` : Boolean, `true` if the current function
101
+ should be updated and displayed in the default statusline
102
+ component.
100
103
• `indicator_errors` : Symbol to place next to the error count
101
104
in `status` . Default: '',•
102
105
• `indicator_warnings` : Symbol to place next to the warning
Original file line number Diff line number Diff line change 1
1
local _config = {}
2
2
local default_config = {
3
3
kind_labels = {},
4
+ current_function = true ,
4
5
indicator_errors = ' ' ,
5
6
indicator_warnings = ' ' ,
6
7
indicator_info = ' 🛈' ,
@@ -62,7 +63,7 @@ local function config(user_config)
62
63
pyls_ms ._init (messages , _config )
63
64
clangd ._init (messages , _config )
64
65
messaging ._init (messages , _config )
65
- current_function ._init (messages , _config )
66
+ if _config . current_function then current_function ._init (messages , _config ) end
66
67
statusline ._init (messages , _config )
67
68
end
68
69
@@ -86,7 +87,7 @@ local function on_attach(client)
86
87
87
88
-- If the client is a documentSymbolProvider, set up an autocommand
88
89
-- to update the containing symbol
89
- if client .resolved_capabilities .document_symbol then
90
+ if _config . current_function and client .resolved_capabilities .document_symbol then
90
91
vim .api .nvim_command (' augroup lsp_aucmds' )
91
92
vim .api .nvim_command (
92
93
' au CursorHold <buffer> lua require("lsp-status").update_current_function()'
Original file line number Diff line number Diff line change @@ -82,9 +82,11 @@ local function statusline_lsp()
82
82
83
83
local base_status = vim .trim (table.concat (status_parts , ' ' ) .. ' ' .. table.concat (msgs , ' ' ))
84
84
local symbol = config .status_symbol .. ((some_diagnostics and only_hint ) and ' ' or ' ' )
85
- local current_function = vim .b .lsp_current_function
86
- if current_function and current_function ~= ' ' then
87
- symbol = symbol .. ' (' .. current_function .. ' ) '
85
+ if config .current_function then
86
+ local current_function = vim .b .lsp_current_function
87
+ if current_function and current_function ~= ' ' then
88
+ symbol = symbol .. ' (' .. current_function .. ' ) '
89
+ end
88
90
end
89
91
90
92
if base_status ~= ' ' then
You can’t perform that action at this time.
0 commit comments