Sublime Forum

SublimeLinter

#8

Very odd. I put:

"sublimelinter_executable_map": { "php": "C:/xampp/php/php" }

into every occurrence of Base File.sublime-settings I could find (default, user, and the one in sublimelinter). Figured this would help me determine which Base File it was expecting to find it in. I put a “print map” statement in the module_utils.py to see what was happening and to make sure it wasn’t just me putting in an invalid path, and, unfortunately, it consistently shows “None”.

My original thought was it was something screwy about using “Base File” in the sublimelinter folder, since changing the name of the file from “Base File.sublime-settings” to “SublimeLinter.sublime-settings”, and then adjusting the module_utils.py file to reflect the same resolved the issue. But with you being able to get work makes things just that much more confusing. Thanks for checking.

0 Likes

#9

Try a lowercase “C” for the drive letter, that may make a difference.

0 Likes

#10

I love this… but I wish I could turn off the outlining. It’s a bit too distracting as I’m typing.
Would also be nice to have an option where it ran a lint on every Save operation.

0 Likes

#11

There are two options:

  1. Turn off background linting (see the README).
  2. Wait for a new version where I will implement a minimum delay, which will allow you to tell the linter to run only after a certain number of idle seconds has passed.

Good idea, I will add this as an option.

0 Likes

#12

I added a new “load-save” mode, see the README.

0 Likes

#13

Perfect, thank you!

0 Likes

#14

“load-save” mode is great!!! Thank you very much =)

0 Likes

#15

[quote=“dlprice”]Very odd. I put:

    "sublimelinter_executable_map":
    {
        "php": "C:/xampp/php/php"
    }

into every occurrence of Base File.sublime-settings I could find (default, user, and the one in sublimelinter). Figured this would help me determine which Base File it was expecting to find it in. I put a “print map” statement in the module_utils.py to see what was happening and to make sure it wasn’t just me putting in an invalid path, and, unfortunately, it consistently shows “None”.

My original thought was it was something screwy about using “Base File” in the sublimelinter folder, since changing the name of the file from “Base File.sublime-settings” to “SublimeLinter.sublime-settings”, and then adjusting the module_utils.py file to reflect the same resolved the issue. But with you being able to get work makes things just that much more confusing. Thanks for checking.[/quote]

I’ve tested this on windows and it does require some workaround. I finally got it working by editing both “Packages\SublimeLinter\Base File.sublime-settings” and “Packages\User\Base File.sublime-settings”…

With Packages\SublimeLinter\Base File.sublime-settings you must edit the portion where it says “sublimelinter_executable_map” by adding the necessary path. In my case where I have my php executable using XAMPP installation on D:/DEVIGN/xampp/php/php.exe I used:

    "sublimelinter_executable_map":
    {
        "php": "d:/devign/xampp/php/php"
    },

With Packages\User\Base File.sublime-settings you must insert the whole script (as seen above). On my case where I inserted it after my colors scheme setting it looks like this:

{
    "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",

    "sublimelinter_executable_map":
    {
        "php": "d:/devign/xampp/php/php"
    }
}

note: to avoid errors add a comma after the previous setting line before adding the script, and then make sure there is no comma between the last inserted setting script and the closing curly brace.

0 Likes

#16

I’ve tested this on windows and it does require some workaround. I finally got it working by editing both “Packages\SublimeLinter\Base File.sublime-settings” and “Packages\User\Base File.sublime-settings”…

I can guarantee if you provide the correct path and don’t have any missing/extra commas in Packages\User\Base File.sublime-settings it will work correctly without modifying the default.

0 Likes

#17

Hello

I cant get my SublimeLinter plugin to work :confused: This is what i get in my console when i save javascript file. I’ve installed node.js. I’m using Windows 7

