Author Topic: double click to select PHP var  (Read 3525 times)

Offline false007

  • Registered User
  • Jr. Member
  • *
  • Posts: 60
  • Karma: +0/-0
    • View Profile
double click to select PHP var
« on: February 24, 2011, 03:42:21 am »
hello,
     You know PHP vars begin $, but HE double click can not select the full PHP var.


    How to config it to select full PHP var??


   Thanks.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: double click to select PHP var
« Reply #1 on: February 24, 2011, 11:14:15 am »
1.) an double click select an whole "word"
2.) an word is something what is enclosed from an space ( " word " ) OR an "non-word"-sign ( "$word " ) before and after
3.) what belongs to the group of valid word signs is defined in the syntax files in the section <Words>...</Words>
But in the PHP syntax file there is no such section, because:
4.) the PHP syntax file "php_spec.xml" is based on  "defsource_spec.xml" and this on "def_spec.xml"
5.) in this "def_spec.xml" you will find this section: <Words>0-9A-Za-z_</Words>
Modify this section to  include the '$' -sign as valid sign for an "word" like >>> <Words>0-9$A-Za-z_</Words>
Then you can select an word like "$myVar" by an double click too.

some notes:
- Modification in this basic syntax file "def_spec.xml" belongs to all syntaxes based on this base.
- You can modify the "php_spec.xml"  too to overwrite the settings from "def_spec.xml"... but that is an other story
and can be found in the FAQ section too, ... i would have to take an look myself too.
- I have no glue if this modification will have any side-effects, take care yourself and report how it works for you.

HTH? :D

Happy HippoEDITing

Offline false007

  • Registered User
  • Jr. Member
  • *
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: double click to select PHP var
« Reply #2 on: February 24, 2011, 01:39:42 pm »
very thanks Stefan. :D


I add <Words init="$A-Za-z_">0-9$A-Za-z_</Words> to php_spec.xml and solve it. :P

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2181
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: double click to select PHP var
« Reply #3 on: February 25, 2011, 12:31:32 am »
Thanks Stefan!

Yes, everything is right. You can also skip symbols defined in parent schema, they will be inherited. So this <Words>$</Words> will be enough.

But such change will lead to one disadvantage (at least) : Auto Completion and Code Hints for PHP variables will not work. Reason is that when you will press Ctrl+Space after $d.. something, editor will check for beginning of the word to find prefix for filtering of the completion list, and it will be $d... But to highlight all php variables, following block used:
        <Blocks>
          <Block open="$" close=""/>
        </Blocks>

and all variables collected without $. So nothing will be found.

The only way to solve it is to remove styles: id="variable" and name="Built-In Variables". After this variables will be not highlighted but code completion should work.

Best regards,
Alex.
P.S: I will think about possible solution, but have doubts that can find some easy way/correction for this. I knew this already long time ago, and this was a compromise to not place $ into word symbols. The same way it done in some other schemes. So, if not yet fixed, probably was no easy way.

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
1532 Views
Last post April 21, 2009, 04:00:50 am
by Arthur
0 Replies
2045 Views
Last post January 23, 2012, 03:02:15 pm
by alex
1 Replies
1448 Views
Last post September 24, 2012, 03:52:11 pm
by alex
3 Replies
1462 Views
Last post August 22, 2014, 11:20:57 am
by alex
3 Replies
930 Views
Last post October 06, 2016, 11:19:56 pm
by alex