Upgrades in Latte plugin for PHPStorm

about a month ago

mesour
Member | 214
+
+24
-

Introducing

I'm working on upgrade for Latte plugin for PHPStorm. Now is in the beta version only, you can download and test it by download link. It can be installed from disk (help for install). I will be happy if as many people as possible try it out before we release the official version. There were a lot of changes, so let’s test it out.

Before stable will be released, new beta versions will be pushed to Github and in this forum will be posted information about new update. Download link will be same.

Links

  • DOWNLOAD
  • Custom template class… – More informations about new templateType macro. Macro varType is equivalent for /** @var string|null $foo */ and have this syntax: {vatType string|null $foo}.
  • I also created small update for Neon plugin

Issues

If you find some bug, please reply to this topic and I will add it to issues list.

Important notes

  • Refactoring for class names is now supported only from PHP to Latte

Changelist

  • Increased minimum compatibility with PhpStorm version to 2017.3 from PhpStorm 8 (pre-2016.2 IDE version)
  • added support for PHP content
  • added variable types
  • added highlighting and go to source support for latte variables
  • added support for define custom default variables per project
  • added completions for latte variables, PHP functions, methods, constants and properties
  • added varType macro
  • added templateType macro
  • added support for define type in {var Bar\FooClass $class = …}
  • added support for mime types and completion it in contentType macro
  • added reference search for usages from PHP to Latte (for classes, methods, properties and constants)
  • added brace matcher for highlight braces
  • added go to source for class names, methods, constants and properties
  • added support for highlighting macro name and pair macro
  • added support for refactoring rename (methods, properties, constants and class names)
  • added code-completion for latte filters
  • added support for adding custom latte filters
  • added UI for setting custom variables, filters and macros
  • added inspections for:
    • class usages (Undefined class)
    • checking not defined variables, more definitions with same variable name etc.
    • checking constant, property and methods visibility (if is not public it make warning)
    • checking not existing constants, properties and methods
    • checking static methods and properties used non statically and vice versa
    • checking valid content for templateType, varType and var macro
    • checking existing latte filters

Donate

More of you wrote that they would like to contribute to development. I appreciate it, thanks. So I'm adding a link to PayPal and a bank account number. Donors will be posted here on the forum and in the future somewhere on the web with information about the Latte plugin (if you want, then write a payment note with your name for the recipient).

  • PayPal
  • CZ bank account: 2600850198/2010
Donor list

Last edited by mesour (2020-02-10 14:56)

about a month ago

mesour
Member | 214
+
+7
-

Update 01

I added this to latest update (can be donwloaded by download link in main post):

  • Support for refactoring rename
  • Support for classes not starting with \ and completion without \
  • Added support for PHP functions (completions, reference…)
  • Added completion type hints like string, int… in varType macro
  • Added better support for strings and support for variable used in double quoted string like: "foo-string $bar"

This is new compared to the version that has been on the Slack.

about a month ago

mesour
Member | 214
+
+10
-

Update 02

I added this to latest update (can be donwloaded by download link in main post):

  • Fixed bug with refactoring rename
  • Fixed bug in completion and reference class members if class name is without \ and if is |null in type
  • Added support for define type in {var Bar\FooClass $class = ...}
  • Added support for define variable in macro {capture $definition}
  • Added completion for content types to {contentType application/json} macro

I think this can be first release candidate. Because all important features are implemented. Only minor changes are in need fix section in issues list.

  • Please if someone have PHPStorm with Java version 8, test it. I change settings for project and try it compile it for Java 8, but it is hard to test for me with Java 11.

Last edited by mesour (2020-01-07 22:06)

about a month ago

mesour
Member | 214
+
+12
-

Update 03

I added this to latest update (can be donwloaded by download link in main post):

  • Added some performance improvements
  • Added code-completion for latte filters
  • Added support for adding custom latte filters
  • Added UI for setting custom variables, filters and macros
  • Added inspection for checking existing latte filters

Now Im waiting for review and some things to solve around the merge to the main repository. After this it can be released. But I think it's good to wait a week or two for finding bugs in this version. Only adding templatePrint macro is planed to this version. Next features really in future versions.

If you want donate, I added a section to main post.

Last edited by mesour (2020-01-08 19:16)

about a month ago

mesour
Member | 214
+
+9
-

Update 04

I added this to the latest update (can be downloaded by a download link in the main post):

  • Added support for templatePrint macro
  • Added tests for LattePhpLexer
  • Added completion for macro end tag
  • Improved n: attributes completion
  • Improved pages with settings for (macros, variables, and custom functions)
  • Fixed bug in completion for the end tag macro
  • Fixed annotator messages and annotating for some cases
  • Nette macros moved to custom configurations and can be disabled for the project with Latte only
  • Fixed bugs with unclosed block macro and translate macro
  • Fixed macro completion at the end of the file

I have created a pull request. Now it is mergeable without conflicts. Now I'm working only on testing and bug fixing.

Last edited by mesour (2020-01-13 21:10)

23 days ago

mesour
Member | 214
+
+9
-

Update 05

I added this to the latest update (can be downloaded by a download link in the main post):

  • Fixed bug in filters completion and settings

You have not reported any bugs for ~2 weeks and this update is minor. Now I will merge it to master and I will initiate for the plugin to be published.

Last edited by mesour (2020-01-25 08:49)

15 days ago

mesour
Member | 214
+
+7
-

Update 06

I added this to the latest update (can be downloaded by a download link in the main post):

  • Changed functionality for reset buttons in settings (now working only with Nette macros, variables…)
  • Renamed macro to tag
  • Fixed bugs in macro settings UI
  • Fixed completion for magic methods prefixed with __ (complete only if __ is typed)
  • Fixed bug in completion for custom-defined filters

This is the latest update before release.

11 days ago

Tomáš Jacík
Member | 143
+
+1
-

@mesour Can you post your account number here? Are you able to make an invoice if my company donate too?

Thanks

11 days ago

mesour
Member | 214
+
0
-

@TomášJacík I added the bank account to Donate information in the main post. I can make an invoice. If you want, email me by the contact form here: https://mesour.com/cs#… or message me on Slack

Last edited by mesour (2020-02-10 19:32)

11 days ago

mesour
Member | 214
+
+8
-

Version 1.0.0

I merged it to master and asked competent people to publish a new version of the plugin.

This is planed in the next version (v1.0.1)

  • Fix and add more if completing code (for faster code writing in latte templates)
    • Complete variables without typing $
    • and more…
  • Try to implement some performance improvements
  • Fix resolving methods if a type is more classes FooClass|BarClass (sometimes bugging)
  • Resolve methods, properties, and constants from traits (sometimes bugging)
  • And more bug fixes if someone reports a new bug

Important planed features (v1.1.0)

  • Add support for optional chaining
    • {$order->item?->name}, {if $blogPost?->count(‘*’)}
    • Add intention for add optional chaining
  • Added resolving in foreach and ArrayAccess ($arr['foo']) for types defined with []. Example: FooClass[]
  • Inspections
    • For checking nullable types (eg. calling method on nullable variable)
    • For checking foreach value, must be array or iterable
    • For used @deprecated and @internal PHP elements

Last edited by mesour (2020-02-05 23:54)

6 days ago

mesour
Member | 214
+
+1
-

The plugin is not yet published to JetBrains repository. I updated the download link in main post to download the current version.

6 days ago

mesour
Member | 214
+
+6
-

A new version of the plugin has been submitted for moderation. Now we are waiting for a security check from JetBrains. The request will be processed within two business days. After this, the plugin will be visible and downloadable for all, normally from IDEA Preferences -> Plugins.

Last edited by mesour (2020-02-10 19:18)

2 days ago

Milo
Nette Core | 1147
+
+1
-

Hi. This is awesome and thanks for your work!

I'm excited about {varType} macro and Latte autocompletion. Unfortunatelly, I'm running Latte v2.6. So, I published small LatteBackportMacros class as a workaround before upgrade to 2.7.