TypeScript PHP

README.md

Crane - PHP code-completion for VS Code

Crane is a productivity enhancement extension for Visual Studio Code that provides code-completion for PHP. It has zero dependencies and largely works with projects of any size. It is still in development, and as such there may be bugs and/or missing features.

Please report any bugs that you find in our issue tracker on GitHub.

Follow @HvyIndustries on Twitter for updates!

How To Get Started

  1. Install Crane by pressing F1 in VS Code, then typing ext install crane
  2. Open a PHP project
  3. Check the status bar at the bottom and watch Crane parse all the PHP files it finds
  • Optionally, install the PHP Stubs to get code-completion for the built in PHP classes by pressing F1 in VS Code, then typing crane php stubs and selecting the appropriate option from the list.

For the best development experience, make sure you have the PHP linter enabled in your user settings, and set it to run onType instead of onSave!

You can also set php.suggest.basic to false to disable VS Code's built-in php code completion and avoid duplicate suggestions.

Demo


What's new in v0.3.7 (latest release)

  • Fix issue with including file on Linux

What's new in v0.3.7

  • Disabled bug report link to avoid misleading users into thinking there is a bug
  • Upgraded php-parser to 2.0.6 to fix some crashes and freezing
  • Added a special case for suggesting php opening tags (<?php)

What's new in v0.3.5

  • Bug fixes
  • Remote error reporting to help us find and fix bugs faster

What's new in v0.3.4

  • Significant performance improvements when requesting suggestions (up to 7,500% faster)

What's new in v0.3.3

  • Document symbol provider - view top level symbols in the current file
  • Workspace symbol provider - view top level symbols throughout the workspace
  • Performance improvements

What's new in v0.3.2

  • Added go to definition on classes, traits & interfaces
  • Fix several bugs introduced in v0.3.1
    • Namespace insert text should be prefixed with a backslash (Thanks @TheColorRed for pointing out this mistake!)
    • Crane no longer adds the fully qualified namespace to a class if the class is in the same namespace
    • Fixed issue where there were no suggestions for properties and methods defined in traits
  • Disabled Crane suggestions when typing on a single line comment
  • Bug report link now prefills basic information including vscode version, crane version and platform (win/linux/macos)

Current Features

  • Code-completion (work in progress)
    • For user created code
    • Optionally for built-in PHP functions and classes (such as PDO)
  • Go to definition on classes, interfaces and traits
  • Peek definition on classes, interfaces and traits
  • Document & workspace symbol providers

Planned Features:

  • Find references
  • Signature provider to show method parameter suggestions
  • Hover provider to show information about symbol under the cursor
  • Full go-to/Peek definition on variables, methods, properties, etc
  • PhpDoc support (both for reading and writing documentation)

User Feedback

Another total must have for PHP developers using Visual Studio Code.
Jan Hajek

Essential extension for every PHP developer, just install :)
Marcelo Rodrigo

Essential to every PHP developer, recommended!
Gabriel Coronado

That's the tweet I've been waiting for since the first public release of VS Code. Thanks.
Bruno Baketaric

omg omg omg omg omg
Rich Perez

👌👌👌 super awesome.
яєαℓιѕт נανѕтαн

Known Issues

  • If you get duplicate suggestions for variables, etc. you can disable VS Code's built-in php code-completion by setting php.suggest.basic to false in your settings.
  • There can be strange behaviour when working with PHP and HTML in the same file.
  • If you have a syntax error in a file, you may not get a full list of suggestions for that file.
  • Go to definition only works on classes, traits and interfaces

Links

Please report any bugs you find!

"HVY", "HVY Industries" and "Hvy Industries" are trading names of JCKD (UK) Ltd

Icon by http://icons8.com/