SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => SlickEdit User Macros => Topic started by: chrisant on June 11, 2009, 07:50:32 PM
-
Patch to built in command:
c_expand_space
Written for:
SlickEdit 14.0, but can probably be applied to 13 (maybe even earlier versions).
Description:
Typing #include in a Slick-C file and then pressing Spacebar pops up a list of header files from the current project, to autocomplete the #include directive. This patch adds the same functionality in C/C++ files.
Installation:
1. Open the macros\c.e file.
2. Find the c_expand_space command.
3. Find the line "} else if ( pos(' 'word' ',EXPAND_WORDS) ) {" in the function.
4. Insert the patch code from below above that line.
5. Reload the module (Macro|Load Module).
Warning: Modifying built in macros can potentially be dangerous, and modifications can get overridden when upgrading. Exercise caution.
// BEGIN PATCH
} else if ( word=="#include") {
replace_line(indent_string(width)word' ""');
_end_line();
left();
_do_list_members(false, true);
// END PATCH
} else if ( pos(' 'word' ',EXPAND_WORDS) ) {
-
Very cool 8)
-
Note that this patch was incorporated into the official 14.0.2: there is a new setting def_c_expand_include which you can set to 1 to activate the patch (it is off by default). At the SlickEdit command line invoke "set-var def_c_expand_include" to change it.
-
This is very nice!
In my source tree we have several include subdirs, each has .h files that I would like to see in the list.
src/inlcude/foo/ (with foo1.h foo2.h foo3.h)
src/include/bar/ (with bar1.h bar2.h bar3.h)
src/include/baz/ (with baz1.h baz2.h baz3.h)
(Obviously it's not THAT crazy, but it's an example)
I've noticed that if I add "src/include/foo" to the Project directories I get autocomplete for
#include "foo1.h"
but I need
#include "foo/foo1.h"
I would like to add "src/include" and have all subdirs added, or even each added individualy but get the output desired.
Any ideas on how I could adjust to get this?
M@