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

Bug 332079

Summary: [content assist] JSP editor inserts template instead of surrounding selection
Product: [WebTools] WTP Source Editing Reporter: Zeljko Vukovic <vukovicmns>
Component: jst.jspAssignee: jst.jsp-triaged <jst.jsp-triaged>
Status: NEW --- QA Contact: Nick Sandonato <nsand.dev>
Severity: enhancement    
Priority: P3 CC: am2605, rakes123, thatnitind
Version: 3.1Keywords: helpwanted
Target Milestone: Future   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Zeljko Vukovic CLA 2010-12-07 15:00:35 EST
I have a JSP editor template that looks like this:

	foo
	${line_selection}
	bar

When this template is applyed to a selection, instead of wraping foo and bar around the selected lines, it pastes the result of the template at the end of the section.

	asdqwe

becomes

	asdqwe foo
	asdqwe
	bar


-- Configuration Details --
Product: Eclipse 1.2.2.20100122-1337 (org.eclipse.epp.package.jee.product)
Installed Features:
 org.eclipse.jdt 3.5.2.r352_v20100108-7r88FEwFI0WTuoBl0iaG0tyhfZH6
Comment 1 Nitin Dahyabhai CLA 2010-12-07 16:20:33 EST
Are you able to reproduce this with Helios SR1?
Comment 2 Nick Sandonato CLA 2010-12-07 16:27:41 EST
I can confirm that this does happen. You can see this for non-template proposals as well. I'm not sure if this was a design decision, but with our XML-based editors, nodes are not replaced by the proposal text, but prepended to it. The CSS editor, though, replaces selected text with the proposal.
Comment 3 Zeljko Vukovic CLA 2010-12-07 16:35:28 EST
(In reply to comment #1)
> Are you able to reproduce this with Helios SR1?

Yes. Same goes with Helios SR1.
Comment 4 Rakesh CLA 2011-01-13 05:03:45 EST
Hi Nick, it looks like a design decision in ReplaceNameTemplateContext class.
If template name doesn't match with that prefix before cursor, "asdqwe" in case above, it will be appended after this prefix.If our template name was "asdqwe" in above example we would get correct proposal.I am not sure why it is supported this way.
Comment 5 Zeljko Vukovic CLA 2011-01-13 05:14:56 EST
It should be noted that Java editor has a sepparate "Surround with" action in the "Source" menu, that has the desired effect. Maybe this should be changed to an enhancenent request, to add this functionality to this editor?
Comment 6 Nick Sandonato CLA 2011-01-21 16:45:24 EST
Thank you for your report. I agree that this sounds like an enhancement.
Comment 7 Andrew Myers CLA 2018-02-01 05:03:58 EST
This seems to apply to the html files as well - not specific to JSP.  I'm still seeing it in Oxygen.2 Release (4.7.2).  I would be willing to help add it as an enhancement if anyone is able to help get me started with it?