[vim/vim] getloclist does not return an empty dictionary when there is no location list (#6990)

7 views
Skip to first unread message

Nate Bosch

unread,
Sep 20, 2020, 4:30:27 PM9/20/20
to vim/vim, Subscribed

The documentation for getloclist states:

Returns an empty Dictionary if there is no location list for the window {nr} or the window is not present.

https://github.com/vim/vim/blob/b816dae16dbeec91ccb6fd1c0289b86b4ad5d7b3/runtime/doc/eval.txt#L5478-L5479

However there is either always an empty location list to start, or a non-empty dictionary is returned when there is no list.

Reproduction steps:

vim -u NONE
:echo getloclist(1, {'all': 0})

Expected: {}

Actual: {'changedtick': 0, 'context': '', 'quickfixtextfunc': '', 'filewinid': 0, 'qfbufnr': 0, 'items': [], 'id': 0, 'nr': 0, 'winid': 0, 'idx': 0, 'title': '', 'size': 0}

The same result if I add a location list and then call setloclist(1, [], 'f'), I expect that getloclist would then return an empty dictionary.

Vim version: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 20 2020 13:11:17) Included patches: 1-1718


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Yegappan Lakshmanan

unread,
Sep 20, 2020, 4:51:11 PM9/20/20
to vim_dev, reply+ACY5DGDSBSVGRMEP2N...@reply.github.com, vim/vim, Subscribed
Hi Nate,

On Sun, Sep 20, 2020 at 1:30 PM Nate Bosch <vim-dev...@256bit.org> wrote:

The documentation for getloclist states:

Returns an empty Dictionary if there is no location list for the window {nr} or the window is not present.

https://github.com/vim/vim/blob/b816dae16dbeec91ccb6fd1c0289b86b4ad5d7b3/runtime/doc/eval.txt#L5478-L5479


The documentation needs to be updated. If the specified window is not present, then returns an
empty dictionary. If the location list is not present, then returns default values for all the items.

This is to be consistent with the quickfix stack which cannot be deleted unlike the location list stack.

- Yegappan

vim-dev ML

unread,
Sep 20, 2020, 4:51:28 PM9/20/20
to vim/vim, vim-dev ML, Your activity

Hi Nate,

On Sun, Sep 20, 2020 at 1:30 PM Nate Bosch <vim-dev...@256bit.org>
wrote:

> The documentation for getloclist states:
>
> Returns an empty Dictionary if there is no location list for the window
> {nr} or the window is not present.
>
>
> https://github.com/vim/vim/blob/b816dae16dbeec91ccb6fd1c0289b86b4ad5d7b3/runtime/doc/eval.txt#L5478-L5479
>

The documentation needs to be updated. If the specified window is not
present, then returns an
empty dictionary. If the location list is not present, then returns default
values for all the items.

This is to be consistent with the quickfix stack which cannot be deleted
unlike the location list stack.

- Yegappan


lacygoill

unread,
Sep 27, 2020, 7:49:23 AM9/27/20
to vim/vim, vim-dev ML, Comment

Fixed by 8.2.1727. The commit fixed another issue – hence why the message seems irrelevant – but the documentation was still updated in it.


You are receiving this because you commented.

Christian Brabandt

unread,
Sep 27, 2020, 11:39:02 AM9/27/20
to vim/vim, vim-dev ML, Comment

Closed #6990.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages