rking / ag.vim

Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack'
1.74k stars 131 forks source link

Error detected while processing function ag#Ag #57

Closed Doppp closed 5 years ago

Doppp commented 10 years ago

Ag works fine every now and then but then it breaks. It also always breaks for the same search strings.

screen shot 2014-05-21 at 4 26 03 pm

losingkeys commented 10 years ago

Odd. Do you have an example of a search string that breaks it? Also, :messages might show more information about the error, but it might just show the error in the screenshot.

Doppp commented 10 years ago

I'm currently working on the Adyen gem and searching for the string "authoriseResponse". Unfortunately :messages doesn't show anything. :(

Doppp commented 10 years ago

Also, this happens sporadically. I just tried it on my home computer and it works fine but at work it doesn't. Not too sure what is going on.

ezrasuki commented 10 years ago

I've just installed this plugin and am getting this error from the beginning. I just open up vim and try to execute :Ag "def index", and the screen goes blank. When i type enter, the following error message shows up.

Error detected while processing function ag#Ag:
line   28:
E325: ATTENTION
Press ENTER or type command to continue

If i try ignore the error and try the same command again, then it starts working. Could this have anything to do with using other plugins?

wjakob commented 10 years ago

I am encountering the same issue. I searched for -w nn.

srcoley commented 10 years ago

I am also experiencing this same issue. It's much faster than vimgrep. If I can provide any info to help with debugging, please let me know and I'll supply data.

srcoley commented 10 years ago

Just a heads up, I've commented out this line

echoe "Ag command '" . l:ag_executable . "' was not found. Is the silver searcher installed and on your $PATH?"

and now I'm able to use the plugin.

I'm on OS X 10.9.4, using MacVim's version of vim within iTerm2, inside of the Tmux session.

Hope some of this helps!

raine commented 10 years ago

I'm getting this as well, but not all the time.

mrfletch commented 10 years ago

Sorry to post late on this. I too am getting this error when I search for the word "offline". It happens every so often, not sure why. I too am using iTerm 2 on Mac OS X 10.9.4 if that helps.

@srcoley, may I ask where that line is? I'll try your solution to see if that fixes it for me.

srcoley commented 10 years ago

@mrfletch Here you go:

https://github.com/rking/ag.vim/blob/master/autoload/ag.vim#L33

losingkeys commented 10 years ago

@srcoley @Doppp @raine @wjakob @mrfletch Which OS/version of vim do you see this on? I haven't been able to reliably reproduce it yet (I'm not even sure that I've even reproduced it yet). Also, what's the value of your g:agprg? The line that @srcoley mentioned might depend on that. Thanks for commenting! Let's squash this bug once and for all :)

dpdawson commented 10 years ago

Happens when I search for "change".

I'm on OS X 10.9.5. Most recent Homebrew version of Vim. Just running in the normal terminal.

losingkeys commented 10 years ago

@dpdawson: which project is this? Is it OSS? Also which version of vim are you using? I'm not sure that it matters, but the latest in homebrew may change when I test this. Thanks!

On Mon, Oct 06, 2014 at 12:23:56AM -0700, dpdawson wrote:

Happens when I search for "change".

I'm on OS X 10.9.5. Most recent Homebrew version of Vim. Just running in the normal terminal.


Reply to this email directly or view it on GitHub: https://github.com/rking/ag.vim/issues/57#issuecomment-57982123

Joshua Hoff https://losingkeys.github.io

dpdawson commented 10 years ago

@losingkeys: It's a private rails app. Vim 7.4.430.

sirbrillig commented 10 years ago

I'm having the same bug as @ezrasuki. Mac OS 10.10, vim 7.4 (homebrew), ag 0.25.0 (homebrew), Vundle install of the plugin. Following the suggestion by @losingkeys, I added the following to my vimrc: let g:agprg='/usr/local/bin/ag'

This prevents the blank screen and shows the search results in my quickfix window, but it shows them as plain text (lines like || /path/to/file:200: line contents here) and therefore none of the edit/preview commands work correctly. This is happening because the results are not matching the grepformat since ag does not by default include the column numbers.

Changing the g:agprg to let g:agprg='/usr/local/bin/ag --column' causes the blank screen and error bug again, so I don't think the issue has to do with the path.

troygoode commented 10 years ago

@sirbrillig I have logged some more info about the issue you and I are both encountering at rking/ag.vim#69

losingkeys commented 9 years ago

Ok I think I've found out why some of this is happening. I tried searching for 'roll' in https://github.com/troygoode/node-roll (which I'm assuming was the project in the screenshots in #69). I couldn't get it to blank out the error list, but I could get this error:

E518: Unknown option: 2d6+1",

If you look at the package.json for that project (at the time of this writing), you'll see that there's an example in one of the strings. Unfortunately vim's interpreting it as a modeline. If this plugin opens that (using one of the keybindings, or automatically after searching), we'll get that error, because it's not really a modeline.

If you look at the first comment in this thread, you'll see that the screenshot says E325 ATTENTION, which is what you see sometimes when dealing with swap files in vim.

This plugin is trying to open matches and getting errors. I think we have a few options for fixes/workarounds:

What does everyone think? Also I'm not sure if there's another bug here. I've seen what's in #69 now, but am having troubles reproducing it now; that doesn't seem like it's encountering errors when opening files.

troygoode commented 9 years ago

@losingkeys yes, mode line is definitely tripping out over that so I've had set nomodeline specified in my vimrc for quite a while. Still encounter the same issue with ag.vim though.

losingkeys commented 9 years ago

Ok, I'll try to bring the errors to the front without clobbering the UI too much (right now we :redraw! after a search, so that'll need to go somewhere I think).

deeTEEcee commented 9 years ago

i get the same error searching specifically for "room_member?" when using "ag --literal." issue is caused by the question mark.

raine commented 9 years ago

Any progress on this one, @losingkeys?

losingkeys commented 9 years ago

Not yet. I'm planning to shuffle around the use of :redraw! in hopes of showing errors when auto-opening files (the first idea/bullet here: https://github.com/rking/ag.vim/issues/57#issuecomment-64069431).

raine commented 9 years ago

Any alternative to ag.vim that doesn't have this issue?

losingkeys commented 9 years ago

You could try https://github.com/mileszs/ack.vim with let g:ackprg="ag", though I'm not positive that'll work (it's been awhile since this wrapper was forked from ack.vim). Also this wrapper has some ag-specific commands, so you'd lose those.

I think https://github.com/rking/ag.vim/commit/e70e049bfd1f4dce1d55881c4eee3e4320121cfc fixes this issue (by ignoring errors generated by the search command), but I'm reopening this issue until we know for sure this is the fix, so the issue doesn't fall through the cracks.

@raine @deeTEEcee @troygoode @sirbrillig @dpdawson @mrfletch @srcoley @wjakob @Doppp: mind updating your copy of this plugin and checking if this fixes your issue or not?

raine commented 9 years ago

Thanks. I'm giving it a go and will report back.

raine commented 9 years ago

The error is gone but the weird behavior remains.

You just get no results until you press enter and then it opens some file as read-only.