问题
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
- For
Extensiontype:asp - Select the
HTML Editor - Click
Add(orApplyif 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>
来源:https://stackoverflow.com/questions/15911230/how-to-set-visual-studio-2012-to-use-javascript-editor-for-asp-files