ST3にUpdateするのにあわせて、SublimeLinter
の設定を一通り見直しました。
最近はJavascriptばかり書いているので、JS向けの設定のみ設定を行っています。
sublimelinter_syntax_map
任意のsyntaxを特定のsyntaxに合わせる事が出来ます。
例えば独自に拡張されたjQuery(Javascript)
というsyntaxがあった場合にそれをJavascriptと同等のLinterが必要だと認識させるためにはこの設定が必要になります。
ただこのマッピングKeyが分からなくて結局SublimeLinterのソースを見てどう判定しているかを確認しました。
結果的には、以下のコマンドをShow Console
でコンソールを表示してから叩けば現在のsyntaxを表現するキー情報が分かります。
os.path.splitext(os.path.basename(view.settings().get("syntax")))[0]
sublimelinter_mark_style
SublimeLinter
で問題があった場合にどのようにエディターに表示するかを定義します。
デフォルトはoutline
でエラーを枠線で囲むように表示されるのですが、自分の場合はもっと自己主張して欲しいのでエラー自体の色が変わるようにfill
を設定しました。
sublimelinter_popup_errors_on_save
Linterが実行されたタイミングで、警告が存在した場合にSublimeLinter:Show Error List
と同様にエラー情報をPOPUP表示します。自分は出来るだけJSHintのエラーはつぶしておきたいのであえてうざくなるように有効にしています。
sublimelinter_notes
annotations
で設定した文字列をハイライトします。
annotations
デフォルト要素以外にも、JavaDocで自分が多用するCHECK
とXXX
を追加しています。
結果
以下のような感じになりました。
{
/*
Maps syntax names to linters. This allows variations on a syntax
(for example "Python (Django)") to be linted. The key is
the name of the syntax **as it appears in the syntax list
at the bottom right of the window**, and the value
is the linter name **as listed in the README** (all lowercase)
that the syntax maps to.
*/
"sublimelinter_syntax_map":
{
"jQueryJavaScript": "JavaScript"
},
/*
Selects the way the lines with errors or warnings are marked; "outline"
(default) draws outline boxes around the lines, "fill" fills the lines
with the outline color, and "none" disables all outline styles
(useful if "sublimelinter_gutter_marks" is set).
*/
"sublimelinter_mark_style": "fill",
// // If true, the find next/previous error commands will wrap.
// "sublimelinter_wrap_find": true,
// If true, when the file is saved any errors will appear in a popup list
"sublimelinter_popup_errors_on_save": true,
// JavaScript linter: "gjslint" to use the closure javascript linter (if available),
// or either "jshint" or "jslint" to use a built in linter.
"javascript_linter": "jshint",
// Set to true to highlight annotations
"sublimelinter_notes": true,
// The set of annotation phrases to highlight
"annotations": ["TODO", "README", "FIXME", "CHECK", "XXX"]
}
以上です。