I am using Eclipse 3.6.1 Build id: M20100909-0800 and Aptana Studio 2.0.5 which is based on Eclipse 3.5.2 (both on OS X) and in both programs the external tools feature seems to swallow double quotes and whitespace for the ${selected_text} variable.
Isn’t the ${selected_text} variable essentially useless with the mentioned behaviour?
Is there a way around that or maybe a hidden setting somewhere?
Thanks for reading.
This could easily be considered a safety/security feature.
I suggest
"${selected_text}".…but if it’s eating ALL whitespace, that won’t really help. Huh. Maybe it’s clever enough to detect the quotes and preserve the whitespace… but probably not.
Okay, I did a little poking around. Quotes within the argument list itself are preserved, as per my initial suggestion above. I found the following auto-generated argument list that was working Just Fine:
But if your text selection contains quotes, I’d expect it to be handled as per the underlying OS. Windows “cmd” does some… creative things with them for example. My *nix-fu is Not Mighty, so I couldn’t tell you what OS X will do under the covers, but I suspect that’s where you’ll find your solution.
You may have to do something goofy like URL-encode your selection, and use some command line tool to un-encode it before passing it to your desired external tool once the text is out of Eclipse’s clutches.
A (very) quick look around my 3.6.1 UI didn’t turn up that would do this automagically for you, but there’s probably a plugin out there somewhere that’ll add that feature to an editor’s context (right click) menu.
I’d expect the HTML editor to have this ability already… but I don’t see anything other than “smart insert mode” that sounds promising, and I don’t see that working either.
That doth bloweth goats, most heartily, yay for weeks on end. E’en till yon goat hath a rash, most unpleasant in both severity and locality. Verily.
I don’t think you’re getting my proposed solution:
“1” is why I was looking for some eclipse UI way of url-encoding a selection. The HTML Editor won’t even do it when you paste into an attribute string. Sheesh.
Two Other Options:
I’m not sure what the scope of #2 is, but I’d image if you don’t have any eclipse plugin experience the thought might be rather daunting. There might even be a sample plugin that exposes such a variable, though I haven’t checked.
I don’t think we’re communicating.
You don’t select text with quotes in it. You select mangled text, and sed demangles it back into quotes for you.
For example, you have the string
print("hello world");in your editor and want to send that to your tool.print(~hello world~);in your editor. Manually or via a script or whatever.~s back to"s.print("hello world");.This is a manual process. It’s not pretty. Bug workarounds are like that. You can probably come up with a monkey script to convert quotes to Something Else, and “undo” is easy. You might even be able to get your script attached to a keyboard short cut… dunno. And
~is a lousy choice for a replacement character, it’s just the first thing I could think of that was rare enough to be a decent example.Are we communicating yet?