feature request for better string awareness

I end up doing a lot of string manipulation in IntelliJ b/c of XML.

A lot of those strings come from without (of IntellJ), for instance a document or my XML editor.

When I try to paste a typical String in, using advanced paste features, or rather hoping advanced paste recognizes what I am trying to do, it doesn't work too well.

Here is a typical String:

<manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text"

You can see where the trouble is ; all those " and / and > characters. I just want this string of characters to be magically recognized and turned into a proper String in contexts like

String myXMLString = <manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text"


StringBuffer myXMLStringBuffer = new StringBuffer (<manifest:file-entry manifest:media-type="application/vnd.oasis.opendocument.text"

I wish IntelliJ would escape everything it needs to in order that this string or ascii characters (or whatever) be treated as a String when I paste it into IntelliJ

Comment actions Permalink

Just paste it into an empty string (i.e. type String myXMLString = "" first and then paste inside the quotation marks). Then everything should get escaped.

Comment actions Permalink

Oh yeah that does the trick! Thanks!!

Comment actions Permalink

As the person who first asked for this functionality about five years ago, I should note that it's trickier and less obvious that it should be. There's a usabilty gain to be made here, but I'm still not quite sure what it is.

--Dave Griffith

Comment actions Permalink

i've often looked for a "surround with quotes" intention
this isn't a refactoring though


Please sign in to leave a comment.