Disabling Knockout Intellisense

Disabling Knockout Intellisense

  • Comments 10

Update 4/4/2013: This problem is fixed in Visual Studio 2012 Update 2 (VS2012.2). If the internal JavaScript engine could not figure out the IntelliSense in one second, VS will time out instead of keep evaluating (which in some cases can slow down VS significantly).  If it happens, some KnockoutJS IntelliSense will not be shown in the editor.  There are some workarounds you can do in order to show the knockout IntelliSense in time for such cases, such as using JavaScript XML documentation comments to speed up the IntelliSense evaluation.  For example, the following green comment will bypass the JQueryUI autocomplete evaluation and speed up the IntelliSense process.

$(document).ready(

function () {

    $('myInput')

        .bind("keydown", function (event) {

        }).each(function () {          

             /// <returns value="" />

            $(this).autocomplete({

                source: $(this).data("test")

            });

        });

});

Thanks.

Xinyang Qiu

 

==========  Original Post ========== 

Web Tools Extensions 1.2, which is part for the Web Platform Installer package named “Windows Azure SDK for .NET (VS 2012) 1.8.1 – February 2013” contains a new feature which provides Intellisense in web forms and web pages for KnockoutJS MVVM data binding.  You can verify that you have Web Tools Extension 1.2 installed by opening Visual Studio’s “About” dialog and scrolling through the installed products list to find:

                Web Developer Tools    1.2.40208.0

Unfortunately, upon installation several customers have reported slow-downs and lock-ups of Visual Studio when editing certain web pages containing Knockout syntax.  We are actively investigating this issue and hope to have a solution soon.  In the meantime, you can turn this feature OFF by doing the following:

  1. Create a file named TurnKoOff.txt and paste the following text into the file:
    Windows Registry Editor Version 5.00


    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\HTML Editor]
    "KnockoutSupportEnabled"="0"
  2. Create another file named TurnKoOn.txt and paste the following text in:
    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\HTML Editor]
    "KnockoutSupportEnabled"=-
    NOTE: If you are running Visual Studio 2012 Express for Web rather than Visual Studio 2012 Professional, Premium or Ultimate, substitute “\VWDExpress\” for “\VisualStudio\”.
  3. Change the extensions of both files from “.txt” to “.reg.”.
  4. Ensure that Visual Studio (or Express for Web) is not running.
  5. Double-click TurnKoOff.reg.  You will receive the warning:
    ”Adding information can unintentionally change or delete values and cause components to stop working correctly. If you do not trust the source of this information in TurnKoOff.reg, do not add it to the registry.”
  6. After exercising all appropriate caution, click “Yes”.
  7. Restart Visual Studio or Express for Web.

Knockout Intellisense will now be completely disabled.  It can be turned back on by double-clicking the TurnKoOn.reg file.

Please let us know if this solution does not work adequately for you.

We are interested in learning more about what cases some customers experience hangs and slow-downs.  Please share any information with us that you think will be helpful.

Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post
  • Thanks for this - at least I can install it and get the rest of the features now, along with using the latest version of Web Essentials.

    Shame about the knockout though - hope you find the cause for this soon as I'm looking forward to this feature.

  • This fixed the error "unrecognized namespace asp".

    So it seems the Knockout intellisense update broke the entire webforms intellisense. Strange not many people noticed this before release?

  • @Robert Small

    Hi, Robert, could you please contact xinqiu at microsoft dot com for the "unrecognized namespace asp" problem you encountered?  We don't quite understand how the server control intelliSense scenario relates to the knockout JavaScript intelliSense issue.  So we think you can help us with your repro project. Thank you very much!

    Xinyang Qiu

    .NET Web Platform and Tools team

  • Thanks! I was crashing all morning until I found this. And when I wasn't crashing VS was eating CPU constantly.

  • Is this fixed in the vs2012.2 update? I didn't see it mentioned here: support.microsoft.com/.../2797912

    This report says it would be: connect.microsoft.com/.../visual-studio-2012-hangs-when-editing-knockout-binding-in-razor-view

  • @Kevin, Yes, it's fixed in VS2012.2 Update released today 4/4/2013.  

    Xinyang Qiu

    .NET Web Platform and Tools team

  • No, this is not fixed at all. I just installed vs2012.2 and now even editing a simple javascript file is almost impossibile.

  • @J, this fix is to make sure knockout intelliSense does not get hang the HTML editor.  You mentioned JavaScript file problem, could you please log a bug in connect please?  Please also email to xinqiu at Microsoft dot com so I can make sure the JavaScript editor team get your response.  Thanks.

  • Hello, I don't experience slow downs as such, but the syntax highlighting in the HTML editor regarding KnockoutJS is all over the place for me.

    I assume its only meant to highlight the data-bind="" quotations. Its fine the first time I open the aspx page, but as soon as I change anything, it breaks and highlights random things.

    I have quite a few add-ons installed, is it possible one is causing a conflict and so making this fail?

  • @marlon_tucker , it's possible that one of the extensions affected the scenario, could you please try to disable each extensions and see if it restores the proper behavior?  If it happens on your VS without any extra extensions, then it's definitely one of our bug, and please contact us directly through email or log a bug on connect.  Thanks!

Page 1 of 1 (10 items)