Ale: quickfix list support for ALEFindReferences and commands for navigating through references

Created on 25 Jul 2018  路  10Comments  路  Source: dense-analysis/ale

If I've got a list of references then there's a decent chance that I'll want to cycle through them.

Suggest using the quickfix list on the grounds that: that's what cscope and YouCompleteMe both do in analogous situations, so it's probably what people are used to.

LSP enhancement

Most helpful comment

Just a hint for those (like me) longing for this feature: As a workaround, it's possible to use this workflow:

  • :ALEFindReference to open ALE's preview window
  • :cb (short for :cbuffer) to read the content of ALE's preview window into the quickfix list
  • you can now cycle using the standard quickfix commands (like :cn)
  • or use :copen to open and inspect the quickfix list

All 10 comments

It's not a good idea. The quickfix list can be used by ALE for displaying problems, and the quickfix list is used by many other plugins for many other reasons. It's better to use a custom buffer in the preview window to avoid any conflicts.

What could be proposed instead is adding some commands for cycling through the results of the last list of references that were fetched. That way you could cycle through references and also use the quickfix list for displaying problems at the same time.

A command for cycling through the references would do, I guess. Shall we just re-purpose this issue or would you like a fresh one?

I'm not convinced you're right about using the quickfix list being a bad idea though - so I'm going to take a slightly fuller run at persuading you.

  • ALE doesn't use the quickfix list for displaying problems by default. There's a perfectly sensible and default usage where the location list is used for problems and the quickfix list is used for references

    • It is true that ALE makes use of the location list configurable, and that if you give users enough rope then some of them will hurt themselves...

  • The quickfix is indeed used by many plugins for many purposes - and one of them is exactly this!

    • 'Other plugins use the quickfix list' is I think just not convincing. I mean other plugins use the location list too

    • As above, the use of the quickfix list that I propose here is actually rather standard

Perhaps, at least, an option to use the quickfix list for this purpose??

Okay, I think ALE can support two features.

  1. New commands for jumping between results for references.
  2. An option to show find references results in the quickfix list.

You could enable both the options for showing problems and references in the quickfix list, but then that will be your problem. The command for jumping around references should be designed so it always works, even when the references are put in the quickfix list.

If someone wants to create a pull request for implementing this, go for it. I might implement this eventually if it seems like it's fun enough.

I had thought about creating this same GH issue in the past, but I understand the benefits of keeping a separate list and work was already done to achieve that. However, I'd also prefer ALEFindReferences results to be in a QuickFix list:

  1. The ALEPreviewWindow doesn't display the contents of the line where the reference is found. This is helpful to differentiate between finding a function/class/variable in an import statement, versus finding a location where it's actually being used.
  2. The ALEPreviewWindow disappears once you jump to one of the results. Related to above, if the result I selected is not what I'm looking for, I can't get back to the results.
  3. As @dimbleby mentioned, it seems to be common to use the QuickFix window for a jumplist like this. So, I believe that users are accustomed to the QF interface, and also already have QF bindings to help with navigation.
  4. Less custom code that replicates, to an extent, existing functionality. Again, debatable, because I understand why you'd want a separate list. I just lean towards common conventions.

It might be good to add a command for re-opening the preview window too, similar to how Unite.vim let's you re-open search results.

FWIW I've filed a patch that fixes this if anyone's desperate: https://github.com/w0rp/ale/pull/2644

I would LOVE if there were commands for populating certain output into locationlist or quickfix on demand. So ALEFindReferences would go to ALE's preview window, but you could also have ALEFindReferencesQF ALEFindReferencesLL (or some other means of accomplishing this if that's not clean).

I have plenty customization for how I use ll/qf in my workflow and it's important. As long as you are not automatically setting list content without consent, which you shouldn't be unless opted-in, I agree, just let us manage what we put in our lists.

Just a hint for those (like me) longing for this feature: As a workaround, it's possible to use this workflow:

  • :ALEFindReference to open ALE's preview window
  • :cb (short for :cbuffer) to read the content of ALE's preview window into the quickfix list
  • you can now cycle using the standard quickfix commands (like :cn)
  • or use :copen to open and inspect the quickfix list
Was this page helpful?
0 / 5 - 0 ratings

Related issues

aressler38 picture aressler38  路  3Comments

ianchanning picture ianchanning  路  3Comments

glepnir picture glepnir  路  3Comments

plexigras picture plexigras  路  3Comments

sodiumjoe picture sodiumjoe  路  4Comments