Skip to content
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

Completion is broken #50

Open
MaxGyver83 opened this issue Sep 28, 2020 · 1 comment
Open

Completion is broken #50

MaxGyver83 opened this issue Sep 28, 2020 · 1 comment

Comments

@MaxGyver83
Copy link

Sometimes, when I edit fish files, I get this error many times:

Error detected while processing function fish#Complete:
line    8:
E484: Can't open file /tmp/vCliDT0/13
Press ENTER or type command to continue

What I did:

vim /tmp/test.fish
iif test -e "/ca

Then this error occurs after every character I type.

I also have vim-mucomplete installed. So vim tries to autocomplete.

@MaxGyver83
Copy link
Author

Meanwhile I know this issue has nothing to do with vim-mucomplete. This is how to reproduce:

Create a file named ~/.vim/fish-test.vim:

set nocompatible
set runtimepath=$VIMRUNTIME
set runtimepath+=~/.vim/pack/plugins/start/vim-fish
set omnifunc=fish#Complete

Run vim -u ~/.vim/fish-test.vim /tmp/test.fish. Switch to insert mode and type "te. Press Ctrl-x Ctrl-o for autocompletion. This causes the error from my initial post.

I found a similar issue in another plugin:
kristijanhusak/vim-js-file-import#31

Apparently, it has to do with doubles quotes in fish. This patch doesn't fix this issue but at least it occurs less often:

diff --git a/autoload/fish.vim b/autoload/fish.vim
index 2c4d894..199e155 100644
--- a/autoload/fish.vim
+++ b/autoload/fish.vim
@@ -48,9 +48,10 @@ function! fish#Complete(findstart, base)
         if empty(a:base)
             return []
         endif
+        let l:base = substitute(a:base, '"', "'", "")
         let l:results = []
         let l:completions =
-                    \ system('fish -c "complete -C'.shellescape(a:base).'"')
+                    \ system('fish -c "complete -C'.shellescape(l:base).'"')
         let l:cmd = substitute(a:base, '\v\S+$', '', '')
         for l:line in split(l:completions, '\n')
             let l:tokens = split(l:line, '\t')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant