Bug 332079 - [content assist] JSP editor inserts template instead of surrounding selection
Summary: [content assist] JSP editor inserts template instead of surrounding selection
Status: NEW
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 7
: P3 enhancement with 1 vote (vote)
Target Milestone: Future   Edit
Assignee: jst.jsp-triaged CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2010-12-07 15:00 EST by Zeljko Vukovic CLA
Modified: 2018-02-01 05:03 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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?