I am new to Visual Studio 2012 and Javscript coding. I have two questions i could not find answers on the web:
i have a webforms project and added some js-files to the sript-folder (http://raphaeljs.com/). Now i want to have Intellisense support for that js-library i added. Is that possible?
for what is the "_references.js" file in the scripts folder? I added all the js-library files to that file but it doesn't enable intellisense.
regards
I'm not sure about Visual Studio 2012, but in 2010, if you drag one JavaScript file onto another one it will add a /// <reference name="MyScript.js" /> line at the top of the second file. If the file being referenced is documented you will get quite useful intellisense, though it is still handy even if not for just being able to explore the surface of the API.
There is some good information in this question: IntelliSense for Ajax and JavaScript libraries in Visual Studio
To put it short, Visual Studio is terrible at intelli-sense for javascript. It is still light years behind other IDEs like IntelliJ & WebStorm.
A work around to slap it in line would be to use ReSharper which is a plugin but you need to pay for the license :(
Hope that helps.
Related
In Microsoft Visual Studio Professional 2017, when I edit a JavaScript or CSS file, the Intellisense Quick Info for Members, Objects and other keywords don't appear. However, when I open the same files in Visual Studio Code 1.66.0, Intellisense Quick Info is shown properly. This results in me failing to interpret the significance of JS and CSS functions and keywords, hence, causing a ream of inconvenience to me. Why is this happening and how can I make Quick Info appear properly for JS and CSS files in Visual Studio 2017? Any help on this matter is greatly complimented.
Regards
Please take a look at the screenshots below:
VS Code showing Quick Info for response.cookie() method in JS file
Visual Studio 2017 not showing Quick Info for the same JS file
VS Code showing Quick Info for background-attachment property in CSS file
Visual Studio 2017 not showing Quick Info for the same CSS file
I'm working on a legacy code base with Visual Studio 2015. There is a lot of Javascript code, and again for legacy reasons I can't just add Typescript.
Any new Javascript that is written is done in VS Code and in order to improve the quality of the Javascript I've been using the TS language services native to VS Code. This involves the use of // #ts-check and globals.d.ts so that I can remove warnings about jQuery's $ not being found, among other things.
This works fine but now every time Visual Studio 2015 finds the new globals.d.ts file it's triggering a bunch of Typescript features and adding Typescript related properties to the actual .csproj
This is not a desirable feature in this case; the code is legacy and using a legacy build system, adding new language features in the csproj is a big no-no unfortunately.
Is there a way I can have the file existing while also not causing Visual Studio 2015 to try use it? The file exists solely for VS Code's sake.
You might be able to play around with a tsconfig.json file to stop the TypeScript tab being active in Visual Studio, although it will still be looking at the TypeScript in this case.
If you want to get serious with disabling the compiler in your project, there is a documented feature to block the TypeScript compiler.
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
This would require a small change to the project file, as this needs to be placed in there, inside a <PropertyGroup>.
My main experience with developing in Visual Studio is as c#/c++ developer. But now I need to create html+css+javascript front end for [probably] PHP code, and I've heard that Visual Studio has pretty nice capabilities in that range, including debugging javascript.
However, I can't find anywhere a "web" project (except for the ASP.Net stuff, which I'm not sure that it is the right thing).
Here's what I think I need to do:
Create html file
Create css file
Include a bunch of javascript libraries
Write my own javascript code
Press F5 and debug the code in different browsers.
I'm mainly interested in intellisense, not a visual editor.
Is Visual Studio the right IDE for this kind of web development? And if it is, how do I set up the kind of project I described above?
I think the instructions at How do you add a folder to a project in Microsoft Visual Studio Express 2012 for Web? might work for setting up a Visual Studio project:
1) New blank solution
2) Right click on the solution and select Add existing website
3) Browse and select the folder with your html, css, javascript, etc. files
4) Right click on the page you want it to start on and select set as start page
As for running against different websites, you might try a Visual Studio extension. A decent starting list is here: http://www.asp.net/mobile/device-simulators
I'm using IntelliJ IDEA 12 Community Edition, and am trying to set the syntax coloring for Javascript files. When I choose File > Settings > IDE Settings > Editor > Colors & Fonts, Javascript is not an option in the list. Is this a limitation of the Community Edition IDE, or am I missing something? The others I need are listed, like Java and HTML, but Javascript is missing from the list.
Thanks.
JavaScript support is supported in Ultimate Edition, but not in Community Edition.
For the basic syntax highlighting you can try the TextMate Bundles Support plug-in. See this document for the setup instructions (it's for PhpStorm, but instructions for IntelliJ IDEA would be the same).
The TextMate Bundles Support plug-in is not enough. You also need specific language bundles.
install and enabled the TextMate bundle support plugin in IntelliJ
Download the specific language bundles and unzip them somewhere where you find them, e.g., TypeScript, Shell Script TextMate Bundle
Open the Settings/Preferences dialog, got to Editor and select TextMate Bundles
Click on the + on the right side and choose the desired bundle from 2. on your hard disk. Then it should appear in the list of recognized bundles.
Extension conflicts might appear: Click on "Show details". If you want to use the new syntax highlighting click on "unregister native file type".
A detailed explanation with screenshots can be found here
I found this question after searching by "how to enable JS syntax highlight into JSP files" in my Intellij Community Edition.
Following the suggestion to use TextMate Bundles, I checked that it's already installed by default, including JSP support (built-in). But it did not work.
So, I fixed it by just removing the "*.jsp" pattern from "File Types > JSP", and after that now my IDE is using TextMate syntax highlight properly.
Use Visual Studio Code for Javascript support when using IntelliJ Community Edition. It's free and has all the support you would get for the paid version of IntelliJ Ultimate.
Or buy it for $149 (personal ultimate edition). I've been buying it since 2013 and find it far superior to XCode. This is just my personal opinion though. Download a trial and see how you like it!
Pricing:
https://www.jetbrains.com/idea/buy/#personal?billing=yearly
Trial:
https://www.jetbrains.com/idea/download/
ps: I'm not endorsed or affiliated with Jetbrains. Just a fan.
Alternative I tried (but raised another issue):
Marked VS Code as default app to open .js files.
For IntelliJ, follow this: to configure .js files should be opened using VS Code
This has enabled to opening .js files into VS code when we command from IntelliJ Idea, but strangely, .js got disappeared from "Find in files" search list.
Inputs are welcomed, whether I had configured it wrong.
I'm sure this works in VS2010 but is there any way to get snippets to work in .JS files in Visual Studio 2008?
There's a comment from way back in 2007 in ScottGu's post about JS Intellisense that it might have happened, but I would like to know if it has been officially taken off the table.
I don't believe there is. If you look at more of Scott's blogs you will find this one.
http://weblogs.asp.net/scottgu/archive/2009/09/04/asp-net-html-javascript-snippet-support-vs-2010-and-net-4-0-series.aspx
He makes a comment of "Visual Studio has supported the concept of “snippets” for VB and C# in previous releases – but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well."