I am using visual studios 2015 to write react code. I am trying to understand ReactJs.net as well.
When I made my app.js folder and put this code in
import React from 'react';
const App = () => (
<div>
<h2>User List</h2>
<UserList />
<hr />
<h2>User Details</h2>
<UserDetails />
</div>
);
export default App;
everything is underlined and I see this message
"EcmaScrpit6 feature. Your current language level is EcmaScrpit5"
How do I change so I don't get this message anymore?
Old post but here's the answer since this issue does arise now and then: This is a ReSharper error that results from scanning your Javascript code. If you place the cursor over the code with squiggly red lines under it and press alt-Enter to bring up the ReSharper context menu, you will be offered the opportunity to 'Change to ...', whatever the feature you are using requires, e.g. ECMAScript 2015 or whatever. Make sure you do not exceed whatever you have configured in your Typescript config (tsconfig.json) compiler options and double-check browser compatibility before you change to a new higher ECMAScript level in your Javascript code.
If you want to manually manage what ReSharper complains about, Click Extensions/ReSharper/Options in Visual Studio to bring up the ReSharper options dialog. Scroll down to Code Editing->Javascript and click Inspections. You will see a drop-down with the label 'JavaScript language level:' there. Select whatever ECMAScript level you want there and save the settings. Done.
Related
I am using Visual Studio 2015, and I want to add https://appsforoffice.microsoft.com/lib/1/hosted/office.js as an IntelliSense reference. So I did the following:
But the IntelliSense still does not work:
Could anyone help?
Getting the basics of JavaScript IntelliSense working is pretty straightforward – all you need to do is, in your JavaScript file, have a triple slash reference to the CDN location, as follows:
/// <reference path="
https://appsforoffice.microsoft.com/lib/1/hosted/office.js" />
In projects created with the Office Add ins template, the reference is already built in, in the Scripts/_reference.js file. The Scripts/_references.js file is a special file that acts as a "global" JS reference for the project, so that you don't need to include the /// <reference path="..." /> on every file. For more information on the _references.js file, see this excellent blog post by Mads Kristensen, creator of the “Visual Studio Web Essentials” extension: http://madskristensen.net/post/the-story-behind-_referencesjs.
Note that the above location is for the “prod” version of the CDN. For the beta endpoint, use "https://appsforoffice.microsoft.com/lib/beta/hosted/office.js", and for a local installation of Office.js point to the Office.js file (typically under "Scripts/Office/1/office.js).
TIP: Every once in a while, I've come across cases when the IntelliSense file appears stale. For example, while I know for a fact that the Excel Range object contains a “.merge()” method, IntelliSense was refusing to show it to me one day.
In these cases, you can refresh the JavaScript references by via the menu, by going to Edit -> IntelliSense -> Refresh Remote References, or via the VS Quick Launch box.
While typing code in a Razor (.cshtml) file using Visual Studio 2013 (Update 4) with ReSharper 8.2.3 (updated by suggestion from this question), my IntelliSense is doing stuff that is driving me crazy. I am a heavy user of the IntelliSense+Tab key when typing to speed up my coding, but some common keywords keep defaulting to suggestions that aren't as intuitive as you'd think. Examples:
<input type="whatever" value="something" /> prefers aria-valuemax instead of value:
<input type="whatever" style="yada yada" /> prefers data-ng-style instead of style:
I know this is a niggling thing, but it is driving me nuts, and it seems to me that IntelliSense should be preferring value and style here simply because what I'm typing does not start with aria and data in the respective examples. Does anyone know how to turn this behavior off?
This is the AngularJS plugin for ReSharper. The latest version is a bit more sane with respect to item ordering and will choose style over data-hg-style. However, most of this goodness comes from ReSharper itself, and the latest version of the plugin requires ReSharper 9.1.
I have a question about Kendo UI. I have an existing MVC4 project in which I wanted to use some of the Kendo extensions, namely the Editor. Currently the project uses jqWidgets as a UI framework.
I opened VS 2012, loaded the project and used the Telerik menu to add references to Kendo in the project. The wizard added all the necessary references and made changes to the web.config files. So far so good. However, I have two problems:
When I try to use the Kendo Html Helper I do not have intellisense and the Kendo is underlined saying that the HtmlHelper does not have a definition for 'Kendo'. I have <add namespace="Kendo.Mvc.UI" /> in both, my main web.config as well as in the web.config in the Views folder. Strangely enough, when I run the site, I do not get an error, but the editor does not load its initial content and if I try to interract with it, I get the following error: (my second question)
TypeError: invalid 'in' operand e - I am guessing that somewhere in the site, There is a conflict that couses this error, but I cannot find it. Here is how I load all the JS files in my _Layout.cshtml:
#Scripts.Render("~/bundles/jquery")
#Scripts.Render("~/bundles/jqueryui")
#Scripts.Render("~/Scripts/kendo/2013.2.918/kendo.all.min.js")
#Scripts.Render("~/Scripts/kendo/2013.2.918/kendo.aspnetmvc.min.js")
#Scripts.Render("~/Scripts/kendo.modernizr.custom.js")
I am not sure if the problems are related. My jQuery version is 1.9.1 and I am using the latest Kendo version (2013.2.918.340)
Any help would be greatly appreciated.
Here is how I use the editor in the View:
#(Html.Kendo().Editor()
.Name("editor")
.HtmlAttributes(new { style = "width: 700px; height: 400px" })
.Value(#<text>
<p>
Some text
</p>
</text>)
.ImageBrowser(imageBrowser => imageBrowser
.Image("~/Content/UserFiles/Images/{0}")
.Read("Read", "ImageBrowser")
.Create("Create", "ImageBrowser")
.Destroy("Destroy", "ImageBrowser")
.Upload("Upload", "ImageBrowser")
.Thumbnail("Thumbnail", "ImageBrowser"))
)
The solution to the first problem is to add namespace reference only to the web.config file in the Views folder. There is no need to add it to the root web.config. After that restart Visual Studio and reload your project. Everything should be fine and intellisense should work.
As for the second problem, this is hard to guess. Could you show your code where you are loading the contents into HTML editor?
In reference to these related questions, I have had CSS3 validation set up in VS2010 for a while.
However each time I close a CSS file, the "cascading style sheet version for validation" dropdown in the css toolstrip changes back from CSS 3.0 to CSS 2.1. When reopening a css file, I need to reselect CSS 3.0 to avoid the validation errors.
Is there any way to change the default? Even a registry hack would be acceptable at this point, it really is quite annoying.
There is another benefit of changing the default for this, when editing a cshtml file. Without a CSS file open, the validation target dropdown is grayed out. So to change it to 3.0 you have to have a CSS file open. Another annoyance.
I checked Tools > Options > Text Editor > CSS, but there is no validation tab like there is for HTML.
Option 2 is to go into C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\1033\schemas\CSS and rename css30.xml to css21.xml (backup your files first of course).
That way, even though VS will show it is validating for version 2.1 it will really be validating for version 3.0
I am trying to get Jquery intellisense working in Visual Studio 2010.
I've looked around on StackOverflow and tried adding this to my view:
#{
/// <reference path="/Scripts/jquery-1.5.1-vsdoc.js"/>
}
That's not working.. I've got it working by adding the same script tag to each view but this is less than ideal since i want to keep all my scripts in one place at the bottom of my layout page.
Add the <script> tags to each view inside an #if (false) { ... } block.
The IDE will still see them, and provide IntelliSense, but they won't do anything at runtime.