coc: Show the current function in section_x

coc.nvim exposes the name of the function the cursor is currently in
through b:coc_current_function.

For this to work, the key coc.preferences.currentFunctionSymbolAutoUpdate
must be set to 'true' in the coc config.

The value is only updated on CursorHold, so the value may not always be
accurate when moving around.
This commit is contained in:
patrick96
2021-03-20 00:42:46 +01:00
parent 09dbd09ed3
commit 7d6adf9cc5
4 changed files with 13 additions and 3 deletions

View File

@@ -34,7 +34,7 @@ describe 'init sections'
end
it 'section x should be filetype'
Expect g:airline_section_x == '%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}'
Expect g:airline_section_x == '%#__accent_bold#%#__restore__#%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#prepend("",0)}%{airline#util#wrap(airline#parts#filetype(),0)}'
end
it 'section y should be fenc and ff'
@@ -81,6 +81,7 @@ describe 'init sections'
Expect airline#parts#get('languageclient_error_count').raw == ''
Expect airline#parts#get('languageclient_warning_count').raw == ''
Expect airline#parts#get('coc_status').raw == ''
Expect airline#parts#get('coc_current_function').raw == ''
Expect airline#parts#get('vista').raw == ''
Expect airline#parts#get('coc_warning_count').raw == ''
Expect airline#parts#get('coc_error_count').raw == ''