Main Menu

Auto indent ?

Started by gordonisnz, December 28, 2008, 02:05:44 PM

Previous topic - Next topic

gordonisnz

Hi,

I've d/loaded HippoEdit tonight - & would LOVE the "auto-indent" feature....


Its listed as a feature,  & from Google searches, it is one of the "edit" commands...

however - I have no idea how to activate it / turn it on 

Is this a big secret ?

I'm looking at the "edit" functions / option on an open PHP file - & nowhere can I see an auto-complete option. (Ive been to the other options aswell)


Please help - Thanks...




alex

Hello

depends what you want :)

Generally it is active by default. If you (take for example PHP) would type { and then Enter, next line should be indented on default indent. Or if you have if (something) -> Enter next line would be also auto-indented.

But if you want to correct indent for whole document, you can use Format All command (Main Menu->Format->Format All).

Best regards,
Alex
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

gordonisnz

Found the format all command - But nothing happens (existing document)....

(even tred highlighting the whole document & format all) - It doesn't ask me what I want to change....

Does the auto-indent feature only work as you type ? & not on an existing document ?



alex

 - Auto-Indent works only when you type.
- "Format All" should correct indentation for complete open document. Also, if selected in options, case of keywords would be corrected. No user input required (nothing asked).

But everything depends which syntax schema is used.

Can you provide more info:
- what you expect to happen?
- which code you have tried to format with Format All?
- which syntax was used (can be found in status bar)?
- which Hippoedit version you have tried?
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

gordonisnz

Can you provide more info:

- what you expect to happen?

Basically, to look through the entire document & correct the indenting

(if no indenting - create an indent - Move text / lines to the right .... )

if its indented too far - Move it to the left....

- which code you have tried to format with Format All?

PHP code

- which syntax was used (can be found in status bar)?

Plain text / ASCII / 1252 / DOS (status bar)

- which Hippoedit version you have tried? - 1.33


SAMPLE CODE :-

$temp=$_COOKIE['FAQ'];
$logreport.="COOKIE FAQ = '$temp'<BR>\n";

$temp=$login['logged_in'];
$logreport.="LOGIN = '$temp' '$login'<BR>\n";

foreach($login as $ab => $ac){
$logreport.="LOGINARRAY '$ab' '$ac'<BR>\n";
}
foreach($_COOKIE as $ab => $ac){
$logreport.="COOKIE  '$ab' '$ac'<BR>\n";
}

-------------------------

It should look something like :-


$temp=$login['logged_in'];
$logreport.="LOGIN = '$temp' '$login'<BR>\n";

foreach($login as $ab => $ac){
   $logreport.="LOGINARRAY '$ab' '$ac'<BR>\n";
}
foreach($_COOKIE as $ab => $ac){
   $logreport.="COOKIE  '$ab' '$ac'<BR>\n";
}



Thats only a few lines - I've got scripts with hundreds of lines.... - & lots of scripts...

Shall i try & locate something else - to auto-indent scripts ?



alex

Ok. Thanks. Now clear ;)

If you are trying to edit PHP code, then you need to use PHP syntax ;)
What is the extension of the document you have tried to edit? Strange that it was not recognized as PHP (or html).
But you can also change syntax manually. Or with Context menu (Right click on document, Synatx->PHP) or thought Main Menu -> View-> Syntax -> PHP. Then try Format All once more.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

gordonisnz

ah - Ok...

the file i'm trying to edit is  secure.class.php (not secure.php)

Ive tried syntax command - & PHP is not listed as one of them...

- I'll try renaming the file - See what happens.....



gordonisnz

No, - changed to secureclass.php - no php in the syntax options (looking....)


alex

Have you installed schemas for PHP during installation?

Choose components:
    - Language Files
        - WEB Development
             - PHP

Check that you have files php_spec.xml and html_spec.xml in you Hippoedit\data\syntax folder.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

gordonisnz

FIXED   :)

I re-installed everything - & now have all language files etc.....


Cool programme now :)



Stefan

I have tried this with 1.3x

1) open new txt document
2) past your example into this document

$temp=$_COOKIE['FAQ'];
$logreport.="COOKIE FAQ = '$temp'<BR>\n";

$temp=$login['logged_in'];
$logreport.="LOGIN = '$temp' '$login'<BR>\n";

foreach($login as $ab => $ac){
$logreport.="LOGINARRAY '$ab' '$ac'<BR>\n";
}
foreach($_COOKIE as $ab => $ac){
$logreport.="COOKIE  '$ab' '$ac'<BR>\n";
}


3) switch syntax to PHP:       "View > Syntax > PHP"
4) select whole code:            "Edit > Selection > Select all"
5) format this selected code: "Format > Format All"

My result:

$temp=$_COOKIE['FAQ'];
$logreport.="COOKIE FAQ = '$temp'<BR>\n";

$temp=$login['logged_in'];
$logreport.="LOGIN = '$temp' '$login'<BR>\n";

foreach($login as $ab => $ac){
    $logreport.="LOGINARRAY '$ab' '$ac'<BR>\n";
}
foreach($_COOKIE as $ab => $ac){
    $logreport.="COOKIE  '$ab' '$ac'<BR>\n";
}


---

If i paste your example code into an *.php file
and open this file, then HippoEDIT enable HTML as syntax.
And with HTML-syntax the formating doesn't works.

If i do
- switch syntax to PHP:       "View > Syntax > PHP"
- select whole code:            "Edit > Selection > Select all"
- format this selected code: "Format > Format All"
then formating works too.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

Stefan

;D fine you worked it out, welcome to the community.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hi Stefan,

The "base language" for PHP files is HTML. To switch to PHP block you need to have <?php ... ?> arround the code ;) As far as I know. Then formatting would work.

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

Quote from: alex on December 29, 2008, 01:02:43 PM
To switch to PHP block you need to have <?php ... ?> arround the code

Aha, that's the way it works.

I just take the PHP template file from HippoEDIT 1.4 beta
and test it with the sample code.
You are right, HippoEDIT switch the syntax to PHP if i go into an PHP-block.
And the formating works too.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>

<?php
$temp
=$_COOKIE['FAQ'];
$logreport.="COOKIE FAQ = '$temp'<BR>\n";

$temp=$login['logged_in'];
$logreport.="LOGIN = '$temp' '$login'<BR>\n";

foreach(
$login as $ab => $ac){
$logreport.="LOGINARRAY '$ab' '$ac'<BR>\n";
}
foreach(
$_COOKIE as $ab => $ac){
$logreport.="COOKIE  '$ab' '$ac'<BR>\n";
}
print 
"Hello World!"

?>


</body>
</html>


Thanks for clarifying.
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-