Skip to content

Commit 77c20db

Browse files
Adriaan Zonnenbergnoahfrederick
authored andcommitted
Remove leading backslash from class name before passing it to composer
This makes it possible to pass the result from `composer#namespace#expand()` to `s:find_file`, as done in https://github.com/noahfrederick/vim-composer/blob/734b90bff5b55d05a831756fa8e68d0dc1fb1944/autoload/composer/autoload.vim#L27-L32
1 parent bc19ddf commit 77c20db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

autoload/composer/autoload.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ function! s:find_file(fqn) abort
4747
call s:throw('autoload.php not found. Run composer install.')
4848
endif
4949

50+
let fqn = substitute(a:fqn, '^\', '', '')
5051
let s = '$c = require("' . autoload . '"); echo $c->findFile($argv[1]);'
51-
let path = system('php -r ' . shellescape(s) . ' ' . shellescape(a:fqn))
52+
let path = system('php -r ' . shellescape(s) . ' ' . shellescape(fqn))
5253

5354
if v:shell_error != 0
5455
call s:throw('Command exited with code %d', v:shell_error)

0 commit comments

Comments
 (0)