I tried to use JSLint.VS2012 extension to check the JavaScript code. it is useful for it found a lot syntax issues in my code. However, is it possible to configure the rules in JSLint to enable/disable certain rules? Currently, I'd like to switch off 2 rules:
1) The code format checking. Because I use Visual Studio 2012 as the editor, it has a default code formatter, the formated code is OK for me. But, seems JSLint requires a different code format style, so I prefer VS2012 auto format feature, and need switch off the JSLint rule. Here is a snapshot shows JSLint complaining the 'bad' formatted code.
2) The second I want to be disabled rule is "Unexpected 'else' after 'return':
I don't this rule is good, but guarded return could improve the readability of if-else switches, below is a snapshot:
This has been silent long enough I'll at least answer for VS 2008 and hope it's similar for the VS 2012 plugin.
Question 1: Go to your tools menu. Select "JSLint Options". Look for "Tolerate sloppy whitespace", and check it. Hopefully the 2012 version has a similar checkbox.
Question 2: The second is a little nastier. I don't believe there's a setting to turn it off, but even the VS plugin just uses the JSLint javascript file under the hood (or at least the 2008 version does via Noesis). So if you want, you can open up jslint.js and edit it.
If you edit this part, the error is ignored:
if (peek(0).id === '}' && peek(1).id === 'else') {
// commented out >>> this.warn('unexpected_else');
}
Voila. The JSLint code really is good, clean stuff that's easy to customize. But I am required to say that you really should take JSLint's advice, and in this case, I'd tend to agree. But inherited code? Comment the line out and keep moving along.
Related
Been getting into Android Studio (and Android development in general) lately, mostly a personal challenge to make a modern version of an app my mum loves but hasn't been updated in ages. But my life story isn't the point, and that's not just because it's not that interesting.
The actual question:
Is there a way to make Android Studio do automatic folding for block comments (i.e. /* to */) in Kotlin files? In Settings > Editor > Code Folding there's options for documentation (in general) and multiline comments for C or Java, but no settings specific to Kotlin, and just one for Android in general (which has nothing to do with comments).
The reasoning: Because I'm still pretty new at this, there's a lot of things I've tried but haven't worked, and comment out instead of deleting because I still might be able to learn something from them later. There's also some big blocks of logging code for debugging that are great when I'm trying to debug but in the way (given I usually write them in the middle of classes or methods) when I'm not, so I comment them out. It's just annoying having to fold several sections of comments whenever I open a file.
The "well duh" solution?: I could set them as documentation comments, which would hopefully get automatically folded, but if I start writing documentation (like I really should get around to) they'll get mixed in and that would be annoying.
What I've tried so far: Going through all the settings with a fine tooth comb (and I'll freely admit I could have gone over something obvious) and searched for plugins for code folding, about the only one I could find is https://plugins.jetbrains.com/plugin/12007-foldingplus which doesn't seem to do anything about this particular problem.
Can anyone help me out here, other than maybe "be less of a newbie in general"?
With Android Studio Arctic Fox I found that if you highlight a region that has the comments in question, you can right-click on it and one of the options will be Folding. From the expanded options select Fold Selection / Remove Region and the selected comments will fold.
Same question here, but I'll try to explain it better.
I want Android Studio to give me typo warnings according to my custom dictionaries. Typo inspections are enabled properly. I have already set up my project dictionary and portuguese.dic in settings, and spell checking works fine in code.
It also works in values/strings.xml (the default locale) but it doesn't work in locale-specific xml resources, like values-pt/strings.xml. It gives me warnings for common misspellings for pt language (which it detects automatically), but I want the typo warnings that assume every word is wrong except for the ones present in my dictionaries.
I have tried changing the tools:locale attribute to many values, but the problem remains: this affects only the "common misspellings", not typo spell-checking, which is disabled for the file no matter what I do.
I even tried disabling the Inspection for "common misspellings" (Android/Lint/Correctness/Messages/Spelling error) but it didn't work either.
Is this a bug in IDEA/Android Studio? It seems to be this way by design, but maybe there is a setting or something I'm missing.
Is there a way to enable this check, or some workaround to make it work?
Ideally this should just work in the editor, but if not possible, it would be fine to have at least a gradle script or something that I can run once to make sure everything is OK.
I am trying to install or update a setting that allows me to minimize and maximize code blocks within VS Code. Similar to below and/or like Visual Studio:
https://www.flickr.com/photos/50988329#N02/25504022561/in/dateposted-public/
Just in case the image link doesn't work, I am speaking about the plus and minus signs/icons that you see next to the line numbers in Visual Studio.
The February Update (0.10.10) for VSCode just added support for code folding.
Try downloading that and giving it a try. You can enable or disable code folding with the editor.folding setting.
I recently installed Visual Studio on a laptop and the syntax highlight fails to change Classes colors.
I tried exporting and importing the full, complete set of settings and it is still looking like that.
EDIT
I tried those websites with schemes and decided to try one, the Humane scheme, and this is how the sample code looks in my laptop after installing those settings:
However, this is how it is supposed to look:
Note the lack of highlight in class names.
What could it be causing this?
I'm starting to think that's another setting at another place which causes this.
Finally, it worked by resetting user data, running this from the Visual Studio Command Prompt
devenv /Resetuserdata
Found the hint here:
https://stackoverflow.com/a/11988265/1213246
Changin syntax highlight could be done through the menu Tools - Options - Environment - Font & Colors. It's a try and test approach that is not much improved from earlier versions of Visual Studio.
Fortunately, today there are entire sites with themes that simply need to be choosen and installed
I suggest you to visit http://studiostyl.es/ where you can find thousands themes or, for more generic go to http://www.hanselman.com/blog/VisualStudioProgrammerThemesGallery.aspx
Has anyone used JustCode from Telerik lately? This question has been asked about two years ago, but I'm sure the issues must have been resolved by now. Especially referring to running it side by side with ReSharper.
I have been using Resharper for a while now. I decided to try JustCode to see how it behave.
After a week of using JustCode, I am uninstalling it and returning to Resharper.
What I like about JustCode:
A single window indicating all warnings/errors in entire solution.
Performance seemed to be a bit better than Resharper.
Refactoring is easier to get to.
Projects can be excluded, or type of file
Language can be excluded (such as XAML)
What I did not like about JustCode:
Sometimes the underline used to open the option for fixing or refactoring is frustratingly hard to click since VS also puts an underline at the same spot (and it is the context menu of the latter that pops up).
Cannot change an hint to be a warning instead.
Saw some minor bugs
JustCode was giving hundreds of false positive warnings in the XAML code (luckily I could turn the inspection of XAML off)
What I was missing from Resharper:
Warnings about method parameter missing/mismatch from the documentation
Hints to transform an expression into a Linq expression.
When writing an opening bracket, resharper automatically adds the closing one and puts you on an empty line in between the two.
When completing a method, Resharper adds the first parentheses. It also adds the last one if that method is parameterless.
I am sure there is a bunch of other stuff that I can't remember now
You can install both Resharper and JustCode alongside. I first suspended Resharper before installing JustCode and used JustCode fine. When I resumed Resharper and restarted VS, both were running together without error.
Together, Resharper was finding more than JustCode.
For example, JustCode did not give a warning for the following: "Value assigned is not used in any execution path."
It even missed an error: "Cannot convert type 'int' to 'bool'." The expression was:
if ((bool)CanDoIt) // Here CanDoIt is a property of type int.
{
...
}
All in all, the tool is not bad. I recommend it over not having any. But if you have the choice between Resharper and JustCode, go with Resharper... for the moment; JustCode is still young.
You can change the size of JustCode's smart tag or turn off Visual Studio's smart tag in JustCode's options menu. I prefer to access VS's smart tag by using ctrl+., so it hasn't been an issue for me.