1

As title. In :h setqflist there is no field end_lnum and end_col. While these options exist in :h getqflist . So my question is simple: If I cannot set it, how can I get it?

1 Answer 1

2

This feature was added in patch 8.2.3019.

Justification is given here as follows:

Modern tools may be able to specify a range when outputting the location of the source code.

LSP reports the location of errors etc. in the range. The Rust compiler can report error locations in a range. ripgrep can get information on the end position of the match in JSON format.

Currently (as of Jan/31/22), there is no automatic setting of end_lnum and end_col, it is purely user-specified (i.e., for use in plugins). There is a proposal to add %e and %k specifiers to allow parsing from an errorfile (for such tools that emit these fields).

If I cannot set it, how can I get it?

Actually, I think this is a documentation bug. setqflist does support end_lnum and end_col, it just isn't documented as such. Given the age of the patch, it is probably just an oversight or missed during documentation (runtime) updates by Bram.

6
  • "setqflist does support end_lnum and end_col, it just isn't documented as such": Could you provide the link to the source code? I didn't find it. Commented Jan 31, 2022 at 17:44
  • Is it stable to use these two fields now? Commented Jan 31, 2022 at 17:57
  • 1
    See github.com/vim/vim/blob/… and it sees to work for me: call setqflist([{'end_lnum': 20, 'end_col': 10}])|echo getqflist()
    – Mass
    Commented Feb 1, 2022 at 4:01
  • lol, I cannot believe that vi.stackexchange is better than reddit in terms of API professional level. Commented Feb 1, 2022 at 4:05
  • A little q: Do you know how to remove(is it even possible?) a single qflist, when there are many ones? Commented Feb 1, 2022 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.