0

I'm trying to write a script that can get the signs in the sign column of a given buffer, I saw in the help that:

sign_getplaced([{expr} [, {dict}]])                     sign_getplaced()
                Return a list of signs placed in a buffer or all the buffers.
                This is similar to the :sign-place-list command.

                If the optional buffer name {expr} is specified, then only the
                list of signs placed in that buffer is returned.  For the use
                of {expr}, see bufname(). The optional {dict} can contain
                the following entries:
                   group        select only signs in this group
                   id           select sign with this identifier
                   lnum         select signs placed in this line. For the use
                                of {lnum}, see line().
                If {group} is '*', then signs in all the groups including the
                global group are returned. If {group} is not supplied or is an
                empty string, then only signs in the global group are
                returned.  If no arguments are supplied, then signs in the
                global group placed in all the buffers are returned.
                See sign-group.

To get all the signs in a given buffer (I want the lspconfig for now, but let's just say that all of them are okay for now).

:echo sign_getplaced(bufname())

shows: [{'signs': [], 'bufnr': 1}] which doesn't help

:echo sign_getplaced(bufname(), '*')

doesn't work, says "dictionary is required", sensible

:echo sign_getplaced(bufname(), {"group":'*'})

shows: [{'signs': [], 'bufnr': 1}] which also doesn't help

I need help to understand how to get the currently placed signs in a given buffer.

Noam E
  • 121
  • 1
  • 1
  • 4
  • The first and third commands are correct. If they return an empty list it means that there is no sign in the current buffer at the moment they are executed. – romainl Aug 29 '21 at 14:30
  • @romainl but there are a few, maybe it's a bug? the signs come from nvim-lsp – Noam E Aug 30 '21 at 11:50
  • If `sign_getplaced()` says there are no signs placed in the given buffer then there are no signs placed in the given buffer. Maybe what you see is not "signs" but something else. If you think this is a bug, open an issue on the appropriate issue tracker, hopefully with a minimum reproducible case. – romainl Aug 30 '21 at 11:57
  • I could find my sign by entering the correct groupname. I searched for `vimspector` breakpoints so I did `:echo sign_getplaced("filepath", {"group": "VimspectorBP"})`. – Dimfred Jan 19 '22 at 12:08

0 Answers0