在VIsual Studio中使用javascript

时间:2022-08-24 21:42:45

To work with JS files in Visual Studio 2008, I did:

要在Visual Studio 2008中使用JS文件,我做了:

Tools -> Options -> Text Editor -> File Extensions

and added js extension with Script editing experience.

并添加了带脚本编辑经验的js扩展。

That works pretty much as expected apart from the following things:

除了以下内容之外,这几乎与预期相同:

  1. Syntax highlighting is set-up extremely slow (after 10 seconds or so) when I open the JS file. The compiling warnings are generated equally slow and they disappear slowly when fixed. Generally, not a big deal, but I wonder why. Until the file is syn highlighted, you can't put in breakpoints.

    当我打开JS文件时,语法突出显示设置得非常慢(大约10秒左右)。编译警告生成速度相同,并且在修复时会慢慢消失。一般来说,没什么大不了的,但我想知道为什么。在文件突出显示之前,您不能放入断点。

  2. Intelisense works, but not always. For instance, if I use getElementById to get the element, intelisense with that element doesn't work. I guess it has to do with context, as the compiler can't determine what kind of object is in question. It also doesn't work inside an html page using the script tag, but in this case syn highlighting is immediate.

    Intelisense有效,但并非总是如此。例如,如果我使用getElementById来获取元素,则使用该元素的intelisense不起作用。我想它与上下文有关,因为编译器无法确定哪个对象有问题。它也不能在使用脚本标记的html页面内工作,但在这种情况下,syn突出显示是立即的。

If there is any better approach?

如果有更好的方法?

I am currently opting to use an external editor and to launch it by adding a custom "open with" action on js file. However, I don't like doing this because I can't use the fantastic VS debugging capabilities...

我目前选择使用外部编辑器,并通过在js文件中添加自定义“打开方式”操作来启动它。但是,我不喜欢这样做,因为我无法使用梦幻般的VS调试功能......

1 个解决方案

#1


The 3rd party addin Visual Assist X can help with js.

第三方插件Visual Assist X可以帮助js。

#1


The 3rd party addin Visual Assist X can help with js.

第三方插件Visual Assist X可以帮助js。