有没有办法在Visual Studio 2008中“隐藏”来自IntelliSense的JavaScript文件?

时间:2022-12-18 01:33:25

I have a third party JavaScript plug-in but including the file breaks IntelliSense for jQuery amongst other things. The only way I can get IntelliSense back working with jQuery is by commenting out the plug-in. Is there a way I can hide the plug-in file from the IntelliSense parser?

我有一个第三方JavaScript插件,但包括该文件打破了jQuery的IntelliSense等。我可以让IntelliSense重新使用jQuery的唯一方法就是注释掉插件。有没有办法可以从IntelliSense解析器隐藏插件文件?

4 个解决方案

#1


9  

Service Pack 1 added the following feature:

Service Pack 1添加了以下功能:

If you "anyfile.js" and "anyfile-vsdoc.js" in the same directory, then any references to "anyfile.js" will automagically be converted to a reference to "anyfile-vsdoc.js" behind the scenes.

如果在同一目录中有“anyfile.js”和“anyfile-vsdoc.js”,那么对“anyfile.js”的任何引用都将自动转换为对幕后“anyfile-vsdoc.js”的引用。

Add an empty file next to your plugin with "-vsdoc" appended to the filename. That should "hide" the plug-in from the external javascript processor.

在插件旁边添加一个空文件,并在文件名后附加“-vsdoc”。这应该从外部JavaScript处理器“隐藏”插件。

#2


2  

You could always load it from your code-behind instead of the scriptmanager in your aspx/master. That way the IntelliSense doesn't know it's there. Using ScriptManager.RegisterClientScriptInclude(..).

您总是可以从代码隐藏中加载它而不是aspx / master中的scriptmanager。这样IntelliSense就不知道它在那里。使用ScriptManager.RegisterClientScriptInclude(..)。

#3


1  

It could be that third party JavaScript plugin you're using has some errors in it.
I would check the code in JSLint and directed this question to the author of the plugin.
As for the question itself: I don't think you can exclude it if it's a part of the project, but go over the MSDN: Using IntelliSense to prove it.

可能是您正在使用的第三方JavaScript插件中存在一些错误。我会检查JSLint中的代码并将此问题指向插件的作者。至于问题本身:如果它是项目的一部分,我认为你不能排除它,而是通过MSDN:使用IntelliSense来证明它。

#4


1  

Since you mentioned jQuery, you could also load the troublesome script during runtime.

既然你提到了jQuery,你也可以在运行时加载麻烦的脚本。

$.getScript("XXX.js");

#1


9  

Service Pack 1 added the following feature:

Service Pack 1添加了以下功能:

If you "anyfile.js" and "anyfile-vsdoc.js" in the same directory, then any references to "anyfile.js" will automagically be converted to a reference to "anyfile-vsdoc.js" behind the scenes.

如果在同一目录中有“anyfile.js”和“anyfile-vsdoc.js”,那么对“anyfile.js”的任何引用都将自动转换为对幕后“anyfile-vsdoc.js”的引用。

Add an empty file next to your plugin with "-vsdoc" appended to the filename. That should "hide" the plug-in from the external javascript processor.

在插件旁边添加一个空文件,并在文件名后附加“-vsdoc”。这应该从外部JavaScript处理器“隐藏”插件。

#2


2  

You could always load it from your code-behind instead of the scriptmanager in your aspx/master. That way the IntelliSense doesn't know it's there. Using ScriptManager.RegisterClientScriptInclude(..).

您总是可以从代码隐藏中加载它而不是aspx / master中的scriptmanager。这样IntelliSense就不知道它在那里。使用ScriptManager.RegisterClientScriptInclude(..)。

#3


1  

It could be that third party JavaScript plugin you're using has some errors in it.
I would check the code in JSLint and directed this question to the author of the plugin.
As for the question itself: I don't think you can exclude it if it's a part of the project, but go over the MSDN: Using IntelliSense to prove it.

可能是您正在使用的第三方JavaScript插件中存在一些错误。我会检查JSLint中的代码并将此问题指向插件的作者。至于问题本身:如果它是项目的一部分,我认为你不能排除它,而是通过MSDN:使用IntelliSense来证明它。

#4


1  

Since you mentioned jQuery, you could also load the troublesome script during runtime.

既然你提到了jQuery,你也可以在运行时加载麻烦的脚本。

$.getScript("XXX.js");