I'm experiencing something recently that is really annoying and I can't figure out why it's doing it. Not sure when it started, because I recently wiped my machine, so maybe its a recent update or maybe it's from a while ago.
Either way, here is what's happening. When I'm declaring an anonymous function inline and start typing the "function() { ... }" part, the VS2010 intellisense comes up and replaces my lowercase function with its own capitalized "Function." I guess this is some static function in JavaScript or JScript or something else, but I dont know. Either way, its when I type the "()" that it assumes thats what I want.
If I'm declaring a standalone function it isn't affected because I don't put the "()" after that, so it just leaves what I type.
Here are some screen shots of what is happening.
It is quite frustrating because I don't notice it each time and then, of course, the function doesn't execute. I also work in VS2008 each day and in 2008, both the "function" and "Function" are listed in the intellisense menu, but it defaults to the lowercase one so it doesn't affect me.
Is there any way I can override the intellisense settings? Find a file and remove the "Function" one from the list because I'll never use it? Make it default back to the lowercase "function" choice?
Any help would be great. Thanks!
-Jorin
I've nearly come to the conclusion that it's more productive to disable Visual Studio's Intellisense in JavaScript files. However, if you do like most aspects of it, the "Statement completion" option is one way to remedy the particular problem of it replacing function
with Function
when you hit space:
Update:
I think VS2010's new paren spacing must have abused me into unconsciously typing things like this (note the space between function and parens):
$(document).ready(function () {
});
When you do that, it doesn't insert the Intellisense completion of Function
.
With VS2010 sp1, they added back an option to format the parens without a space. So, when I type the closing });
, it formats the paren spacing back to:
$(document).ready(function() {
});
... which is what I wanted to begin with.
Convoluted at first, but it becomes muscle memory pretty quickly.
This problem can be caused by Resharper, at least in Visual Studio 2013. The extension is adding the DHtml.js file that includes "Function". (For any other plugin, this would be sufficient cause for me to uninstall it. Good thing it does so many other things right.) See this question: Javascript Intellisense list too long...
Edit: JetBrains is fixing this bug: (http://youtrack.jetbrains.com/issue/RSRP-400812 ). In the meantime...
Resharper's options allow you to disable its intellisense augmentations by language. To solve the problem, you can disable javascript from being affected, like so:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With