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

jcelle

  • Senior Community Member
  • Posts: 125
  • Hero Points: 4
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

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3106
  • Hero Points: 449
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: 125
  • Hero Points: 4
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.