code collapse - suggestion
code collapse - suggestion
Albert, I find the code collapse feature handy when working with longer PHP scripts. Would it be possible to add the ability to collapse functions?
Lou
Say what you will about Sisyphus. He always has work.
Say what you will about Sisyphus. He always has work.
- Albert Wiersch
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: code collapse - suggestion
Hi Lou,
I pulled up one of my long PHP scripts and I can code collapse (fold) PHP functions.
What are you not able to fold that you'd like to? Please let me know and I will be happy to pass it on to the editor component developers.
I pulled up one of my long PHP scripts and I can code collapse (fold) PHP functions.
What are you not able to fold that you'd like to? Please let me know and I will be happy to pass it on to the editor component developers.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Re: code collapse - suggestion
Albert,
using the following file. I am using version 12.0300 there are handles along the left side to fold the "if" and "else" but not "function"
using the following file. I am using version 12.0300 there are handles along the left side to fold the "if" and "else" but not "function"
Code: Select all
<?php
/* this is a test file */
function do_something()
/*****
* I would like to be able to fold the
* function do_something() down to a single line
* like the if or else below.
******/
{
if (true)
{
$i = 0;
for ($j=0;$j<=10;$j++)
{
echo "$i is counting up";
$i++;
}
}
else
{
echo "do nothing";
}
return $i;
}
$k = do_something();
echo $k . "The end";
?>
Lou
Say what you will about Sisyphus. He always has work.
Say what you will about Sisyphus. He always has work.
- Albert Wiersch
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: code collapse - suggestion
Hi Lou,
If you remove the comment after do_something() and before the function's opening left curly bracket ('{'), then does it work? Can you fold/collapse the function? The comment may be causing the issue. If so, then I can report it.
If you remove the comment after do_something() and before the function's opening left curly bracket ('{'), then does it work? Can you fold/collapse the function? The comment may be causing the issue. If so, then I can report it.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Re: code collapse - suggestion
Albert,
Interesting.
Yes if I put the comment inside the function (inside the brackets { /* ... */ } ) the both the function and the long comment can each be folded.
That solved my issue.
However, a long comment between the 'if' and its code block {...} does not prevent the 'if' from being folded. I also notice that comment 1 below can not be folded but comment 2 can. This inconsistency around the 'if' and 'function' may be due to the fact that the { } are optional following the 'if' but not the 'function' -- But thanks
if
/*
* comment 1
*/
{
/* comment 2
*/
}
Interesting.
Yes if I put the comment inside the function (inside the brackets { /* ... */ } ) the both the function and the long comment can each be folded.
That solved my issue.
However, a long comment between the 'if' and its code block {...} does not prevent the 'if' from being folded. I also notice that comment 1 below can not be folded but comment 2 can. This inconsistency around the 'if' and 'function' may be due to the fact that the { } are optional following the 'if' but not the 'function' -- But thanks
if
/*
* comment 1
*/
{
/* comment 2
*/
}
Lou
Say what you will about Sisyphus. He always has work.
Say what you will about Sisyphus. He always has work.
- Albert Wiersch
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: code collapse - suggestion
Thanks Lou. I reported this to the editor developers so if they address it then it should eventually make its way into CSE HTML Validator.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
- Albert Wiersch
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: code collapse - suggestion
UPDATE: I am told that the function folding issue has been fixed (but those comments cannot be folded). This should eventually make it into CSE HTML Validator, hopefully by the release of the next major version.
More here if you want more details:
http://forum.lmd.de/discussion/370/synt ... sue#Item_5
Code: Select all
function P()
/*
* unfoldable comment
*/
{ ... }
if (true)
/*
* unfoldable comment
*/
{ ... }
http://forum.lmd.de/discussion/370/synt ... sue#Item_5
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
Re: code collapse - suggestion
Albert thanks for the update.
Starting a new phpBB I was reading their coding standards for comments and use of optional { }. They want coders to use { } following an if, else, while to define a block, even if it includes just a single statement. This supports the way the fold works.
The link you give above confirms what I thought I remembered about parsers. (it was a long time ago, life and coding were simpler) - I do miss "talking" directly to the hardware though.
Starting a new phpBB I was reading their coding standards for comments and use of optional { }. They want coders to use { } following an if, else, while to define a block, even if it includes just a single statement. This supports the way the fold works.
The link you give above confirms what I thought I remembered about parsers. (it was a long time ago, life and coding were simpler) - I do miss "talking" directly to the hardware though.
Lou
Say what you will about Sisyphus. He always has work.
Say what you will about Sisyphus. He always has work.