phpactor: Windows gVim 8.1.1 - "phpactor returned an error"
Hi,
Any idea why I get the error below when I issue the :call phpactor#Status() command?
I installed the plugin with minpac and the dependencies manually, inside the phpactor directory. Thanks!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 25
This plugin does not work at all in windows environment because it cannot find files with windows style paths
e:\this\that/.phpactor.json. Error:This is error I get when run
:call phpactor#Status()I just clean-clone the repo (default branch: develop) and this “Path is not absolute” error is still present, making
phpactorcompletely unusable in Windows.In most case I prefer using
DIRECTORY_SEPARATORinstead of hard-coded/when I’m dealing with filesystem paths, but if it’s necessary to use/(likeAbsolutePathCandidate.phpdid),is a valid path string in windows and
parse_urlcan correctly understand it:This may still affects a lot of code, but at least it allow
/to be used across major platforms.Tried to change on
Result on This.
C:\Users\hetao.vim\plugged\phpactor>php bin\phpactor status -vvv
In TextDocumentUri.php line 45:
[Phpactor\TextDocument\Exception\InvalidUriException] Only “file://” scheme is supported, got “C”
Exception trace: at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\text-document\lib\TextDocumentUri.php:45 Phpactor\TextDocument\TextDocumentUri::fromString() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\file-path-resolver-extension\lib\FilePathResolverExtension.php:132 Phpactor\FilePathResolverExtension\FilePathResolverExtension::calculateProjectId() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\file-path-resolver-extension\lib\FilePathResolverExtension.php:102 Phpactor\FilePathResolverExtension\FilePathResolverExtension->Phpactor\FilePathResolverExtension{closure}() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\container\lib\PhpactorContainer.php:79 Phpactor\Container\PhpactorContainer->get() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\file-path-resolver-extension\lib\FilePathResolverExtension.php:95 Phpactor\FilePathResolverExtension\FilePathResolverExtension->Phpactor\FilePathResolverExtension{closure}() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\container\lib\PhpactorContainer.php:79 Phpactor\Container\PhpactorContainer->get() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\file-path-resolver-extension\lib\FilePathResolverExtension.php:67 Phpactor\FilePathResolverExtension\FilePathResolverExtension->Phpactor\FilePathResolverExtension{closure}() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\container\lib\PhpactorContainer.php:79 Phpactor\Container\PhpactorContainer->get() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\source-code-filesystem-extension\lib\SourceCodeFilesystemExtension.php:95 Phpactor\Extension\SourceCodeFilesystem\SourceCodeFilesystemExtension->projectRoot() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\source-code-filesystem-extension\lib\SourceCodeFilesystemExtension.php:69 Phpactor\Extension\SourceCodeFilesystem\SourceCodeFilesystemExtension->Phpactor\Extension\SourceCodeFilesystem{closure}() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\container\lib\PhpactorContainer.php:79 Phpactor\Container\PhpactorContainer->get() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\source-code-filesystem-extension\lib\SourceCodeFilesystemExtension.php:53 Phpactor\Extension\SourceCodeFilesystem\SourceCodeFilesystemExtension->Phpactor\Extension\SourceCodeFilesystem{closure}() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\container\lib\PhpactorContainer.php:79 Phpactor\Container\PhpactorContainer->get() at C:\Users\hetao.vim\plugged\phpactor\lib\Extension\Core\CoreExtension.php:134 Phpactor\Extension\Core\CoreExtension->Phpactor\Extension\Core{closure}() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\container\lib\PhpactorContainer.php:79 Phpactor\Container\PhpactorContainer->get() at C:\Users\hetao.vim\plugged\phpactor\lib\Extension\Core\CoreExtension.php:87 Phpactor\Extension\Core\CoreExtension->Phpactor\Extension\Core{closure}() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\container\lib\PhpactorContainer.php:79 Phpactor\Container\PhpactorContainer->get() at C:\Users\hetao.vim\plugged\phpactor\vendor\symfony\console\CommandLoader\ContainerCommandLoader.php:45 Symfony\Component\Console\CommandLoader\ContainerCommandLoader->get() at C:\Users\hetao.vim\plugged\phpactor\vendor\phpactor\console-extension\lib\PhpactorCommandLoader.php:11 Phpactor\Extension\Console\PhpactorCommandLoader->get() at C:\Users\hetao.vim\plugged\phpactor\vendor\symfony\console\Application.php:541 Symfony\Component\Console\Application->has() at C:\Users\hetao.vim\plugged\phpactor\vendor\symfony\console\Application.php:634 Symfony\Component\Console\Application->find() at C:\Users\hetao.vim\plugged\phpactor\vendor\symfony\console\Application.php:235 Symfony\Component\Console\Application->doRun() at C:\Users\hetao.vim\plugged\phpactor\lib\Application.php:53 Phpactor\Application->doRun() at C:\Users\hetao.vim\plugged\phpactor\vendor\symfony\console\Application.php:147 Symfony\Component\Console\Application->run() at C:\Users\hetao.vim\plugged\phpactor\bin\phpactor:41
I pushed a fix for the AbsolutePathCandidate one https://github.com/phpactor/config-loader/commit/2962044a76d87dd60896bba060b2c0c6b7ece69d
But for the first is more tricky, and without a test setup not sure how to proceed: we expect either a URI
file:///path/to/my/thingor a unix path/path/to/my/thingand theparse_uriwill interpret windows path withcas the scheme and fail.So, probably need to introduce some custom logic to detect a window path and canonicalize it (with
Webmozart\PathUtil\Path:cannonicalize($path))The relevant code is here if you want to try and implement it and see if you can get Phpactor working on Windows (I’d hope that this would cover most of the cases … but not sure)
hmm, this looks like a VIM environment problem in Windows, at least from the CLI version. This google search indicates that this might be a problem with your
.batfiles I guess.You could also try running the “Linux Subsystem for Windows”.
Unfortunately I don’t have access to a Windows box, so I can’t test this further. Please update if you get any further 😃
VIM - Vi IMproved 8.1 (2018 May 18, compiled May 18 2018 18:36:07) MS-Windows 32-bit GUI version with OLE support Included patches: 1 Compiled by mool@tororo Huge version with GUI. Features included (+) or not (-): +acl +emacs_tags +mouse
+tag_binary +arabic +eval +mouseshape
+tag_old_static +autocmd +ex_extra +multi_byte_ime/dy n -tag_any_white +autoservername +extra_search +multi_lang