Skip to content

Use sign_getplaced instead of :sign place when possible. #14

@aktau

Description

@aktau

There's a new signs API (available in Vim 8.1.0772 and in Neovim), it doesn't need text parsing to get at the juicy bits, unlike :signs place list.

Of course, wholesale moving to this easier-to-use API does mean the plugin wouldn't be compatible with older versions o (Neo)Vim anymore. Another option is conditional usage, though that likely only has the disadvantage of quasi-duplicating code.

I'm unsure whether it has performance benefits.

Usage of it in vim-lsp:

$ rg 'sign_[a-z_]*\('
autoload/lsp/ui/vim/signs.vim
55:    call sign_define(a:sign_name, l:options)
78:    call sign_undefine('LspError')
79:    call sign_undefine('LspWarning')
80:    call sign_undefine('LspInformation')
81:    call sign_undefine('LspHint')
104:    let l:sign_group = s:get_sign_group(a:server_name)
105:    call sign_unplace(l:sign_group, { 'buffer': a:path })
108:function! s:get_sign_group(server_name) abort
115:    let l:sign_group = s:get_sign_group(a:server_name)
125:                let l:sign_id = sign_place(0, l:sign_group, l:sign_name, a:path, { 'lnum': l:line })
   vim

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions