phpactor.el icon indicating copy to clipboard operation
phpactor.el copied to clipboard

Could not decode JSON

Open zhougts opened this issue 6 years ago • 8 comments

I get an error when calling the phpactor-goto-definition function:
json-read-string: Bad string format: "doesn't start with "'!" Phpactor Output:

In RpcCommand.php line 58:
                          
  Could not decode JSON:  
                          

rpc [--replay] [--pretty]

zhougts avatar Dec 10 '18 05:12 zhougts

Hi,

It might be helpful to look at the content of these buffers : Phpactor Output, Phpactor Input

Besides, how did you install phpactor.el and phpactor ?

We recently added the ability to install phpactor from phpactor.el and this should be the best way for phpactor.el to have a "known to work" version of phpactor.

kermorgant avatar Dec 11 '18 07:12 kermorgant

I installed it with use-package\

(use-package phpactor)

Then, I execute phpactor-update

zhougts avatar Dec 11 '18 07:12 zhougts

Then, I execute phpactor-update

Good. Could you please share the contents of "Phpactor Output" or "Phpactor Input" ?

kermorgant avatar Dec 11 '18 07:12 kermorgant

This is the output after I execute phpactor-update:

Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 40 installs, 0 updates, 0 removals
  - Installing ocramius/package-versions (1.3.0): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing symfony/polyfill-ctype (v1.9.0): Loading from cache
  - Installing symfony/filesystem (v3.4.15): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing microsoft/tolerant-php-parser (dev-master 7ea7734): Cloning 7ea773435b from cache
  - Installing phpactor/class-mover (dev-master 529a0c9): Cloning 529a0c9f4a from cache
  - Installing symfony/polyfill-mbstring (v1.9.0): Loading from cache
  - Installing twig/twig (v2.5.0): Loading from cache
  - Installing phpactor/code-builder (dev-master 68832ef): Cloning 68832ef137 from cache
  - Installing webmozart/assert (1.3.0): Loading from cache
  - Installing webmozart/path-util (2.3.0): Loading from cache
  - Installing phpactor/class-to-file (dev-master 5379835): Cloning 53798359f0 from cache
  - Installing phpactor/code-transform (dev-master 520f7a9): Cloning 520f7a99d4 from cache
  - Installing symfony/process (v4.1.4): Loading from cache
  - Installing symfony/options-resolver (v4.1.4): Loading from cache
  - Installing symfony/finder (v4.1.4): Loading from cache
  - Installing symfony/debug (v4.1.4): Loading from cache
  - Installing symfony/console (v3.4.15): Loading from cache
  - Installing seld/jsonlint (1.7.1): Loading from cache
  - Installing phpbench/dom (0.2.0): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing phpbench/container (1.2): Loading from cache
  - Installing lstrojny/functional-php (1.8.0): Loading from cache
  - Installing doctrine/annotations (v1.6.0): Loading from cache
  - Installing beberlei/assert (v3.0.0): Loading from cache
  - Installing phpbench/phpbench (dev-master 7a33cea): Cloning 7a33cea9dc from cache
  - Installing phpactor/docblock (dev-master ae0dd14): Cloning ae0dd14ff4 from cache
  - Installing jetbrains/phpstorm-stubs (dev-master eae9c1b): Cloning eae9c1b5b5 from cache
  - Installing phpactor/worse-reflection (dev-master b3c7fbc): Cloning b3c7fbc796 from cache
  - Installing phpactor/source-code-filesystem (dev-master a0b641b): Cloning a0b641b9ed from cache
  - Installing phpactor/completion (dev-master 3138e9d): Cloning 3138e9dc45 from cache
  - Installing phpactor/path-finder (dev-master 9375374): Cloning 9375374c41 from cache
  - Installing webmozart/glob (4.1.0): Loading from cache
  - Installing symfony/yaml (v3.4.15): Loading from cache
  - Installing sebastian/diff (2.0.x-dev abcc704): Cloning abcc70409d from cache
  - Installing monolog/monolog (1.23.0): Loading from cache
  - Installing dnoegel/php-xdg-base-dir (0.1): Loading from cache
  - Installing composer/xdebug-handler (1.3.0): Loading from cache
  - Installing phpactor/phpactor (0.9.0): Loading from cache
Generating optimized autoload files
Warning: Ambiguous class resolution, "Phpactor\CodeTransform\Adapter\WorseReflection\Transformer\AddMissingProperties" was found in both "C:/Users/admin/.emacs.d/elpa/phpactor-20181128.135/vendor/phpactor/code-transform/lib\Adapter\WorseReflection\Transformer\AddMissingMethods.php" and "C:/Users/admin/.emacs.d/elpa/phpactor-20181128.135/vendor/phpactor/code-transform/lib\Adapter\WorseReflection\Transformer\AddMissingProperties.php", the first will be used.
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class

I run phpactor-status: Phpactor Input:

{"action":"status","parameters":[]}

Phpactor Output:


In RpcCommand.php line 58:
                          
  Could not decode JSON:  
                          

rpc [--replay] [--pretty]

zhougts avatar Dec 11 '18 08:12 zhougts

I believe I had this issue, and resolved it by using my own clone of phpactor (which was up to date with master) - so it might be the case that this can be fixed with a change in phpactor.el's composer.lock

MarTango avatar Dec 11 '18 09:12 MarTango

@MarTango this is quite ironic given the installation of phpactor withing phpactor.el was meant to give a more reliable outcome :-(

@tszg thanks for the feedback. Alas, I can't see what's wrong from that.

within emacs, is the phpactor-executable variable set to nil ? from the command line, does the phpactor executable (the one found under phpactor.el's vendor/bin/ directory) behave normally (what does phpactor status give ?)

kermorgant avatar Dec 11 '18 10:12 kermorgant

I run it on the command line and get the right result. I'm looking for the same problem here https://github.com/phpactor/phpactor/issues/564, Perhaps this is related to the Windows system, my environment is win10.

zhougts avatar Dec 16 '18 13:12 zhougts

@zhougts there have been several changes on develop branch since December. I'd be interested to know whether the issue is still present.

kermorgant avatar Mar 20 '19 08:03 kermorgant