Author Topic: C::B "ALL_OPEN_FILES"  (Read 334 times)

Offline cacb

  • Regular
  • ***
  • Posts: 381
C::B "ALL_OPEN_FILES"
« on: December 19, 2018, 10:57:13 am »
On a Win10 box I currently use C::B 11530 with MSVC2013 compiler.

For debugging under Windows, I prefer to use the debugger in Visual Studio. To do this, I create an entry in the C::B Tools menu to start the Visual Studio IDE/Debugger with the current source file and at the current editor line:

/edit $(ACTIVE_EDITOR_FILENAME) /command "edit.goto $(ACTIVE_EDITOR_LINE)" /debugexe $(TARGET_OUTPUT_FILE)

See attached image for full details, this works fine with Visual Studio 2013 Professional and with slightly different syntax you can do the same with the free Visual Studio 2013 Express. It opens the currently active source file correctly, but no other source files.

I usually work with several projects at once (in a Workspace) and typically have several editor windows open. What I am missing is a way to automatically open all the same source files that are currently open in C::B also in Visual Studio debugger. To experiment, I found that $(ALL_PROJECT_FILES) will work as advertised, it opens all the current project files, but that is not what I want. Instead I think something like the imaginary $(ALL_OPEN_FILES) would do the trick, i.e. $(ALL_OPEN_FILES) would evaluate to full paths to all currently open source files in the C::B IDE, including files from different C::B projects.

Then I would specify:
/edit $(ACTIVE_EDITOR_FILENAME) /command "edit.goto $(ACTIVE_EDITOR_LINE)" $(ALL_OPEN_FILES) /debugexe $(TARGET_OUTPUT_FILE)

Is there perhaps a C::B variable somewhere to do this already?


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11394
    • Travis build status
Re: C::B "ALL_OPEN_FILES"
« Reply #1 on: December 19, 2018, 11:10:44 am »
The code is here: https://sourceforge.net/p/codeblocks/code/HEAD/tree/trunk/src/sdk/macrosmanager.cpp
It is probably easy thing to add. Then you can test it and if it is useful you can provide a patch.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2171
Re: C::B "ALL_OPEN_FILES"
« Reply #2 on: December 19, 2018, 11:12:59 am »
You probably can use the [[]] script expansion to solve this...

sadly there is no (scripting) api for this, but we can probably add a function to get an array with all open editors to the editor manager (i think this is really useful). Can you open a feature request on SF?

Offline cacb

  • Regular
  • ***
  • Posts: 381
Re: C::B "ALL_OPEN_FILES"
« Reply #3 on: December 19, 2018, 11:44:02 am »
Can you open a feature request on SF?

Yes, I guess I can do that (need to find my login info...).