User forums > Help
Bookmarks being removed when using AStyle
OnlineCop:
I tried Googling "bookmarks" for any C::B answers for this one, but I thought I'd send it here.
I set bookmarks through my code. When I call the AStyle "Source code formatter" plugin, all the bookmarks are removed.
Is this a bug? Or a "feature" by design? I would understand that AStyle, being a separate plugin, may not be fully supported here, but I can't imagine why bookmarks should be removed whenever it re-styles code.
Is there a way to configure AStyle to leave bookmarks where they are, even if "not moving" the bookmarks means I'll have to go through and manually adjust everything myself?
MortenMacFly:
--- Quote from: OnlineCop on November 18, 2006, 06:36:18 am ---I set bookmarks through my code. When I call the AStyle "Source code formatter" plugin, all the bookmarks are removed.
--- End quote ---
I'd say this is not easily possible. AFAIK astyle get a "dump" of the source-code, re-formats it and returns it as a new "dump". It works just as the command-line astyle and doesn't know about bookmarks and stuff. So one would need to patch astyle to incorporate this additional functionality and I don't believe that this is a good way because it requires a lot changes and you would have to incorporate this again and again on new astyle upgrades.
With regards, Morten.
tiwag:
i think the bookmark linenumbers could be easily stored in the .layout file
and were then accessible throughout several edit sessions.
when astyle changes the code, the bookmarks don't need to change too,
they could stay at the linenumbers where they were before.
MortenMacFly:
--- Quote from: tiwag on November 18, 2006, 11:27:19 am ---when astyle changes the code, the bookmarks don't need to change too,
they could stay at the linenumbers where they were before.
--- End quote ---
But does that make sense? If astyle changes the code like e.g.:
--- Code: ---void my_method() {
dostuff()
}
--- End code ---
...into:
--- Code: ---void my_method()
{
dostuff()
}
--- End code ---
...then the line numbering changes. So the bookmarks are out of sync. In fact that happens 99% of the time I'd say. So why saving the bookmarks then? IMHO it's really better to remove them under that condition.
With regards,, Morten.
tiwag:
--- Quote from: MortenMacFly on November 18, 2006, 11:50:37 am ---
--- Quote from: tiwag on November 18, 2006, 11:27:19 am ---when astyle changes the code, the bookmarks don't need to change too,
they could stay at the linenumbers where they were before.
--- End quote ---
But does that make sense? If astyle changes the code like e.g.:
--- End quote ---
it does not make any sense, if you have bookmarks and change the
astyle source code style completely e.g. from K&R style to ANSI, where
you get heavy source code modifications.
but in general it makes sense, even when the bookmarks don't change their linenumber with the astyle changes,
you have them "near" the original location in most cases (which is better than lost esp. when you are editing long files)
and normally you set your favourite astyle source code style and don't change it.
Navigation
[0] Message Index
[#] Next page
Go to full version