Writing file /C/Users/Sosnowsd/AppData/Roaming/Sublime Text 2/Packages/SublimeLinter/Base File.sublime-settings with encoding UTF-8 reloading /C/Users/Sosnowsd/AppData/Roaming/Sublime Text 2/Packages/SublimeLinter/Base File.sublime-settings Unable to open /C/Users/Sosnowsd/AppData/Roaming/Sublime Text 2/Packages/User/JSON.sublime-settings Writing file /C/Users/Sosnowsd/AppData/Roaming/Sublime Text 2/Packages/SublimeLinter/Base File.sublime-settings with encoding UTF-8 reloading /C/Users/Sosnowsd/AppData/Roaming/Sublime Text 2/Packages/SublimeLinter/Base File.sublime-settings Traceback (most recent call last): File ".\SublimeLinter.py", line 259, in _callback File ".\SublimeLinter.py", line 242, in _update_view File ".\SublimeLinter.py", line 72, in background_run File ".\SublimeLinter.py", line 87, in run_once File ".\sublimelinter\modules\base_linter.py", line 270, in run File ".\sublimelinter\modules\javascript.py", line 53, in parse_errors File ".\json\__init__.py", line 307, in loads File ".\json\decoder.py", line 319, in decode File ".\json\decoder.py", line 338, in raw_decode ValueError: No JSON object could be decoded Writing file /C/Users/Sosnowsd/Work/patient-registry/lib/admin/client/tpl/doctor.tpl.js with encoding UTF-8 Traceback (most recent call last): File ".\sublime_plugin.py", line 139, in on_post_save File ".\SublimeLinter.py", line 520, in on_post_save File ".\SublimeLinter.py", line 72, in background_run File ".\SublimeLinter.py", line 87, in run_once File ".\sublimelinter\modules\base_linter.py", line 270, in run File ".\sublimelinter\modules\javascript.py", line 53, in parse_errors File ".\json\__init__.py", line 307, in loads File ".\json\decoder.py", line 319, in decode File ".\json\decoder.py", line 338, in raw_decode ValueError: No JSON object could be decoded

What is more strange, is that on the other machine, it’s working :confused: I have no other plugins installed.

0 Likes

#18

You installed the latest node via the Windows installer?

0 Likes

#19

Yes, of course. And it is added to PATH. Editor configuration is default, not changed

0 Likes

#20

I love the idea of a built in linter in Sublime but have run into a bit of a problem.
I’ve been sniffing around in the source code and googled for a half day but can’t find anything anywhere, which makes me think that it might be impossible today. Could also be my google-fu that is weak so close to the holiday. :smiley:
Is there a way to configure a project so SublimeLinter understands that some javascript variables are global and should not be errors in such a way that is implied on JSHint.com,

var result = JSHINT(source, options, globals);
/*global DISQUS:true, jQuery:false */

Is there a setting which takes care of this? Example below.
example.sublime-project

{ "settings": { "SublimeLinter": { "jshint_options": { // enforcing "eqeqeq": true, "immed": true, "trailing": true, "strict": true, // relaxing "evil": true, "es5": true, "regexdash": true, "sub": true, // environment "browser": true, "devel": true, "wsh": false }, // global "jshint_global": { "sp": true, "exports": true } } } }

Cheers,
gabbon

0 Likes

#21

Currently there is no facility to specify globals via the settings. If wouldn’t be hard to implement, add a ticket to the issue tracker on github. You can put the declaration directly in your source code at the top:

/*global DISQUS:true, jQuery:false */
0 Likes

#22

How to force run linter in ruby without warnings check? Like “ruby -c”.

0 Likes

#23

Look for “lint_args” in the README.

0 Likes

#24

One of the options, “predef”, can be an array of names, which will be used to declare global variables, or an object whose keys are used as global names, with a boolean value that determines if they are assignable.

0 Likes

#25

The trick is that you need to provide the path of your php install to both the sublimelinter_executable_map and the sublimelinter_syntax_map (notice one is executable and the other is syntax). So in my case I’ve got it installed in my xammp directory on a windoz 7 64 box. So leave the default settings folder alone and add the following to your preferences > file settings > user

"sublimelinter_executable_map": { "php": "c:/xampp/php/php" }, "sublimelinter_syntax_map": { "php": "c:/xampp/php/php" }
Put a comma in before the last entry and make sure the whole thing is in curly braces. You need both of these rules for it to work.

[quote=“aparajita”]>I’ve tested this on windows and it does require some workaround. I finally got it working by editing both “Packages\SublimeLinter\Base File.sublime-settings” and “Packages\User\Base File.sublime-settings”…

I can guarantee if you provide the correct path and don’t have any missing/extra commas in Packages\User\Base File.sublime-settings it will work correctly without modifying the default.[/quote]

0 Likes

#26

sublimelinter_syntax_map has nothing to do with the executable. It is mapping to a .tmLanguage file, which is not in the php binary distribution, but in the ST2 Packages directory. So I can’t see how that has anything to do with it working or now working, especially since you are providing a path to your php install.

0 Likes

#27

ctrl+alt+e and ctrl+alt+shift+e seem to be broken, I’ve tried adding the bindings to my user settings and still it doesn’t work.

0 Likes