Sublime Text : how to detect coding errors (non existing variables...) - sublimetext3

I'm using Sublime Text and I'm fairly new to it.
I'd like to have my coding errors highlighted : missing semi colon, non existing variables...
But even installing the linters, Sublime Linter package and jslint and jshint, it doesn't work the way I want.
JSLint is way too strict: it was giving me errors for using tabs instead of spaces.
What I want is :
errors about missing semi colons
errors if I use a variable that I haven't defined anywhere
How can I do this ? I've checked before here on this forum, and on Google, but I haven't found anything :(
Nicolas.

I think ESLint will fit your needs. It's newer than jshint and jslint.
You can read a comparison here: https://www.sitepoint.com/comparison-javascript-linting-tools/.
It's really flexible in specifying the linting rules.
The primary reason ESLint was created was to allow developers to
create their own linting rules. ESLint is designed to have all rules
completely pluggable.
The rules that will help you with missing semicolons and undefined variables are semi and no-undef.
You can use it in Sublime with the SublimeLinter-eslint or SublimeLinter-contrib-eslint_d plugin. The second one is faster, and it allows me to enable linting to be executed as I type.

Related

VSCode Vim multiple cursors

I have looked everywhere and I am still unable to switch off this 'feature'!
I've been using vi and, later, vim, since the 80's and I have never had need of multiple cursors, nor can I see a use for them.
:<range>s/search/replace/ does everything I need so this new feature is infuriating beyond words, especially as I've no idea how to switch it off when it seemingly-randomly appears.
Would someone be wonderful enough as to tell me how to banish, remove, consign-to-history the multiple cursors feature in VSCode Vim 1.12.4, please?
I believe this issue is specific to the plugin. I experienced it with the HTML plugin recently, and I'm assuming you have the same problem with HTML files, but the same principle should apply to other plugins as well. You just have to find the setting.
In the VS Code settings, there is an option that reads:
HTML: Mirror Cursor On Matching Tag
You can uncheck the box there to disable the feature. Or you can go to the settings.json in your local repo (inside the .vscode directory), or the equivalent global file, and add/modify the following field like so:
"html.mirrorCursorOnMatchingTag": false
That should take care of it for you.

Can Sublime text build/compile real time (like xcode) as I type codes so it can show my code errors?

Is there way to have sublime text to build/compile real time as I type code so it can show my code errors if there's any? xcode has this feature.
for example, if i'm writing in a ruby file and in the first line i type:
print(hello)
and as i enter to the second line, sublime will tell me there's an undeclared variable "hello" in the first line?
This feature is not specific to the build/compilation process. What you're really looking for is linting.
You can use SublimeLinter coupled with SublimeLinter-ruby for ruby linting. There are also many more packages available for linting other languages at packagecontrol.io.

How to see Rails logs with colors with Vim

I have a Rails application with logs that I used to check with vim. I saw a lot of ugly codes like ^[[1m^[[35m, that I found out it´s ansi color codes.
I didn´t want to remove then but use them, so I installed the Charles Campbell AnsiEsc.vim plugin for that.
Although I don´t see any colors, it´s fine because I don´t see all the ugly codes anymore, except that I still see some of them like : ^[[1m^[[35m
Update: Following #Christian suggestions, I have also installed Colorizer plugin. Probably, I´m doing something wrong but I still have the same issue. This is and example of file with vim, and the output I got when running colorizer:
D, [2015-12-29T11:59:43.258643 #7341] DEBUG -- : ^[[1m^[[36m (0.1ms)^[[0m ^[[1mCOMMIT^[[0m
:ColorHighlight
Cannot fork
Colorizer: Some error occured here: ColorTerm
Press ENTER or type command to continue
You can use the AnsiEsc plugin or my Colorizer plugin for coloring the Ansi Escape sequences. Both plugins should also hide the non-visible parts of the Escape Sequences.

Sublime 3 autocomplete recommends vague internal functions in Julia

So I'm using Sublime Text 3 w/ Julia, and I have mixed feelings about the autocomplete. A lot of the time it recommends these vague internal functions that aren't even close to the word I'm typing in. For example:
http://puu.sh/iWyrB/7293a9928f.png
Even if I've used dict_t as a variable before, I have to type in most of the word before it recommends dict_t; it seems to happen once it runs out of internal functions to recommend.
So it seems like this is coming from the IJulia package. I like using that package, but moments like the picture above are frustrating. Any advice?
Edit:
To disable "insert completion on tab" add this to you User Preferences:
// By default, auto complete will commit the current completion on enter.
// This setting can be used to make it complete on tab instead.
// Completing on tab is generally a superior option, as it removes
// ambiguity between committing the completion and inserting a newline.
"auto_complete_commit_on_tab": false,
To disable the auto-complete popup (but still be able to insert completion on tab):
// Enable auto complete to be triggered automatically when typing.
"auto_complete": true,
I'm afraid you cannot remove only the completions coming from Sublime-IJulia and keeping all default completions without changing any code in the Sublime-IJulia package.
If what you need is genera Julia support for sublime (syntax highlighting, auto-indent etc), I recommend switching from Sublime-IJulia to Julia-sublime. Sublime-IJulia had it's last commit in January 2015 while Julia-sublime is actively maintained. Most notably in this case, Julia-sublime does not give autocomplete for all standard functions.
Note that Julia-sublime, like other syntax packages in sublime, does not not strive to be an IDE substitute. These features should be separated, not all users wants both.
For running Julia code from within Sublime with IDE-like functionality there is currently no good alternative, the packages I've found are outdated and have quite a few issues.
When it comes to developing and testing code, I like keep a REPL open in the terminal and just re-include() my code in there. I find this to be flexible and efficient. More on this in the Julia FAQ: http://docs.julialang.org/en/release-0.4/manual/faq/#how-can-i-modify-the-declaration-of-a-type-immutable-in-my-session).
Disclosure: I am the maintainer of Julia-sublime. If you encounter issues or feel that something can be improved, I encourage you open an issue.

Have you used JustCode?

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.

Resources