Author Topic: Ideas to make C::B more powerful for refactoring large projects.  (Read 7574 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Ideas to make C::B more powerful for refactoring large projects.
« on: November 11, 2009, 06:34:25 am »
Hi guys! Since I've been using C::B in a massive refactoring project (400+ spaghetti .asp files, eew), I've been thinking of implementing the following features (I've been needing ALL of them this week!), which would be quite useful. Please comment why you'd like (NOT) to have them in C::B.

Find Dialog:
* Multiline search & replace (in the works)
* Multiline search (it's a different dialog than S&R)
* Add "Reverse matches" option (only lists files with no matches)
* Add an option in Find in files: Report only the [_N_]th parenthesized expression (regex only). I don't know if this can be done. Any ideas?
* Add "Start File" search option
* Add "End File" search option
* Add "Current File" Scope option (for search-in-files, so that we can list all the matching lines for the current file. Should only be enabled if there's an open file)

Search results (for Find in files):
* Add header to the search results always (currently it's only done ONLY if you don't erase the previous results)
* Add "Copy matching files list to clipboard" to the context menu.
* Add "Copy matching lines to clipboard" (it only lists the matching lines, not the filenames or line numbers)
* Add "Unlist this line" to the context menu.
* Add "Unlist this file" to the context menu.
* Add "Open matching files" to the context menu.
* Allow multi-select matches, and add "Open selected files" to the context menu.
* Add (optionally) a status message saying "N results found in M files" when the search is over. Perhaps adding it as a footer to the search results would be better.
* Add "load/save search results" (to/from clipboard or a text file) to the context menu

Open files list:
* Copy open files to clipboard option to the context menu

File Menu:
* Open files listed in clipboard

Edit Menu:
* Reload File (undo all changes)
* Reload ALL files (useful when a replace-in-files has gone awry)

Project Tree:
* Add the options that only appear when right-clicking the Project icon to all the files and/or folders.
* Add "Add to virtual folder" context menu (instead of having to drag each file)
* Select multiple files, with right-click "open these files" option, or maybe even move/delete, etc.
* Maybe it would be easier to "Open all files in this folder".
* Add a "Copy folder listing to clipboard"

Project Menu:
* Add "Move files to virtual folder" (it should ask you for the filenames and the virtual folder name). Perhaps this could be done by enabling multi-selections to the project tree.
* Add "Scan for new files" option. It should list the files not belonging to the project yet (useful in web projects). Perhaps the user should be given the option to choose a wildcard. Note that this is NOT the same as "Add files", since you don't know which files have been added. And adding ALL the files in a directory is somewhat redundant.
* Perhaps a "Scan for SVN files" should be useful too, if the project is in a directory tree with .svn folders inside.

My question is: Which features should be added first, and who could help me implementing them?

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #1 on: November 11, 2009, 06:50:30 am »
Quote
* Multiline search (it's a different dialog than S&R)
As what I said before,if the search dialogue could be modeless,it would be very cool,since when I want to search a word in a single file.the word get many matches in different lines.the search should highlight the first one match and not destroy the dialogue,so I can continue to press search button to find the word in the line which I am interested in.


@rickg22
you are my idol since your work in codecompletion.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

mariocup

  • Guest
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #2 on: November 11, 2009, 07:55:17 am »
As what I said before,if the search dialogue could be modeless,it would be very cool,since when I want to search a word in a single file.the word get many matches in different lines.the search should highlight the first one match and not destroy the dialogue,so I can continue to press search button to find the word in the line which I am interested in.

This behaviour is already there in CB with incremental search plugin using Ctrl+I and hitting enter for finding the next occurrence. If we add the multi-line search/replace option we have to look if it makes sense also to support it in the ThreadSearch and Incremental Search plugin.

Offline blueshake

  • Regular
  • ***
  • Posts: 458
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #3 on: November 11, 2009, 08:58:49 am »
Thanks for your hint ,it acts like web search. :D
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline Zini

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #4 on: November 11, 2009, 10:23:47 am »
Quote
* Add "Unlist this line" to the context menu.

May I suggest to also add a mouse-click option to invoke this function (something like shift-LMB)? I have used an editor with this function before and from my experience once you have it you make excessive use of it. Having to go through the context menu each time sounds a bit cumbersome to me.

And while you are at it you might want to consider implementing applicable functions from the "Search results (for Find in files):" section in the "Build message" tab, too.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #5 on: November 11, 2009, 01:50:55 pm »
The search should highlight the first one match and not destroy the dialogue,so I can continue to press search button to find the word in the line which I am interested in.

Wow. Someone who doesn't know the "F3" key. I've been using it since Notepad. Oh, if you press Shift-F3 it goes backwards! :) BTW, thanks for the kudos on Code completion   :mrgreen:

Quote
* Add "Unlist this line" to the context menu.
And while you are at it you might want to consider implementing applicable functions from the "Search results (for Find in files):" section in the "Build message" tab, too.

Whoa. I just opened Pandora's box. Yelp! :P
« Last Edit: November 11, 2009, 01:55:38 pm by rickg22 »

Offline Zini

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #6 on: November 11, 2009, 02:56:50 pm »

Quote
* Add "Unlist this line" to the context menu.
And while you are at it you might want to consider implementing applicable functions from the "Search results (for Find in files):" section in the "Build message" tab, too.

Whoa. I just opened Pandora's box. Yelp! :P

Maybe. But when you look at these two tabs (Search results and Build messages) its quite obvious that they are doing the same thing - once the data has been dropped into them. Build messages has the additional feature to display line/file independent summaries (== Build finished: 0 errors, 0 warnings ==), but that is the only difference I can find.

From a software engineering point of view it might make sense to unify the implementation (simply drop the search results implementation and re-use the build message implementation instead? - haven't looked at the code yet).
Possible benefits: It would reduce the total code size and complexity. Both tabs would benefit from additional features like "unlist this line". And it would ensure that both tabs have a consistent style, which is currently not the case (at least on my copy of Code::Blocks the heading uses different fonts/font-effects in the two tabs).

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #7 on: November 12, 2009, 05:31:58 am »
It's not that easy. The two options are handled by loose-coupled code. Search is done in the SDK, while compiling is done by the compiler plugin.

You can't unify code that was designed to be modular.

Offline Zini

  • Multiple posting newcomer
  • *
  • Posts: 64
Re: Ideas to make C::B more powerful for refactoring large projects.
« Reply #8 on: November 12, 2009, 10:42:08 am »
Yeah, had the time to take a look at the code myself. Was quite surprised when a search for the build message tab implementation turned up a plugin source file. Strange! One should think that "source line reference window/tab" makes an ideal candidate for writing a class, that then can be used by what ever part of Code::Block needs it, SDK, Plugin or whatever. Anyway, forget it. I guess it would be more work than it is worth.