Page 1 of 1

Completion for XML tags

Posted: Mon May 10, 2004 8:17 pm
by dkafrissen
Greetings,

This is a feature that Netbeans has that I really like.

Suppose you have

<component>
<foo></foo>
</


As soon as you type the forward slash the word component is emitted by textpad because that would complete the open xml tag.

Saves typing and is helpful to see if you are prorperly closing tags because if the completion does not happen you know something is incorrectly closed.

Posted: Tue May 11, 2004 7:51 pm
by BenjiSmith
This is exactly the kind of thing that I think could be implemented as a user-defined function, if we had a powerful enough Macro language at our disposal.

Here's the pseudocode I'd write:

Code: Select all

on event(KEY_PRESS) {
	if (currentFile.fileExtension == 'XML') {
		if (lastKeysPressed(2) == '</') {
			String xmlTag = searchBackwardForOpenTag();
			autocomplete.addChoice(xmlTag);
		}
	}
}

String searchBackwardForOpenTag() {
	// BLAH BLAH BLAH
}
In my opinion, the MOST IMPORTANT aspect of any Macro language that we get is that we have access to application objects and events. If you agree, chip in your opinion here:

http://textpad.com/forum/viewtopic.php?t=3775

You must submit your macro code

Posted: Tue May 11, 2004 8:40 pm
by dkafrissen
Okay, I voted for the feature. In exchange when the time comes you need to submit back your macro code to the user community.

Regards,

Dave