-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discard quickfix errors when quickfix doesn't locate a file to jump to #547
Conversation
Hi @athuth Thanks for the PR. Can you please give more detail what was wrong and what this is now fixing for us? I don't know if it's a good idea to check all existing files if they exist or not. This could slow down the overall performance. |
Hey @fatih - here's a playground snippet that will show the behavior this is trying to fix with Say you're working on a project and you want to show some trace/info/warning lines at runtime, something important enough to print but not important enough to save to a file. Unless your project has only one or two files, you probably pass Using the As far as performance impact, I admit I haven't looked at it. Maybe someone who has a large Go project can try it out and see if it makes a noticeable difference; I'm just starting to get into Go so I have nothing big to test it on, and didn't notice any change with only a few items in the QuickFix list. Important to keep in mind, it only checks files that show up in the QuickFix list, which normally would not be every file in the project. And QuickFix has to process each of these items, and create unlisted buffers for all the files it finds, currently, so if you drop some items from the qflist you save some processing by QuickFix. I could be better about avoiding redundant calls to
That might be a smarter approach, but it's a bit less straightforward and I don't know how it would affect performance, or if it even needs to be optimized. |
Hi @athuth Thanks for tackling this issue, much appreciated! I have two things in mind:
|
@fatih Both good points.
|
if !has_key(is_readable, filename) | ||
let is_readable[filename] = filereadable(filename) | ||
endif | ||
if is_readable[filename]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to drop the :
at the end, it's not a valid syntax.
Thanks @athuth I've pulled and test it. There was an error with the I think this is a wonderful contribution. Thank you that you put your time here, much appreciated 👍 |
Fix for #287 When a line of output is parsed incorrectly as an error message, the quickfix feature of Vim creates an unlisted buffer containing a bad filename. On jumping to this item with `cc`, a blank, unsaved file is opened in the active window. It is never useful to jump to a nonexistent file from quickfix and users unused to navigating buffers in Vim may have trouble figuring out what happened. Since the line of output that was parsed may still be an important error message, rather than silently dropping it from the quickfix window, echo a message for each bad filename dropped in this way. (Known issue: If `cc 1` jumps to a new buffer immediately, the message `"{filename}" {linenumber}L, {colnumber}C` hides the drop messages.) While looping through qflist items, avoid checking the same `filename` more than once by remembering the return values of previous calls to `filereadable` during the current execution of `:GoRun`. Add comments to explain the compiler errorformat strings. Patterns must be appended in separate statements in order to use inline comments here.
@fatih That's what I get for being lazy and testing changes in the installed plugin, then typing them directly into the GitHub web interface, instead of just cloning the branch locally to begin with. Lesson learned. Fixed and squashed. I'm happy to be able to contribute. |
Discard quickfix errors when quickfix doesn't locate a file to jump to
Thanks @athuth, merged 👍 |
Tries to fix #287 by dropping from the QuickFix list any items that don't locate existing files.
Known issue: If
cc 1
jumps to a new buffer immediately, the open-buffer message"{filename}" {linenumber}L, {colnumber}C
hides the messages that tell the user about the dropped errors. Haven't been able to figure out how to get around that. The messages are just a little "extra" anyway.Please review when able and let me know if you find any other issues.