New plugin NEON Nette Support

2 years ago by Matouš Němec translated by David Grudl  

IDE plugins bring comfort to your development and simplify your work. I enjoy developing plugins for the IntelliJ platform and would like to deliver the best products possible. Today I'm going to introduce a new plugin NEON Nette Support for PhpStorm that is lightning fast even in large projects and will save you a lot of work.

Do you know the current NEON plugin? It colors files and provides basic code completion. This is good for getting started or for uses other than Nette configuration files. But what if you want more from the NEON plugin, at least that it understands your Nette application, helps with refactoring, has advanced code completion, etc.? That it recognizes %param% and @serviceName and knows their type, and much more? See the overview of the most important features of the new plugin.

Features of the new plugin

All screenshots are only illustrative and do not show the ideal way of writing the configuration, they are only meant to show as many features of the plugin as possible.

Syntax highlighting

The syntax highlighting is more advanced than in the previous version of the plugin, which only highlighted keys in orange. I also extended the color settings page for NEON. Judge for yourself:

Keys completion

The plugin also includes a function for key completion. For now it provides hints for keys from basic Nette extensions, but in future versions of the plugin there will be an option to configure keys for third party extensions. Besides completion, it can underline keys it doesn't know and validate the correct type for the values.

Class and namespace suggestions

Code completion of PHP classes and namespaces is standard. It can underline non-existing classes or namespaces. It can also trace classes from PHP code to see what configuration files they are used in. And if it is used, it does not mark it as unused (this includes methods, properties and constants).

Methods and properties suggestions

The plugin also suggest methods and properties. Both when used directly in combination with the class name Foo\Bar::method, and when used after the service name @serviceName::method. In addition, it can also hints methods and properties under the setup key in the service definition, even in places where the service is not directly defined, but only some extra setups are called on the service instance.

This works for the default Nette services, and in the future there will be an option to define behavior for custom services that are created via extensions.

Inspections for non-existing methods, properties and constants are also included. They check if elements exist and are public, not deprecated and other small things.

It also works to trace the methods/properties/constants from PHP, in which configuration files they are used.

Suggesting parameters and service references

The plugin provides suggestions for service names after the @ character and parameters after the % character. It also works to click through from a service/parameter name to its definition, or display a multiple filename information if it is defined in multiple places.

Refactoring

Plugin extends the possibilities of refactoring. So when you rename an element in PHP using refactoring, the change is overwritten in the configuration files in all places where the element is used. And you can even refactor directly from the NEON file and it will overwrite the PHP file and other configs if the element being renamed is used there. This applies to classes, namespaces, methods, properties, constants, NEON parameters %param% and services @serviceName.

Inspections

The first version of the plugin has inspections for undefined symbols and unused parameters. In later versions, there will be inspections for deprecated elements, validation of correct value type, etc. All inspections are separate and can therefore be turned off in the settings or their severity can be adjusted.

Section includes

In the includes section is file completion implemented too. References to embedded files can be traced using the find usages function.

Other news

The plugin also provides breadcrumb navigation, structure view, adds trailing brackets or quotes when typing, offers to create a new NEON file. I've added new images and sizing for Retina displays and other small things.

A look behind the scenes

The improvement in quality was mainly due to the newly written jFlex lexer and BNF parser for parsing .neon files. I have created over a hundred tests on it. These tests help with the fact that when upgrading the parser everything parses the same and nothing breaks. Closely related to the parser are the individual code elements it generates. I have also created over a hundred tests on these elements, each checking that the element methods work as they should. Performance, in turn, is related to the correct caching of complex operations on elements and index lookups. Once this all-important foundation was in place, it was time to work on implementing the individual features.

To ensure development support, I decided to make the new NEON Nette Support plugin paid. The JetBrains marketplace directly supports paid plugins, so payment would be made in your JetBrains account, just like payment for JetBrains products.

And how much would all this cost?

All of this will cost you like just two beers per month. That's € 3 for the first year, 20% less for the second year and 40% less for the third and subsequent years. Plus you'll save two months when you pay annually, just like you're used to from JetBrains products. The listed price is without VAT. Pricing details are at JetBrains NEON Nette plugin page.

Where to download and try it?

The plugin can be tested for free for 30 days before purchase, like all JetBrains products. If you are currently using the free Neon plugin, you must uninstall it before installing NEON Nette Support. Plugin is installed as a normal plug-in via the menu in PhpStorm Preferences -> Plugins -> Marketplace. The plugin is called NEON Nette Support. See the documentation for more installation information.

Comments (RSS)

  1. Excellent, some tool like this I will need, i Go to tray immediately !!

    2 years ago
  2. Very nice work!

    2 years ago

Sign in to submit a comment