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

Lazy command argument get droped. #307

Open
hulucc opened this issue Jan 4, 2020 · 3 comments
Open

Lazy command argument get droped. #307

hulucc opened this issue Jan 4, 2020 · 3 comments

Comments

@hulucc
Copy link

hulucc commented Jan 4, 2020

For example if i run

AsyncRun go test -v -run "TestProxy$" ./pkg/proxy

After the volt lazy snippet

command -complete=customlist,s:__volt_complete -bang -bar -range -nargs=* AsyncRun call s:__volt_lazy_load_excmd('AsyncRun', <q-args>, expand('<bang>'), expand('<line1>'), expand('<line2>'))

Argument the function actually get

go test -v -run

And after some trail and error, i find out that removing the -bang from snippet could fix the problem. But i don't actually understand what's happending here. please have a check.

Volt config

[alias]
# You can use `volt update` in addition to `volt get -u`
update = ["get", "-u"]

[build]
# * "symlink" (default): "volt build" creates symlinks "~/.vim/pack/volt/opt/<repos>" referring to "$VOLTPATH/repos/<repos>"
# * "copy": "volt build" copies "$VOLTPATH/repos/<repos>" files to "~/.vim/pack/volt/opt/<repos>"
strategy = "copy"

[get]
# * true (default): "volt get" creates skeleton plugconf file at "$VOLTPATH/plugconf/<repos>.vim"
# * false: It does not creates skeleton plugconf file
create_skeleton_plugconf = true

# * true (default): When "volt get" or "volt get -u" fail and "git" command is
#                   installed, it tries to execute "git clone" or "git pull" as a fallback
# * false: "volt get" or "volt get -u" won't try to execute fallback commands
fallback_git_cmd = true

Async Plugin config

" vim:et:sw=2:ts=2

function! s:on_load_pre()
  " Plugin configuration like the code written in vimrc.
  " This configuration is executed *before* a plugin is loaded.
  let g:asyncrun_open = 12
  let g:asyncrun_status = "stopped" 
  let g:asyncrun_save = 2
  if exists('g:loaded_airline')
      let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
  endif
  command! ToggleQuickFix call asyncrun#quickfix_toggle(12)

  au BufWritePre * :execute g:asyncrun_status ==# 'running' ? 'AsyncStop' : ''
  au FileType qf setlocal nobuflisted
  au FileType qf setlocal wrap
  "let g:asyncrun_encs = 'gbk'

endfunction

function! s:on_load_post()
  " Plugin configuration like the code written in vimrc.
  " This configuration is executed *after* a plugin is loaded.
endfunction

function! s:loaded_on()
  " This function determines when a plugin is loaded.
  "
  " Possible values are:
  " * 'start' (a plugin will be loaded at VimEnter event)
  " * 'filetype=<filetypes>' (a plugin will be loaded at FileType event)
  " * 'excmd=<excmds>' (a plugin will be loaded at CmdUndefined event)
  " <filetypes> and <excmds> can be multiple values separated by comma.
  "
  " This function must contain 'return "<str>"' code.
  " (the argument of :return must be string literal)

  return 'excmd=AsyncRun,AsyncStop,ToggleQuickFix'
endfunction

function! s:depends()
  " Dependencies of this plugin.
  " The specified dependencies are loaded after this plugin is loaded.
  "
  " This function must contain 'return [<repos>, ...]' code.
  " (the argument of :return must be list literal, and the elements are string)
  " e.g. return ['github.com/tyru/open-browser.vim']

  return []
endfunction
@tyru
Copy link
Member

tyru commented Jan 6, 2020

It should be caused by -bar.
-bar skips string after " as vim script comment.

:AsyncRun1 and :AsyncRun3 outputs go test -v -run "TestProxy$" ./pkg/proxy.
but :AsyncRun2 outputs go test -v -run`.

command! -nargs=* AsyncRun1 echom <q-args>
command! -nargs=* -bar AsyncRun2 echom <q-args>
command! -nargs=* -bang AsyncRun3 echom <q-args>

" Output "go test -v -run "TestProxy$" ./pkg/proxy":
"   :AsyncRun1 go test -v -run "TestProxy$" ./pkg/proxy
"   :AsyncRun3 go test -v -run "TestProxy$" ./pkg/proxy
" Output "go test -v -run":
"   :AsyncRun2 go test -v -run "TestProxy$" ./pkg/proxy

Volt should provide a way to add -bar or not.

@tyru
Copy link
Member

tyru commented Jan 6, 2020

This is off-topic, but Do you have any reason to use strategy = "copy"?
It is little slow, because copying all files in repositories
but strategy = "symlink" (default) just creates a directory symlink to repositories.
That is not deprecated option, I just want to know the reason.

@hulucc
Copy link
Author

hulucc commented Jan 6, 2020

Because symlink is extremly slow on every volt build even nothing changed in the past(i guess its doing full build every time) .
And just now I find the problem has been fixed in new version, so now I'm using symlink

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

2 participants