前段时间把自己的Sublime2更新到了3,发现原先的SublimeLinter配置文件不起作用了。目前国内给出相应答案的网站比较少,现在给出对于Sublime3的解决方案。
在Sublime3中,SublimeLinter的检测插件被独立了出来,也就是说我们除了SublimeLinter本体以外,我们还需要安装Sublimelinter-php, Sublimelinter-jshint, Sublimelinter-csslint这三个插件。
然后需要用nodejs安装jshint和csslint,使用如下命令。(没有安装nodejs请先安装nodejs)
1 2 |
npm install -g jshint npm install -g csslint |
安装完成后如下图所示
可以使用如下命令检查这两个插件是否安装完成
1 2 |
npm install -g jshint csslint --version |
除了nodejs以外,我们还需要php程序包,没有的可以到http://php.net/downloads.php这里下载,这里我放到了D盘根目录
接下来打开SublimeLinter的设置,如下图
我们配置文件修改如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
{ "user": { "debug": false, "delay": 0.25, "error_color": "D02000", "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme", "gutter_theme_excludes": [], "lint_mode": "background", "linters": { "csslint": { "@disable": false, "args": [], "errors": "", "excludes": [], "ignore": "", "warnings": "" }, "jshint": { "@disable": false, "args": [], "excludes": [] }, "php": { "@disable": false, "args": [], "excludes": [] } }, "mark_style": "outline", "no_column_highlights_line": false, "passive_warnings": false, "paths": { "linux": [], "osx": [], "windows": [ "D:\\php" ] }, "python_paths": { "linux": [], "osx": [], "windows": [] }, "rc_search_limit": 3, "shell_timeout": 10, "show_errors_on_save": true, "show_marks_in_minimap": true, "syntax_map": { "html (django)": "html", "html (rails)": "html", "html 5": "html", "javascript (babel)": "javascript", "php": "html", "python django": "python" }, "warning_color": "DDB700", "wrap_find": true } } |
其中paths项,需要把PHP的路径放进去,show_errors_on_save可以控制是否在保存的时候提示错误,这里我选择了打开
然后重启sublime,就可以执行代码检查了