Completion for XML tags

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
dkafrissen
Posts: 9
Joined: Mon Apr 26, 2004 8:32 pm

Completion for XML tags

Post 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.
User avatar
BenjiSmith
Posts: 49
Joined: Fri Jan 16, 2004 9:37 pm
Contact:

Post 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
dkafrissen
Posts: 9
Joined: Mon Apr 26, 2004 8:32 pm

You must submit your macro code

Post 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
Post Reply