[vim/vim] Proposal: Add end_lnum and end_col to quickfix entry (#8393)

22 views
Skip to first unread message

thinca

unread,
Jun 16, 2021, 12:40:01 PM6/16/21
to vim/vim, Subscribed

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.

Quickfix is ​​a common part of Vim, where many plugins output location information to here, and many plugins get location information from here.

The fact that the quickfix entry has range information creates orthogonality between plugins.

For example, we can create a plugin that properly highlights the range specified by quickfix.

For example, even if there are multiple errors on the same line, we can pop up the appropriate error message for the cursor position.

If quickfix doesn't have range information, we can only collect location information and highlight it in one plugin. This is because there is no way to pass information between plugins.

This pull request does not contain any changes regarding errorformat. I think it will be necessary eventually, but first I made a pull request at this stage to see if this proposal would be accepted.

What do you think about this?


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/8393

Commit Summary

  • Add end_lnum and end_col to quickfix

File Changes

Patch Links:


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

thinca

unread,
Jun 16, 2021, 12:52:33 PM6/16/21
to vim/vim, Push

@thinca pushed 1 commit.

  • 909665b Add end_lnum and end_col to quickfix


You are receiving this because you are subscribed to this thread.

View it on GitHub or unsubscribe.

thinca

unread,
Jun 16, 2021, 1:05:37 PM6/16/21
to vim/vim, Push

@thinca pushed 1 commit.

  • 2f777c5 Add end_lnum and end_col to quickfix


You are receiving this because you are subscribed to this thread.

codecov[bot]

unread,
Jun 16, 2021, 1:13:41 PM6/16/21
to vim/vim, Subscribed

Codecov Report

Merging #8393 (2f777c5) into master (41a7f82) will decrease coverage by 87.34%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@

##           master    #8393       +/-   ##

===========================================

- Coverage   89.85%    2.50%   -87.35%     

===========================================

  Files         149      147        -2     

  Lines      167465   162318     -5147     

===========================================

- Hits       150469     4068   -146401     

- Misses      16996   158250   +141254     
Flag Coverage Δ
huge-clang-none ?
huge-gcc-none ?
huge-gcc-testgui ?
huge-gcc-unittests 2.50% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/quickfix.c 0.00% <0.00%> (-94.87%) ⬇️
src/float.c 0.00% <0.00%> (-98.91%) ⬇️
src/sha256.c 0.00% <0.00%> (-97.96%) ⬇️
src/digraph.c 0.00% <0.00%> (-97.78%) ⬇️
src/gui_gtk_f.c 0.00% <0.00%> (-97.54%) ⬇️
src/match.c 0.00% <0.00%> (-97.13%) ⬇️
src/crypt_zip.c 0.00% <0.00%> (-97.06%) ⬇️
src/sound.c 0.00% <0.00%> (-97.00%) ⬇️
src/evalbuffer.c 0.00% <0.00%> (-96.83%) ⬇️
src/cmdhist.c 0.00% <0.00%> (-96.63%) ⬇️
... and 136 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41a7f82...2f777c5. Read the comment docs.

Bram Moolenaar

unread,
Jun 16, 2021, 3:37:19 PM6/16/21
to vim/vim, Subscribed

Thanks, this can be useful.
I'll let @yegappan make comments, he has been doing work on quickfix code.

Yegappan Lakshmanan

unread,
Jun 16, 2021, 8:47:30 PM6/16/21
to vim_dev, reply+ACY5DGCUJTCXVANB2Z...@reply.github.com, vim/vim, Subscribed
Hi,

On Wed, Jun 16, 2021 at 12:37 PM Bram Moolenaar <vim-dev...@256bit.org> wrote:

Thanks, this can be useful.
I'll let @yegappan make comments, he has been doing work on quickfix code.



The changes look good to me. Can  you add a few test cases for setqflist(),
getqflist(), :vimgrep, :helpgrep, :clist and :cwindow with the end line
number and column number?

Regards,
Yegappan

vim-dev ML

unread,
Jun 16, 2021, 8:47:45 PM6/16/21
to vim/vim, vim-dev ML, Your activity

Hi,

On Wed, Jun 16, 2021 at 12:37 PM Bram Moolenaar ***@***.***>

wrote:

> Thanks, this can be useful.
> I'll let @yegappan <https://github.com/yegappan> make comments, he has

> been doing work on quickfix code.
>
>
>
The changes look good to me. Can you add a few test cases for setqflist(),
getqflist(), :vimgrep, :helpgrep, :clist and :cwindow with the end line
number and column number?

Regards,
Yegappan

thinca

unread,
Jun 17, 2021, 1:31:41 AM6/17/21
to vim/vim, vim-dev ML, Comment

@brammool @yegappan Thank you for review! I'll try to add some tests later(maybe tonight).


You are receiving this because you commented.

thinca

unread,
Jun 17, 2021, 12:22:58 PM6/17/21
to vim/vim, vim-dev ML, Push

@thinca pushed 2 commits.

  • cd07c96 Tweak range text for quickfix
  • 79a76d6 Add some test cases for end_lnum and end_col


You are receiving this because you are subscribed to this thread.

thinca

unread,
Jun 17, 2021, 12:39:45 PM6/17/21
to vim/vim, vim-dev ML, Comment

I added some patterns to existing test cases. Is this enough?

I tweaked representation of range in quickfix window/:clist.

lnum end_lnum col end_col representation
yes no no no 10
yes no yes no 10 col 5
yes no yes yes 10 col 5-8
yes yes no no 10-12
yes yes yes no 10-12 col 5
yes yes yes yes 10-12 col 5-8


You are receiving this because you commented.

Yegappan Lakshmanan

unread,
Jun 17, 2021, 11:03:14 PM6/17/21
to vim_dev, reply+ACY5DGGVLTSNTHKQJ7...@reply.github.com, vim/vim, vim-dev ML, Comment
Hi,

On Thu, Jun 17, 2021 at 9:39 AM thinca <vim-dev...@256bit.org> wrote:

I added some patterns to existing test cases. Is this enough?


Yes. This looks good. Thanks for the patch and the tests.

Regards,
Yegappan

vim-dev ML

unread,
Jun 17, 2021, 11:03:30 PM6/17/21
to vim/vim, vim-dev ML, Your activity

Hi,


On Thu, Jun 17, 2021 at 9:39 AM thinca ***@***.***> wrote:

> I added some patterns to existing test cases. Is this enough?
>

Yes. This looks good. Thanks for the patch and the tests.

Regards,
Yegappan


> I tweaked representation of range in quickfix window/:clist.
> lnum end_lnum col end_col representation
> yes no no no 10
> yes no yes no 10 col 5
> yes no yes yes 10 col 5-8
> yes yes no no 10-12
> yes yes yes no 10-12 col 5
> yes yes yes yes 10-12 col 5-8
>
>
>

Shane-XB-Qian

unread,
Jun 19, 2021, 10:53:22 AM6/19/21
to vim/vim, vim-dev ML, Comment

@Shane-XB-Qian commented on this pull request.


In src/testdir/test_quickfix.vim:

> @@ -5281,7 +5308,7 @@ func Test_add_invalid_entry_with_qf_window()
   call setqflist(['bb'], 'a')
   call assert_equal(1, line('$'))
   call assert_equal(['Xfile1|10| aa'], getline(1, '$'))
-  call assert_equal([{'lnum': 10, 'bufnr': bufnr('Xfile1'), 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())
+  call assert_equal([{'lnum': 10, 'end_lnum': 0, 'bufnr': bufnr('Xfile1'), 'col': 0, 'end_col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())

what if 'end_lnum' and/or 'end_col' is '0' (or even was a negative value), then what's the getline(1, '$') ?
would it be still compatible like Xfile1|10| aa vs not Xfile1|10-0| aa ? the later case should be not wanted.


You are receiving this because you commented.

thinca

unread,
Jun 19, 2021, 12:13:40 PM6/19/21
to vim/vim, vim-dev ML, Comment

@thinca commented on this pull request.


In src/testdir/test_quickfix.vim:

> @@ -5281,7 +5308,7 @@ func Test_add_invalid_entry_with_qf_window()
   call setqflist(['bb'], 'a')
   call assert_equal(1, line('$'))
   call assert_equal(['Xfile1|10| aa'], getline(1, '$'))
-  call assert_equal([{'lnum': 10, 'bufnr': bufnr('Xfile1'), 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())
+  call assert_equal([{'lnum': 10, 'end_lnum': 0, 'bufnr': bufnr('Xfile1'), 'col': 0, 'end_col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())

Don't worry.
end_lnum and end_col are just optional values. The text in the quickfix window is never changed when they are zero. It will be displayed as before. See the comment above.


You are receiving this because you commented.

Shane-XB-Qian

unread,
Jun 19, 2021, 12:29:32 PM6/19/21
to vim/vim, vim-dev ML, Comment

@Shane-XB-Qian commented on this pull request.


In src/testdir/test_quickfix.vim:

> @@ -5281,7 +5308,7 @@ func Test_add_invalid_entry_with_qf_window()
   call setqflist(['bb'], 'a')
   call assert_equal(1, line('$'))
   call assert_equal(['Xfile1|10| aa'], getline(1, '$'))
-  call assert_equal([{'lnum': 10, 'bufnr': bufnr('Xfile1'), 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())
+  call assert_equal([{'lnum': 10, 'end_lnum': 0, 'bufnr': bufnr('Xfile1'), 'col': 0, 'end_col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'aa'}], getqflist())

ok, wish so.
i mean let it be part of that test too. :-)


You are receiving this because you commented.

Bram Moolenaar

unread,
Jun 19, 2021, 2:45:44 PM6/19/21
to vim/vim, vim-dev ML, Comment

Closed #8393 via 6864efa.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages