Author Topic: Adding php support for jrefactor.e/refactor_add_import() ?  (Read 3507 times)

jcelle

  • Senior Community Member
  • Posts: 253
  • Hero Points: 5
Adding php support for jrefactor.e/refactor_add_import() ?
« on: August 04, 2020, 07:55:09 AM »
Hello,
I was wondering how difficult it would be to extend the jrefactor.e/refactor_add_import() function to support PHP.
Java and C# are supported already and it seems that SlickEdit has everything to make it possible for PHP (see screenshot with example for Queueable class).
Thanks for your attention.
Jerome

Dennis

  • Senior Community Member
  • Posts: 3954
  • Hero Points: 515
Re: Adding php support for jrefactor.e/refactor_add_import() ?
« Reply #1 on: August 04, 2020, 02:48:46 PM »
Possible.  That code is pretty easy to trace.  There are few functions I can point you to that will get you started.

  • _OnUpdate_refactor_add_import -- you'll want to add "phpscript" to the list of supported language modes
  • _OnUpdate_refactor_goto_import -- same deal
  • add_import -- trace it, look for how "using" is added for C++, add the appropriate code checking _LanguageInheritsFrom("phpscript")
  • getAutoImportOptions -- here's where things get a bit trickier

That being said, PHP isn't a statically typed language, so you might encounter some heartaches along the way.

jcelle

  • Senior Community Member
  • Posts: 253
  • Hero Points: 5
Re: Adding php support for jrefactor.e/refactor_add_import() ?
« Reply #2 on: August 05, 2020, 07:58:59 AM »
Thanks Dennis, that will help. I'd love to make it happen.