Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ahlongxp on October 11, 2006, 04:24:21 pm

Title: what is CodeSnippets for?
Post by: ahlongxp on October 11, 2006, 04:24:21 pm
I don't know how to make use of it.
can someone give me a small sample?
Title: Re: what is CodeSnippets for?
Post by: BCCISProf on October 11, 2006, 04:52:07 pm
CodeSnipppets allows you to create a 'library' of snippets of code that you want to resuse.

For example, lets say that you start each program with an elaborate comment. Rather than have to type it over and over, you simply highlight the comment (or any number of lines) and drag it into the codesnippets window. It will then allow you to give it a name.

Open a new file and double click on the name you chose for the snippet, and it will place that code at the cursor.

Its like a clipboard that can hold any number of 'snippets' of code that you can reuse at anytime.

Very useful!
Title: Re: what is CodeSnippets for?
Post by: ahlongxp on October 12, 2006, 07:34:39 am
CodeSnipppets allows you to create a 'library' of snippets of code that you want to resuse.

For example, lets say that you start each program with an elaborate comment. Rather than have to type it over and over, you simply highlight the comment (or any number of lines) and drag it into the codesnippets window. It will then allow you to give it a name.

Open a new file and double click on the name you chose for the snippet, and it will place that code at the cursor.

Its like a clipboard that can hold any number of 'snippets' of code that you can reuse at anytime.

Very useful!

thanks a lot.
but there's a problem. can I preview the selected code snippet beside applying it
Title: Re: what is CodeSnippets for?
Post by: BCCISProf on October 12, 2006, 03:16:35 pm
Apparently not. However, you can name each snippet. Probably designed for small pieces of code, so you can drag them into the editor, and if its not to your liking delete it.

Perhaps you can suggest this as an enhancement to the developer.
Title: Re: what is CodeSnippets for?
Post by: artoj on October 12, 2006, 03:38:13 pm
but there's a problem. can I preview the selected code snippet beside applying it

No you can't, yet.