Search
Closed
as Won't Fix Help for as Won't Fix

13
Sign in to vote
1
Sign in to vote
Sign in
to vote
Type: Suggestion
ID: 506691
Opened: 10/30/2009 12:20:16 PM
Access Restriction: Public
0
Workaround(s)
If a developer has ever pasted code from the Internet or some document into the Visual Studio editor they may have then received compilation errors because not all quotation characters are valid.

In an effort to get around this temporarily I have a small program that uses a Windows Forms RichTextBox and it will replace the invalid characters with valid equivelents. I have attached a small VS 2008 solution to this item to illustrate the problem.

When editing .net books before publication I run into this problem all the time and as such I wrote the attached program to do the conversion. It would be awesome if VS2010, or more likely DEV11, would be able to fix this issue.
Details (expand)

Version Currently Used

Visual Studio 2010 Beta 2

Operating System Currently Used

Windows 7

Suggestion

Visual Studio editor should convert invalid quotation characters when code is pasted into the editor from another source.

Benefits

Faster Development
Improved User Interface

Other Benefits

 
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey. [Details]

 

File Attachments
1 attachments
SourceCodeFormatter.zip
Sign in to post a comment.
Posted by Maarten van Stam on 10/30/2009 at 1:45 PM
Not -very- important, but I recognize the issue (and yes, I'm a tech reviewer of books too at times) and would be a nice tiny feature to fix and make life good.

-= Maarten =-
Posted by Peted66616 on 10/30/2009 at 2:06 PM
I don't think this is important at all. And I'd rather the IDE team spend their time on more broadly useful or important features, than tracking down every possible matching quote character in the Unicode space, as well as figuring out how to deal with nested quotes. And of course, how is the editor suppose to know that something being pasted in is in fact including quotes delimiting a string literal, rather than paired quotes that are a legitimate part of text?

Besides, if the original text from which the text is copied has the wrong quotes, then that original text is wrong too. This feature would just hide a symptom, not fix the original problem. (Hint: in Word, when auto-replace changes the quotes, just hit Ctrl-Z to undo the change).
Posted by wkhazzard on 10/30/2009 at 2:13 PM
I think it would be useful to have the IDE fix the quotes (as an option) but I'd say it's medium to low priority.
Posted by iowacbr600f4guy on 10/30/2009 at 2:15 PM
Almost ever user of Visual Studio that I know has been bitten by this IDE bug, and I have to say that I get it at least a few times a week myself.

I think with the minimal efforts that would be necessary this is a good change to get put in.

I too am an author and tech editor...but I know many developers that have expressed distaste for this
Posted by Fabrice Marguerie on 10/30/2009 at 6:55 PM
It may be better to implement this as an add-on for Visual Studio. This way this kind of processing would apply only to the persons who need it.
All Microsoft would have to do is ensure that creating such an add-on is possible.
Posted by casperOne on 10/31/2009 at 10:07 AM
If htis was done, also map various versions of 'x' (when hexidecimal values are pasted).
Posted by Microsoft on 11/5/2009 at 1:24 PM
Hi Doug,

Thanks for the feedback! This is a good suggestion and one that could definitely make life better for certain folks. We don't have the time/resources to add it into VS2010, but we'll consider it for a future release, either as a baked in feature or an extension/add-in. Perhaps someone in the community will even pick this up and create an extension as well :). In the meantime, I'm going to resolve the bug as "Wont Fix" for VS2010. Feel free to either re-activate the bug or contact me directly at djpark at microsoft.com with any more questions/feedback.

Regards,
DJ Park
C# IDE, Program Manager
Posted by justingrant on 11/16/2009 at 12:22 PM
Hey DJ - if this is something you want to consider for future versions of the IDE, shouldn't you resolve this as "postponed"? Folks sending feedback in through Connect can't reactivate bugs, so you're forcing the community to re-open things every release.

BTW, I've been bitten by this problem many times when copying code or HTML from online sites. It's often very hard to identify the problem is a quote that's not really a quote.

I'd suggest that you consider this in the core IDE since it's so common. One possible implementation might be a warning box when you paste code (or HTML, or XML, etc.-- this is not just a C# editor problem, and it's actually more of a big deal in the HTML/XML editors where these bugs are harder to find) which contains one of a known set of "potentially dangerous" characters. If the pasted code contains one of those characters, the warning message should let the user know, and invite the user to either paste as-is, or manually revise the text and try pasting again. Of course, you'd want a "don't show me this dialog again" for folks, like on this comment thread, who don't find this feature useful.

Optional automatic fixup of "potentially bad" characters with their "better" equivalents might be a nice extra step to add to the feature, but detecting that there's a (potential) problem is the highest priority. Replacement should never be automatic since sometimes you will actually want to insert one of those "bad" chars.

Another optional thing you could add to this feature is the ability to customize the set of bad (and replacement?) chars in Tools...Options.

Summarizing, here's my suggestions for requirements:

Must have:
warning dialog when you paste text containing one of a set of known potentially bad unicode characters
warning shows up in all text editors, including (especially) HTML editor and XML editor
"don't show me this again" checkbox for the warning UI

Should have:
- Optional auto-replacement of bad chars with their good equivalents
- Tools...Options UI for customizing the set of characters
- Ability to include multiple-character sequences

Nice to Have:
- Find-and-replace-style UI to allow selective replacement when there are multiple matches
- Use smart tags and/or squigglies to indicate potentially problematic chars after pasting
- Regular expression matching and replacement