Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Does the "Source Code Formatter" plugin have an active maintainer?
deadneurons:
I'll take this opportunity to ask for feature request,(mods feel free to delete if it doesn't belong)
Request:
When formatting a source can the fold be kept?
I meant instead of expanding, keep the folded parts collapsed.
thanks.
DrewBoo:
--- Quote from: deadneurons on March 12, 2008, 06:51:26 pm ---I'll take this opportunity to ask for feature request,(mods feel free to delete if it doesn't belong)
Request:
When formatting a source can the fold be kept?
I meant instead of expanding, keep the folded parts collapsed.
thanks.
--- End quote ---
Hm...it sounds feasible. Not sure how difficult that would be.
First, the Code::Blocks SDK would have to expose the folding state of the opened file, so the formatted file could be told to fold the same way that the unformatted file was folded. I don't know if it does. Gurus?
There's already similar logic in that plugin that plucks out bookmarks and sticks them back into the formatted code.
Second, there would have to be an elegant solution if the folding tree changes when the code gets formatted. I don't know if there are any AStyle settings that would change the folding tree, but even if there are none, that doesn't guarantee that the tree will never change in future versions of AStyle.
I imagine that it might be a fair compromise to preserve the folding state only if the folding tree has the same shape after formatting as it did before.
Do you follow what I'm saying, deadneurons? What do you think?
Jenna:
--- Quote from: DrewBoo on March 12, 2008, 07:09:41 pm ---Second, there would have to be an elegant solution if the folding tree changes when the code gets formatted. I don't know if there are any AStyle settings that would change the folding tree, but even if there are none, that doesn't guarantee that the tree will never change in future versions of AStyle.
--- End quote ---
Sourcecode formatting is just for readability and is not allowed to change the blocks in the code. For example a function is a function egally how it is formatted.
That means folding should never be changed by formatting, the only thing that can change is the line wher the folding starts or end.
DrewBoo:
--- Quote from: jens on March 12, 2008, 07:18:19 pm ---Sourcecode formatting is just for readability and is not allowed to change the blocks in the code. For example a function is a function egally how it is formatted.
That means folding should never be changed by formatting, the only thing that can change is the line wher the folding starts or end.
--- End quote ---
What if, hypothetically, this code
--- Code: ---if ( x )
{
DoSomething();
}
--- End code ---
was changed to look like this code?
--- Code: ---if ( x ) { DoSomething(); }
--- End code ---
In those cases, we just lost a fold.
Jenna:
You are right ! :oops:
The problem wit source-code formatting and folding is, that the FoldingLevel is saved on a per line base in wxScintilla, but if the code gets formatted the line-count (in most times) change.
That means a backup of the Foldinglevels is quiet difficult.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version