Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » Text Template / auto replace in code editor
Text Template / auto replace in code editor [message #16531] Mon, 23 June 2008 12:27 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

The "text template" is very useful for programming.
By "Text template" I mean automatic replace or an user wizard completing code by writing a simple text and after then when I press "Enter" or "Space" key. for example: when I write "if" and after then when i presss "Enter" then need to automatic replace to:
if (<cursor>) {
}
This is a simple example... but in practice is very useful. Will be glad if this mechanism will be integrated in u++.
I post video records:
1. Text template editor
2. Use text templates in editor

[Updated on: Mon, 23 June 2008 16:18]

Report message to a moderator

Re: Text Template / auto replace in code editor [message #18206 is a reply to message #16531] Tue, 16 September 2008 14:00 Go to previous messageGo to next message
amando1957 is currently offline  amando1957
Messages: 57
Registered: November 2007
Location: Wien/Vienna/Viden
Member
Hi tojocky,

You are so right, I would appreciate that too. It would perform more than a simple macro recorder. I've seen a very good solution for in the editor of Code::Blocks. A simple key-value-list with the keyword-text-pairs will do.

for = for loop
ffor = double for loop
etc.

the coding there was:
- $ is the placeholder for user-entries queried later
(can be one or more), e.g. for var names.
- the | is where the caret will be put.
- tabs typed where shown (while the entry) as --->.

A usual key for inserting is "Ctrl + spacebar" or alike.

kind greets
Martin
Re: Text Template / auto replace in code editor [message #18250 is a reply to message #18206] Thu, 18 September 2008 22:25 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Ok, so you write "for", then press Ctrl+Space and the macro is inserted?

Mirek
Re: Text Template / auto replace in code editor [message #18260 is a reply to message #18250] Fri, 19 September 2008 12:55 Go to previous messageGo to next message
cas_ is currently offline  cas_
Messages: 20
Registered: July 2008
Location: Poland
Promising Member
Yes, except that Ctrl+space might not be a good choice, while it's already used for autocompletion. Some IDEs simply use the Tab key for this purpose (Resharper for example).

It's great to have the possibility to quickly jump through remaining placeholders. For example, if you had a for loop template like this:

for( $init$; $cond$; $inc$ ) {
$body$
}

then the first placeholder ($init$) would be selected by default and ready to be replaced by something useful. Then, after pressing some special key (maybe the same as used for macro expansion), cursor would jump to the next placeholder ($cond$), highlighting it and preparing for replacement.
Re: Text Template / auto replace in code editor [message #19478 is a reply to message #18260] Sat, 06 December 2008 13:42 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
The first iterations is finished:

http://www.ultimatepp.org/forum/index.php?t=post&frm_id= 50&
Re: Text Template / auto replace in code editor [message #19480 is a reply to message #19478] Sat, 06 December 2008 16:31 Go to previous message
bytefield is currently offline  bytefield
Messages: 210
Registered: December 2007
Experienced Member
The correct link is this Razz
http://www.ultimatepp.org/forum/index.php?t=msg&th=4049& amp;start=0&


cdabbd745f1234c2751ee1f932d1dd75
Previous Topic: [BUG?] 1-liner functions are not supported by Assist++?
Next Topic: tooltip bug with assist++
Goto Forum:
  


Current Time: Tue Apr 16 21:02:47 CEST 2024

Total time taken to generate the page: 0.01478 seconds