Home Dashboard Directory Help

Javascript formatting bug by TKeathley



Sign in
to vote
Type: Bug
ID: 558465
Opened: 5/11/2010 12:08:29 PM
Access Restriction: Public
User(s) can reproduce this bug


The Visual Studio 2010 IDE is inserting a space after a function name and its parentheses in JavaScript when using the "Format Document" command; this occurs when the function definition is within a class definition (e.g. a Sys.UI.Control implementation). This did not happen in Visual Studio 2008, and there is no option to stop this behavior (the C# formatting provides a checkbox to turn this feature on and off).

We format everything during the IDE save event, which is causing files to appear changed by our code repository (e.g. during testing, the final save will always cause this space, even after undo-ing all changes in the file). Please either remove the formatting bug or provide an option to turn toggle it on/off.

Thank you.
Sign in to post a comment.
Posted by Microsoft on 10/20/2010 at 1:55 PM
Thanks for everyone's support in this issue.

We'll going to put a fix in the next service pack by adding two check boxes in tools->options->Text Editor->Jscript->Formatting->Spacing.

One is to "Insert space after function keyword for anonymous functions" (default checked), and one is to "Insert space after openning and before closing non-empty parenthesis" (default unchecked).

These should solve your problems.

Thanks again for the support, we really appreciate them.

Xinyang Qiu
Web Platform and Tools
Posted by Andrew Daniels on 10/15/2010 at 2:31 AM
Has there been any progress with this problem? Is it addressed in the latest patch?
Posted by Microsoft on 9/28/2010 at 4:54 PM
Hi, cjo268, we are trying to fix this issue right now by providing settings. But your comments is a little bit confusing to me. Could you please email xinqiu at microsoft dot com with your repro and detailed settings related to jscript?

Posted by cjo268 on 9/1/2010 at 2:59 PM
It happens to me on any javascript function not just in JSON. My co-workers don't have the problem. I can send you my settings for VS2010 if you tell me where to send them.
Posted by Andrew Daniels on 6/18/2010 at 6:59 AM
This is an absolute nightmare. Will it be fixed?
Posted by Microsoft on 5/13/2010 at 1:47 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you
Posted by TKeathley on 5/12/2010 at 7:45 AM
I edited the test case. The space is added when the function is contained within any JSON structure (it affects classes for us for the most part, but any JSON formatting will cause this to happen -- not just within a prototype).

For example:
something: function(){
Posted by Microsoft on 5/11/2010 at 11:17 PM
Thanks for reporting this issue. In order to fix the issue, we must first reproduce the issue in our labs. We are unable to reproduce the issue with the steps you provided.

Please export environment settings file by clicking Tools-> Import and Export Settings, after that, please send it to us so that we can conduct further.

It would be greatly appreciated if you could provide us with that information as quickly as possible. If we do not hear back from you within 7 days, we will close this issue.

Thanks again for your efforts and we look forward to hearing from you.

Visual Studio Product Team
Posted by Microsoft on 5/11/2010 at 5:06 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.