How to make Visual Studio stop "compiling" .js and .css files - css

I use Visual Studio as my editor for .css and .js files.. It REALLY SUCKS especially with .js files since it insists on indenting them in a very weird way, but I find it convenient that the first alt-tab is always the browser instead of another editor, and that ctrl-tab is always either the code file or the css/js.
Anyways, in all its radiant wisdom it decides to check them for syntax errors as well and every time I compile my project it gives several "errors" that push down the real errors of the compilation, so every time I make a syntax error in a code file I have to scroll down through all the js/css errors to see what's wrong.
Examples of such errors (that aren't really errors) are:
Error 7 Validation (CSS 2.1): 'text-rendering' is not a known CSS property name.
Error 8 Validation (CSS 2.1): 'opacity' is not a known CSS property name.
The situation also got much worse recently, since it now keeps parsing a .js file as a .css file for some reason, so I get errors such as:
Error 1 Unexpected character sequence. Expected a selector for the style rule. E:\Dev\anacletus\Static\set_focus.js 2
Error 2 Unexpected character sequence. Expected a property name for the " : " declaration. E:\Dev\anacletus\Static\set_focus.js 3
Error 3 Validation (CSS 2.1): 'set-focus' is not a known CSS property name. E:\Dev\anacletus\Static\set_focus.js 3
I even deleted that particular file from the solution (it's not there anymore anywhere), but it keeps parsing it anyway.
In short, how can I disable this feature?

Enter the options through
Tools > Options
If it isn't checked, check the "Show all settings" box at the bottom of that window.
In the tree to the left, choose:
Text Editor > CSS > CSS Specific
Uncheck "Detect Errors". Then, choose:
Text Editor > JScript > Miscellaneous
Uncheck "Show syntax errors".
You can also change how it indents each type of code too, in the various settings in those "Text Editor" sub-options.

I know, this question is old, but I have an update (for Visual Studio 2010):
The accepted solution has a big disadvantage: It disables all syntax checking of CSS and JScript.
If you still want to have meaningful warnings, you can do the following workaround.
It will treat errors as warnings, and it will do css validation on css V3.0 level rather than on (old) css V2.1:
Close Visual Studio
Download and install the web standards package for Visual Studio 2010 SP 1
Open the path (on 32 bit machines, it is Program Files)
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\1033\schemas\CSS
Backup CSS21.xml for safety reasons
Overwrite CSS21.xml by the file CSS30.xml (in the same directory)
Open Visual Studio. In Text Editor settings, (re-)enable "Show syntax errors". Ensure you have checked "as warnings" too.
From now on syntax checking of CSS is done on 3.0 level (although it appears in Visual Studio now as 2.1), and you're getting warnings instead of errors if the syntax checker finds anything.
(Note that the Style Sheet toolbar only allows to enable CSS 3.0 checking for css files, not for HTML. Hence, this fix is needed if you want to keep syntax checking)

Related

Eclipse WikiText: How to set css for preview?

Using Eclipse 2020-09 (i.e. v. 4.17) IDE for Java (on Linux, openSUSE Tumbleweed), with version 3.0.38 of Mylyn WikiText plugin installed, I had the following difficulty: Although pretty much all editor/ui fonts were fine, the HTML preview of WikiText files (in particular README.md!) displayed in unreadably small fonts (my display has a very small pixel pitch). So I wanted to find a way to set the CSS of such preview pages. The Mylyn WikiText docs (at https://help.eclipse.org/2020-09/index.jsp?topic=%2Forg.eclipse.mylyn.wikitext.help.ui%2Fhelp%2FMylyn+WikiText+User+Guide.html, under the heading "Rendering Appearance") says that there should be a Preferences screen General > Editors > Text Editor > WikiText > Appearance that allows one to set this CSS. However, no such screen shows up in my installation.
The only method I was able to find for fixing this was to use an application (such as Engrampa) which is able to edit the contents of .jar files, and in my eclipse installation directory, use it on plugins/org.eclipse.mylyn.wikitext.ui_3.0.[SPECIFIC_VERSION_HERE].jar to edit the internal component org/eclipse/mylyn/internal/wikitext/ui/viewer/default.css -- I could change any css there, and upon restarting Eclipse, the changes would take effect.
However, clearly any changes I make this way will be blown away upon the next update of Eclipse or of Mylyn Wikitext. Does anyone know of a better way to set the size of the preview text? Was that Appearance pane mentioned in the docs removed? If so, what replaced it? If not, any ideas why I might not be seeing it?

Aptana Studio 3 CSS folding

Css code folding doesn't seem to be there any more Aptana Studio 3, build: 3.0.2.201106082310.
I have checked the preferences under 'Aptana', 'Editors', 'CSS' and 'Enable Folding' has a tick in it.
Folding works fine for JS but seems to have dissappeared under CSS, intellisense still works fine.
I used to get a little '-' or a '+' symbol in the left column alongside the line number.
Anybody else found this problem, its a great tool and would like to be able to use it again.
It's definitely still available, as I can see it in 3.0.2 or 3.0.3.
It might be that your code has a parse error or some similar problem that's causing the ticks not to show, though that would be odd if it happens to all files.
If it is a single file, I would file a bug here. Otherwise, you might check Help > Studio > View Log File to see if there are any error messages, or try updating to the latest beta version, 3.0.3 (docs on the wiki)

How do you enable error detection for CSS files in Visual Studio 2010?

How do you enable error dectection for CSS files in Visual Studio 2010? It's said to be in tools options, but I can't seem to find it.
In Visual Studio, open the Tools menu and select Options
Expand the Text Editor group, then the CSS group.
Click on Miscellaneous and you'll see the option to enable Detect Errors there.
Make sure in Visual Studio 2010 IDE> View>Toolbars>Stylesheet is checked to show Stylesheet toolbar.
IDE will indicate errors in two ways.
01) most importantly don't forget VS Error List window.It will show css errors in warnings section.you can then navigate to error by double clicking the error itself through the window.
02) it will show squiglies in erroneous CSS styles
Not sure if this is what you're asking for, but Visual Studio comes with a few CSS validation templates. If you select from the top menu View > Toolbars > Style Sheet, you'll see a little dropdown in the top toolbar. My VS 2010 lets me choose "Internet Explorer 6.0, CSS 1.0, CSS 2.0 and CSS 2.1"
If you write a property that's not valid for the currently selected CSS version, Visual Studio will put a little green line underneath it and complain about it not being a known CSS property etc.
This happened to me and CTRL+K+D gave me that same error even when detection was on. The solution was to look in the 'Errors' tab in Studio and to look at just the warnings. Scroll down to the CSS file related issues and low and behold your syntax error will be listed there.
Mine turned out to be two semi-colons ';;'
Hope this helps anyone else :)

