vim-lsp
vim-lsp copied to clipboard
Borders are rendered with ASCII characters even if non-ASCII border characters have single width
Hi. Thanks for your great developing. No vim-lsp, no my Vim life.
I have an issue that floating window borders are always rendered with ASCII characters if ambiwidth
option is double
. But non-ASCII border characters, e.g., ─
, ┌
, and so on, can have single width even if ambiwidth
is double
. For example, setcellwidths([[0x2500, 0x257f, 1]])
makes the non-ASCII border characters single width. I usually set ambiwidth
as double
for some Japanese symbols and use setcellwidths()
for preventing broken layout. But I want to show borders with non-ASCII characters.
I think there are some choices:
- Use
strdisplaywidth()
instead ofambiwidth
- Use non-ASCII characters if
strdisplaywidth()
returns1
- Use non-ASCII characters if
- Add an configuration variable for whether ASCII or non-ASCII is used for borders
- e.g.,
let g:lsp_borders_with_ascii = v:false
- e.g.,
- Add an configuration varaible what characters to use for borders
- e.g.,
let g:lsp_border_characters = ['─', '│', '─', '│', '┌', '┐', '┘', '└']
- e.g.,
- Add an configuration variable for popup options
- e.g.,
let g:lsp_float_options = { 'borderchars': ['─', '│', '─', '│', '┌', '┐', '┘', '└'] }
- e.g.,
- Any other ideas?
Could you please give me feedbacks or your thoughts?
Best regards.
Note: I tried to change border characters with lsp_float_opened
user event and popup_setoptions()
as following.
autocmd User lsp_float_opened call OnFloatOpened()
function OnFloatOpened() abort
let winid = lsp#ui#vim#output#getpreviewwinid()
if winid
call popup_setoptions(winid, #{
borderchars: ['─', '│', '─', '│', '┌', '┐', '┘', '└'],
padding: [0, 0, 0, 1],
})
endif
endfunction
But it sometimes doesn't work:
- Signature helps in Insert mode: OK
- Hover in Normal mode with
:LspHover
: NG (ASCII characters are used) - Previews on completion: NG (ASCII characters are used)
Maybe, this difference is caused because the signature helps are implemented in autoload/lsp/ui/vim/output.vim#L117-L162
but hover and completion previews are implemented in autoload/vital/_lsp/VS/Vim/Window/FloatingWindow.vim#L451-L477
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.