Visual Studio 2012 not recognising Javascript in .js file - visual-studio-2012

I have a number of my own .js files containing javascript code in a MVC4 project in Visual Studio 2012. The intellisense does not work in these .js files and the error checking is showing spurious errors such as 'Too many characters in character literal' and 'a namespace cannot directly contain members such as field'.
I think what is happening is that it is not identifying the code as javascript (including the jquery files auto added by the mvc4 template). Possibly the file type .js is not associated to Javascript. I've tried Tools -> Optioins -> Text Editor -> File Extension & added js as Script Editor but that didn't work.
If I put a script block in a cshtml page it identifies my Javascript code perfectly but I need to separate my js into separate files.
Any help would be much appreciated :-)

It sounds like you set the Build Action to Compile, which treats it as C#.
Set it to Content instead.

Related

Is this possible in Visual studio 2010 c++ to run different .cpp files using different buttons of Windows Form Application?

I am using visual studio 2010 Professional and made some .cpp files using Win32 Console c++.
All the files are under same project like for training and testing,etc.
Now is it possible that I make different buttons on windows form application to run these different .cpp files just by clicking buttons like for training,testing,etc.
I tried to do this but the error is coming because CLR is not compatible with /MT,/MTd,**etc although I have tried to change the Properties.Also I am using VC++ in all **.cpp files and form application produce C# code on Double clicking it.This could also be the reason of error.
Whenever I run a .cpp file I exclude all other .cpp files to build that otherwise the Build is failed.I am new to this so kindly guide me. Moreover, all .cpp files have their own main() function.
Do not keep multiple main functions. One program should have only one entry point.
What do you mean by "running the .cpp files"? When a project is compiled, all the source files are by default compiled. You can "call" functions that are defined in different .cpp files.
As for buttons for testing, you can assign different buttons to call different functions.
I hope that solves your problem.

Komodo Edit - how to add code completion to a my files

I am new to Komodo Edit. How can I add IntelliSense to my own files?
For example: myFirst.js that includes auto completion for objects or functions that were defined in mySecond.js?
Also, how can I add auto completion to my CSS file from my HTML file?
Another example: in Visual Studio I put this statement at the beginning of file2.js:
/// <reference path="../js/file1.js" />
And then I had IntelliSense for file1.js inside file2.js.
Open menu Edit → Preferences → Languages → JavaScript and specify directory with your source files.
Komodo will scan them for information about your functions.
As long as both files are under the same project, Komodo should automatically pick up on them and provide code intelligence. But make sure you are using a project and not just editing your files plainly as Komodo will not know how to associate your files.
Note though that if you are abstracting your JavaScript code too much that code intelligence will not be able to keep track of what you are trying to do. But you'd have to include some samples of your code for us to be able to comment further on that.
Also note this open bug, which may be related to your issue: http://bugs.activestate.com/show_bug.cgi?id=101646

Unwanted chars appended while rendering partial view in nodejs and expressjs

I'm trying to use nested view with DustJS (linkedin fork) with ExpressJS. While rendering the response system generates some escape chars in response. Which disturb the style and theme.
The same code renders fine as one view file, but when split code into two view files (one load as partial) than the problem arise.
Interesting thing is, it happens with two view engines I tried, the same issue, ECT and DustJS. Development on minimal components, Twitter Bootstrap 3.0 and express are additional component added so far.
My machine is running windows as operating system and development tool is visual studio. What could be reasons, has anyone find same trouble with these view engines?
View in Google Chrome Developer Tool.
Response-Text View
I tried to fiddle and tried to map the extra chars.
You have an UTF-8 BOM in one of the files you are using, usually in the first 3 bytes. Normally, a text editor will not show you these characters. Examine your used files with a hex editor (or write a script that examines those files for you) & store the offending file without that UTF-8 BOM, and configure all your editors to omit the BOM in future.
In addition to Wrikken's answer, if you are using Visual studio than it cab be fixed by advance save option.

How to get XML comments to appear in Visual Studio Class Wizard decriptions

I have put XML comments in a C++ source file that IntelliSense appears to pick up and use. It creates a project xml file, and IntelliSense works when I edit the original source file (showing me comments when I'm selecting a member function or entering parameters).
But, when I go to the Class Wizard in Visual Studio 2012 Express, the entered descriptions don't appear anywhere (on the methods, for example, down at the bottom of the dialog, where description remains sadly empty). For that matter, IntelliSense only works in the original file(s), so when using a call in a separate file, none of my XML comments get picked up. Why does it only work in the original source file? What have I neglected to do?
I don't think you've neglected to do anything, unfortunately.
The Class Wizard was built long before Visual Studio supported XML doc comments, so it's more likely that no one remembered/cared to go back add support for them to the Class Wizard dialog.
In my experience, although it sounds like you've had slightly better luck, XML doc comments are not particularly well supported when using C++. For example, VS 2012 was the first version to support them in IntelliSense (and even that is incomplete). You get nothing in VS 2010 and earlier versions, despite the fact that they'll happily output a project XML file. That pathetic lack of support, combined with the angle bracket tax, drove me to switch to Doxygen when writing C++ code.

Specify include paths individually per source file for Visual Studio C++

Is it possible to specify include paths individually for each soucre *.cpp file?
Eclipse uses this method for code assistance, see Discovery Options properties
In Visual Studio 2010, all I can see is that one can only define the include paths project-wide.
It would be nice if this individual information could then be used for the IntelliSense compiler to parse only the current active source file.
As far as I know IntelliSense parses all files at once, which I think is not appropriate for verly large projects.

Resources