wincent / command-t

⌨️ Fast file navigation for Neovim and Vim
BSD 2-Clause "Simplified" License
2.74k stars 317 forks source link

Error detected while processing function commandt#private#AcceptSelection[1]..provider#ruby#Call: #338

Closed p-se closed 2 years ago

p-se commented 6 years ago

When opening command-t and selecting a file, the error occurs:

/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/session.rb:63:in `block in request'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/session.rb:107:in `main_thread_only'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/session.rb:48:in `request'          
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/api.rb:84:in `call'       
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/client.rb:34:in `method_missing'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider/vim.rb:19:in `public_send'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider/vim.rb:19:in `method_missing'
/home/user/.config/nvim/plugged/command-t/ruby/command-t/lib/command-t/finder.rb:43:in `open_selection'
/home/user/.config/nvim/plugged/command-t/ruby/command-t/lib/command-t/controller.rb:473:in `open_selection'
/home/user/.config/nvim/plugged/command-t/ruby/command-t/lib/command-t/controller.rb:237:in `accept_selection'
(eval):3:in `accept_selection'                                                                                
eval:1:in `<main>'            
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:45:in `eval'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:45:in `block (2 levels) in __define_ruby_execute'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:101:in `block (2 levels) in __wrap_client'       
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:123:in `__with_std_streams'               
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:100:in `block in __wrap_client'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:109:in `__with_exception_handling'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:99:in `__wrap_client'             
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/ruby_provider.rb:44:in `block in __define_ruby_execute'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/plugin/handler.rb:51:in `call'                         
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/host.rb:98:in `block in wrap_plugin_handler'
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/host.rb:36:in `handle'                      
/var/lib/gems/2.5.0/gems/neovim-0.7.1/lib/neovim/host.rb:28:in `block in run'
Error detected while processing function commandt#private#AcceptSelection[1]..provider#ruby#Call:
line   17:                                                                                       
RuntimeError: Vim(edit):E325: ATTENTION
Press ENTER or type command to continue

It'll still open the file. :UpdateRemotePlugins didn't help.

domo84 commented 5 years ago

I'm having the same issue. For me it happens when there is a swap file in place. We both seem to be using neovim. Using version 5.0.3 and neovim 0.3.2

NAlexPear commented 5 years ago

Confirming that I get this error as well on command-t 5.0.3 and neovim 0.3.1 on macOS when editing files with swap files.

After this ☝️ output, the selected file is opened in read-only mode.

wincent commented 5 years ago

I haven't seen this one before, but it seems likely caused by a stale swapfile lying around:

*11.3*  Crashed or not?                 *ATTENTION* *E325*

Vim tries to protect you from doing stupid things.  Suppose you innocently
start editing a file, expecting the contents of the file to show up.  Instead,
Vim produces a very long message:

        E325: ATTENTION ~
    Found a swap file by the name ".main.c.swp" ~
          owned by: mool   dated: Tue May 29 21:09:28 2001 ~
         file name: ~mool/vim/vim6/src/main.c ~
          modified: no ~
         user name: mool   host name: masaka.moolenaar.net ~
        process ID: 12559 (still running) ~
    While opening file "main.c" ~
             dated: Tue May 29 19:46:12 2001 ~
 ~
    (1) Another program may be editing the same file. ~
        If this is the case, be careful not to end up with two ~
        different instances of the same file when making changes. ~
        Quit, or continue with caution. ~
 ~
    (2) An edit session for this file crashed. ~
        If this is the case, use ":recover" or "vim -r main.c" ~
        to recover the changes (see ":help recovery"). ~
        If you did this already, delete the swap file ".main.c.swp" ~
        to avoid this message. ~

You get this message, because, when starting to edit a file, Vim checks if a
swap file already exists for that file.  If there is one, there must be
something wrong.  It may be one of these two situations.

1. Another edit session is active on this file.  Look in the message for the
   line with "process ID".  It might look like this:

        process ID: 12559 (still running) ~

   The text "(still running)" indicates that the process editing this file
   runs on the same computer.  When working on a non-Unix system you will not
   get this extra hint.  When editing a file over a network, you may not see
   the hint, because the process might be running on another computer.  In
   those two cases you must find out what the situation is yourself.
      If there is another Vim editing the same file, continuing to edit will
   result in two versions of the same file.  The one that is written last will
   overwrite the other one, resulting in loss of changes.  You better quit
   this Vim.

2. The swap file might be the result from a previous crash of Vim or the
   computer.  Check the dates mentioned in the message.  If the date of the
   swap file is newer than the file you were editing, and this line appears:

        modified: YES ~

   Then you very likely have a crashed edit session that is worth recovering.
      If the date of the file is newer than the date of the swap file, then
   either it was changed after the crash (perhaps you recovered it earlier,
   but didn't delete the swap file?), or else the file was saved before the
   crash but after the last write of the swap file (then you're lucky: you
   don't even need that old swap file).  Vim will warn you for this with this
   extra line:

      NEWER than swap file! ~

UNREADABLE SWAP FILE

Sometimes the line

    [cannot be read] ~

will appear under the name of the swap file.  This can be good or bad,
depending on circumstances.

It is good if a previous editing session crashed without having made any
changes to the file.  Then a directory listing of the swap file will show
that it has zero bytes.  You may delete it and proceed.

It is slightly bad if you don't have read permission for the swap file.  You
may want to view the file read-only, or quit.  On multi-user systems, if you
yourself did the last changes under a different login name, a logout
followed by a login under that other name might cure the "read error".  Or
else you might want to find out who last edited (or is editing) the file and
have a talk with them.

It is very bad if it means there is a physical read error on the disk
containing the swap file.  Fortunately, this almost never happens.
You may want to view the file read-only at first (if you can), to see the
extent of the changes that were "forgotten".  If you are the one in charge of
that file, be prepared to redo your last changes.

WHAT TO DO?                 *swap-exists-choices*

If dialogs are supported you will be asked to select one of six choices:

  Swap file ".main.c.swp" already exists! ~
  [O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort, (D)elete it: ~

O  Open the file readonly.  Use this when you just want to view the file and
   don't need to recover it.  You might want to use this when you know someone
   else is editing the file, but you just want to look in it and not make
   changes.

E  Edit the file anyway.  Use this with caution!  If the file is being edited
   in another Vim, you might end up with two versions of the file.  Vim will
   try to warn you when this happens, but better be safe then sorry.

R  Recover the file from the swap file.  Use this if you know that the swap
   file contains changes that you want to recover.

Q  Quit.  This avoids starting to edit the file.  Use this if there is another
   Vim editing the same file.
      When you just started Vim, this will exit Vim.  When starting Vim with
   files in several windows, Vim quits only if there is a swap file for the
   first one.  When using an edit command, the file will not be loaded and you
   are taken back to the previously edited file.

A  Abort.  Like Quit, but also abort further commands.  This is useful when
   loading a script that edits several files, such as a session with multiple
   windows.

D  Delete the swap file.  Use this when you are sure you no longer need it.
   For example, when it doesn't contain changes, or when the file itself is
   newer than the swap file.
      On Unix this choice is only offered when the process that created the
   swap file does not appear to be running.

If you do not get the dialog (you are running a version of Vim that does not
support it), you will have to do it manually.  To recover the file, use this
command: >

    :recover

Vim cannot always detect that a swap file already exists for a file.  This is
the case when the other edit session puts the swap files in another directory
or when the path name for the file is different when editing it on different
machines.  Therefore, don't rely on Vim always warning you.

If you really don't want to see this message, you can add the 'A' flag to the
'shortmess' option.  But it's very unusual that you need this.

For programatic access to the swap file, see |swapinfo()|.

So, it seems you could skip such warnings by adding "A" to the 'shortmess' option. It's also possible that Command-T could catch and swallow this kind of error, but some might deem that a bit too aggressive, so it might be better to document this under the trouble-shooting section instead.

wincent commented 2 years ago

Given the big rewrite for v6.0.x, I'm closing all older issues as there is unlikely to be anything significant happening on the 5-x-devel branch from here on[^patches]. Feedback issue for 6.0.x is here:

[^patches]: Patches and PRs would be welcome, but my personal efforts are going to be directed towards main.