Visual Studio 2010: force syntax highlighting / intellisense for specific file

馋奶兔 提交于 2019-12-12 01:13:11

问题


in a web application i've some dynamic js files, with aspx extension; i would to benefit the syntax highlighting / intellisense support for javascript while editing, but Visual Studio does not recognize the file as javascript. Is there some way to force visual studio to threat a file with a custom "editing experience"?


回答1:


I am using a similar approach to what you are doing. I'm using Visual Studio 2013 and I can fool it by adding a <script> tag in a code block that is not executed:

<%@ page language="C#" autoeventwireup="false" codefile="Script.aspx.cs" EnableViewState="false" inherits="Script" StyleSheetTheme="" %>

<% if (false){ %> <script type="text/javascript"> <% }%>

... Javascript goes here

<% if(false){ %> </script> <% }%>


来源:https://stackoverflow.com/questions/13230631/visual-studio-2010-force-syntax-highlighting-intellisense-for-specific-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!