4

Sublime text2 で coffeescript ファイルを編集すると、js にコンパイルするときにエラーが発生することがあります。

error: unexpected INDENT
                        $.post url,

崇高な text2 エディターでは、有効なインデントが表示されます。

コード印刷画面

しかし、このコードをプレーン エディターにコピー ペーストすると、間違ったインデントが表示されます。

click: ->
                            debugger;
                        # delete org here
                        $.post url,

debugger;文字列の余分なインデントが間違っています。

では、崇高なテキスト 2 の coffeescript ファイルを喜んで編集するにはどうすればよいでしょうか。sublimeでcoffeescriptパッケージをインストールしました。

私のPreferences.sublime-settingsファイルは次のとおりです。

{
    "auto_indent": true,
    "auto_match_enabled": true,
    "detect_indentation": true,
    "draw_centered": false,
    "font_size": 11.0,
    "ignored_packages":
    [
        "Better CoffeeScript",
        "Vintage"
    ],
    "indent_guide_options":
    [
        "draw_active"
    ],
    "indent_subsequent_lines": true,
    "indent_to_bracket": true,
    "smart_indent": true,
    "tab_size": 2,
    "translate_tabs_to_spaces": true,
    "trim_automatic_white_space": true,
    "use_tab_stops": true,
    "word_wrap": "auto",
    "wrap_width": 0
}
4

1 に答える 1

13

タブとスペースが混在しているようです。を選択View->Indentationしてチェックが入っていることを確認してIndent Using SpacesからクリックConvert Indentation to Spacesすると、すべての設定が完了します。

于 2013-07-17T13:16:45.747 に答える