How to suppress specific CSS 2.0 validation errors in Visual Studio 2008?

A typical CSS property that I use often is overflow-x or overflow-y. Sometimes I use CSS 2.1 or later properties or selectors. These (correctly) raise a validation error:
Validation (CSS 2.0): 'overflow-y' is not a known CSS property name.
For years I ignored this, but it kinda feels wrong. It's possible to switch off warnings in C# and other languages for a particular line, block, file or project. Is something similar possible for CSS (or HTML) errors or warnings? Instead of switching it all off, I prefer a more granular solution.
If you're willing to muck around a bit you can get exactly what you want.
Go to Visual Studio folder \Common7\Packages\1033\schemas\CSS
Copy css21.xml to css21mod.xml
Find the section:
<cssmd:property-def _locID="overflow" ...
After that section, insert:
<cssmd:property-def
_locID="overflow-x" _locAttrData="description,syntax"
type="enum"
description="Visibility of content extending beyond element's dimensions in x"
syntax="One of the overflow values | inherit"
enum="inherit auto hidden scroll visible"/>
<cssmd:property-def
_locID="overflow-y" _locAttrData="description,syntax" type="enum"
description="Visibility of content extending beyond element's dimensions in y"
syntax="One of the overflow values | inherit"
enum="inherit auto hidden scroll visible"/>
Open regedit, go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Packages\{A764E895-518D-11d2-9A89-00C04F79EFC3}\Schemas
If on 64-bit, you will have to go to SOFTWARE\Wow6432Node\Microsoft etc
Create a new key called Schema 5, and fill in the "File" and "Friendly Name" string values with css21mod.xml and CSS 2.1 (mod)
Should be all set!
Hi I just discovered this. In Visual Studio 2010 SP1 there is support for HTML5 validation.
Tools -> Options -> Text Editor -> HTML -> Validation
Now personally because I hate VS telling me I have duplicate ID's(Which is fine for non server controls) I turn off all warnings and set my validation to XHTML5 (Which is an option).
You can however tweak the settings till your hearts content. Sadly this is not project specific and other team members will need to do the same.
How to make Visual Studio stop "compiling" .js and .css files
Similarly as Jeremy Child suggested, but specific for Visual studio 2008 (as specified in the opriginal question):
Tools -> Options -> Text Editor -> CSS -> CSS Specific : uncheck
"Detect unknown properties"
This removes all CSS validation. This is a good solution if you need the problem to disappear fast (I have no time/bit lazy to manually add each property in an xml file and check the windows registry...) and if you are good in CSS (validation not really needed when you use built-in intellisense or styles that you are sure work -e.g. taken from previous websites you did-).
Get support for CSS 3.0 in order to suppress some of the warnings:
how to make visualstudio 2008 support css v3 & html v5
CSS 3 Intellisense Schema
So this is what happened to me. I had a successfully working project. I made a copy and started working on some label changes. And I started getting
"Validation (CSS 2.0): 'overflow-y' is not a known CSS property name."
The above error kept appearing even after reopening the projects.
So I went back to my original project, opened, started debugging to see if I get that error in that project also. The project successfully. Stopped there. Came to my new error throwing project, and now the error is no longer there.
Something to think about what caused it go away. Something in a memory. May be

Error: Object Expected Code 0 Char 1 Line 474

done some html code updates on my company's asp.net website and the above error appears.
i dont have a line 474 on the errored file.
this error only on IE, and not FF.
anybody?
Check inside the source control and try eliminating the changes 1 by 1 until the problem is under control. Then you should have the change that caused it.
It's a javascript error. You're trying to dereference a null pointer in javascript.
These go quietly unless Script Debugging is turned on in IE. If that's the case, you can debug the error by choosing to debug with Visual Studio. Visual Studio Express Web Developer may do as well.
You may be able to see the bug in Firefox as well. Go to "Tools" > "Error Console" in Firefox. Select "Errors", then "Clear" toolbar buttons. Refresh the page then you may see the actual javascript line that's causing the error.
I'll bet you DO have a line 474. Maybe not in your aspx page in Visual Studio, but probably in your browser window. Run the page and view source inside your browser. Then go to line 474 (maybe by pressing CTRL-G). That should point you to the spot.
Another possibility is that the JS error is talking about line 474 in a linked .js file.
Have you tried debugging the page in Visual Studio have you been editing in Notepad? If you debug in VS, you'll see the JS error right away.
As mentioned this codingforums thread, in JScript (IE's equivalent to JavaScript) you should avoid using variable names that are equal to your HTML field names or reserved words for JavaScript/JScript (and possibly HTML?).
So avoid the likes of:
var myname = document.myform.myname.value;
var text = document.myform.myname.value;

Resources