Main Menu

double click to select PHP var

Started by false007, February 24, 2011, 03:42:21 AM

Previous topic - Next topic

false007

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.
[url="http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371"]http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371[/url]

Stefan

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
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

false007

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
[url="http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371"]http://forum.hippoedit.com/?/topic,536.msg2371.html#msg2371[/url]

alex

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.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]