Bug 106165 - Enhance KDevelop snippet support - KDevelop snippets in true opensource spirit
Summary: Enhance KDevelop snippet support - KDevelop snippets in true opensource spirit
Alias: None
Product: kdevelop
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist with 20 votes (vote)
Target Milestone: ---
Assignee: kdevelop-bugs-null
Depends on:
Reported: 2005-05-23 17:49 UTC by Michael L.
Modified: 2008-06-29 23:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Michael L. 2005-05-23 17:49:00 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Compiled From Sources

The re-use of code fragments is often very important in large software projects, so it would be useful if KDevelop's snippet support could be somewhat more extended, hence I'd like to get some feedback about ideas that I had recently.

So. how about:

Support meta information for snippets:
- allow to provide a description for a snippet
- allow snippet authors to use an "author" field
- allow version information for snippets


- allow multiple programming languages to be specified for a snippet, (i.e. C/C++)
- allow users to specify supported operating systems (i.e. Win9x,NT,Linux,BSD, cross-platform) for their snippets
- allow users to specify supported compilers for a snippet (i.e. gcc,icc,bcc,mingW32)
- allow users to specify required libraries/toolkits for a snippet (i.e. QT,GTK,MFC)
- allow users to optionally categorize snippets into GENERAL categories, (i.e.: CLI IO,parsing,networking)

On the GUI part:

- display description (or alternatively header of the actual snippet fragment) as tooltip in treeview
- support different snippet 'databases' - selectable via combo box
- support searching snippet databases, based on aforementioned meta information about snippets
- support different symbols/icons in snippets treeview for different programming languages
- support a "snippet hotkey" to open up a combo box at current code position in order to insert code
- support "use this snippet as template for new snippet" (i.e. copy snippet to new snippet)

More powerful (aka 'killer') features:

allow snippets to keep track of external dependencies (i.e. headers):
For example, the following snippet would have *one* external dependency to stdio.h:

for (int i=0;i<=10;i++)
	printf("Hello World\n"); /* depedency */

=> if the current source file doesn't yet include the required headers, offer user to automatically add a corresponding #include statement at the top of the current file.

support snippet parametrization/generalization:

The above snippet might then become:

for (int @var_1@=@val_1@,@var_1@ @condition@ @val_2@;@var_1@ @incrementor@)
	@function@ (@params@);

... so that some sort of simple wizard can easily fill in the relevant variables.

support cross-referencing of snippets / snippet inter-dependencies:

... so that snippets can depend on other snippets:

/*Snippet #1 Name:loop*/

while(@condition@) {


/*Snippet #2 Name:*/

@retval@ @funcname@ (@params@)



=> users who'd make use of snippet #2 would automatically depend on snippet #1, a potential snippet-wizard would hence have to recursively look for depedencies.

 support exporting/importing => *sharing* of snippets:

Allow users to export selected snippet(s)/database(s) as XML files, so that 
users can easily share valuable snippets.

 support project-specific snippets:

if snippets are non-global, but rather project-specific, allow users
to categorize their snippets into *project*-specific groups, i.e.:

	- log window related
	- ctags related
	- help system

also, support snippets that are saved globally, but rather as part of 
active source trees, that way KDevelop could open custom snippet archives 
for each projects that support "custom snippets".

So, projects like kdevelop could for example export their own
"frequently used" snippets as a separate XML file within the source
tree, whenever a new developer wants to develop for kdevelop, the
snippets are likely to come in extremely handy.

Well, just some food for thoughts - I would really not mind to look into implementing some of this some day, however I'm not sure how many users (besides me) would also consider such functionality pretty useful and actually COOL.

So, if you like some of these ideas please leave a vote, so that I know that I'm not the only one who's interested in such a pimped version of snippet support ;-)

Thanks, I'd appreciate any feedback - also, if you're interested in adding some of these features, please leave a short note here, so that there's not different people working on the same stuff.
Comment 1 Timo Steuerwald 2005-08-05 14:38:47 UTC
Hi Michael!
This is a very good diversified wish list! Thanks! I currently wanted to open a bug only for the snippet hotkey issue. I think this will be extremly useful because with this I won't take my right hand of the keyboard anymore. :-)



Comment 2 Michael L. 2005-09-15 04:37:26 UTC
pleased to see you like these ideas, if these ideas really appeal to you, I would like to encourage you to leave a vote via "Vote for this bug" ( http://bugs.kde.org/votes.cgi?action=show_user&bug_id=106165 )
Comment 3 Michael L. 2005-09-15 04:45:18 UTC
Sorry, just noticed that you did do exactly that already.
Never mind ;-)
Comment 4 Vito De Tullio 2007-02-11 13:03:14 UTC
*** This bug has been confirmed by popular vote. ***
Comment 5 Andreas Pakulat 2008-06-29 23:13:31 UTC
Snippets have been greatly extended in kdevelop4. If you still find things missing, please open individual bugreports. For general discussions about what might be good ideas for the plugin please use the mailinglist, thats far more effective.