how to set Visual Studio 2012 to use JavaScript ed

2019-05-16 11:15发布

问题:

How can I tell Visual Studio 2012 to recognize Classic ASP files (extension .asp) as JavaScript? I have registered .asp extension to Script Editor. That used to do the trick in 2010, but doesn't help here. It seems like VS doesn't know what language to use for Script Editor. There is no keyword highlighting, no intelicense.

回答1:

This can be changed by adding the extension asp with the editor HTML Editor:

Tools -> Options -> Text Editor -> File Extension

  1. For Extension type: asp
  2. Select the HTML Editor
  3. Click Add (or Apply if you are updating an existing rule)

EDIT: Played around a bit and found out that you need to use HTML Editor and not Web Form Editor.

FINAL EDIT: As per comments below, should use the following Script tags around sections of JScript code to indicate to the editor to use JScript intellisense and highlighting:

<script language="JScript" runat="server">
// place your JScript code here
</script>