Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Does the "Source Code Formatter" plugin have an active maintainer?

<< < (3/4) > >>

DrewBoo:

--- Quote from: jens on March 12, 2008, 07:50:43 pm ---You are right ! :oops:

--- End quote ---

:)


--- Quote from: jens on March 12, 2008, 07:50:43 pm ---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.

--- End quote ---

That sounds pretty similar to how bookmarks are handled.  The formatter plugin effectively feeds the code to AStyle one line at a time and if a bookmark exists in the source at the current line, a bookmark is placed in the formatted code (whatever line the formatted code may happen to be on).

But all the same, I don't think it would be wise for a plugin to explicity place folds anywhere.  It probably wouldn't last long anyway.  My thought is that a very simple tree could be generated on the fly describing the current folds.  No data in the tree other than what folds are folded as what's important is the shape of that data structure.  If the formatted code has a folding tree that is the same shape, then the plugin could make the folding state match.

Do you follow what i mean by the shape of the data structure?  If a simple source file had 3 top-level folds, and a fourth fold inside the first top-level fold, the plugin could run the formatter and if the resulting code has that same folding structure, it could assume that it is safe to restore the old folding state.

MortenMacFly:
For patches please use the BerliOS webpage (so far...) If the patch is not too big you might also post it here.

As for the folding stuff: I clearly vote against it. It makes the code far too complex and has just to less in result. Even worse: Most people don't want to leave the folding as they inspect what has happened (within the focus of source code formatting). So this functionality should be optional and this is even worse. We cannot and will not will make everything extremely flexible and configurable. Some devs are already really unhappy with the complexity that got into C::B in recent times because of each and every "flexibility feature" was added no matter whether this is valuable or not. That simple doesn't makes sense. In addition there are a lot more important refactorings required.

Anyways - this feature *can* be implemented as plugin... so whoever wants to I won't stop you. But please: No changes in the core for such.

DrewBoo:

--- Quote from: MortenMacFly on March 12, 2008, 08:27:06 pm ---As for the folding stuff: I clearly vote against it. It makes the code far too complex and has just to less in result.

--- End quote ---

Nobody's crawling out of the woodwork to support this idea either.  I think it just got scrapped.


--- Quote from: MortenMacFly on March 12, 2008, 08:27:06 pm ---Some devs are already really unhappy with the complexity that got into C::B in recent times because of each and every "flexibility feature" was added no matter
whether this is valuable or not.

--- End quote ---

Hm, perhaps a "Dev Mission Statement" should be placed prominentlyon the Wiki.  Something to keep all the devs on the same page and keep the focus on the big picture.

Or perhaps there is one and I just didn't check.   :oops:


--- Quote from: MortenMacFly on March 12, 2008, 08:27:06 pm ---Anyways - this feature *can* be implemented as plugin... so whoever wants to I won't stop you. But please: No changes in the core for such.

--- End quote ---

So far, the plugin system has been really sharp.  I haven't gotten near the core and I like that I don't have to.

Ceniza:
Folding is trickier than bookmarks. I'm not really sure if I'll be doing that, but, for the record, the trick would be (it seems) using m_cbe->GetControl()->GetLineVisible(line) from ASStreamIterator and possibly m_cbe->ToggleFoldBlockFromLine(line) to restore it.

Does anyone feel like playing around and submitting a patch? ;)

If you want something a bit "easier" to start with, try to save the state of breakpoints :D

Have fun.

P.S.: Saving the state of breakpoints looks a bit more useful, but... who would decide to start a debugging session and then change the formatting before continuing debugging?
P.S. 2: I also think Morrrrrrrrrrrrrten has a good point there. There are, definitely, more important things to do right now.
P.S. 3: Next time I should try to incorporate the content of P.S.s into the post's body, so I don't have to put them at the end of it.

JGM:
that would be a cool feature! :D

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version