Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 518018

Summary: [html][tooling] Add feature to change element's tag
Product: [ECD] Orion Reporter: Carolyn MacLeod <Carolyn_MacLeod>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: kuschel
Version: unspecified   
Target Milestone: 16.0   
Hardware: PC   
OS: Windows 7   
See Also: https://github.com/eclipse/orion.client/pull/113
Whiteboard:

Description Carolyn MacLeod CLA 2017-06-08 11:55:02 EDT
Say you have a div with lots of children in an html file, and you want to change it to a section (if you ever do this, make sure to give the section a label <g>). (I was looking at the div with id="pageToolbar" on line 27 of orion-preview.html).

- Select "div" in the start tag
- Note that the div end tag is nicely highlighted... but it's scrolled way off the page because there are so many children (you can see the highlight indicator in the right-hand annotation bar)
- Type "section" to change the tag
- Note that the end tag is no longer selected, and since it is buried somewhere deep in the file, it would be pretty time-consuming to scroll around and figure out where the </div> is... so you type div back instead of section, select again, go find out that the end div is on line 103, memorize that, and then type "section" in the start tag and the end tag (now that you know where it is)
- Wish there was a better way
- For grins, try Tools -> Rename element ...but of course, that fails because it's only for javascript "elements" like variable and function names (it shouldn't be enabled - or even present - on an html file, but that's another story)

Would be nice if there was a command for renaming (re-typing? re-tagging?) an html element.
Comment 1 Eclipse Genie CLA 2017-07-14 11:47:10 EDT
GitHub Pull Request 113 created by [mrennie]
https://github.com/eclipse/orion.client/pull/113
Comment 2 Michael Rennie CLA 2017-07-14 11:48:17 EDT
Merged.
Comment 3 Carolyn MacLeod CLA 2018-04-20 18:23:41 EDT
An even cooler fix for this would be not to have a rename command at all. Just let the user select the start or end tag and type the new tag name right over the old one. I've seen other html editors work like this. It's much simpler than having to type a command first, and the assumption is that if you are typing a new start tag name, you obviously want the end tag fixed up as well (and vice-versa).