web-dev-qa-db-ja.com

使用するSubLimeLinterプラグインの構成Ruby 1.9構文

SubLime Linterプラグイン( https://github.com/Kronuz/SublimeLinter )でRuby 1.9構文を認識できるようにしたいと思います。これをSublimeText2で機能させるには?

これが私の現在のデフォルト設定ファイルです:

/*
    SublimeLinter default settings
*/
{
    /*
        Sets the mode in which SublimeLinter runs:

        true - Linting occurs in the background as you type (the default).
        false - Linting only occurs when you initiate it.
        "load-save" - Linting occurs only when a file is loaded and saved.
    */
    "sublimelinter": true,

    /*
        Maps linters to executables for non-built in linters. If the executable
        is not in the default system path, or on posix systems in /usr/local/bin
        or ~/bin, then you must specify the full path to the executable.
        Linter names should be lowercase.

        This is the effective default map; your mappings may override these.

        "sublimelinter_executable_map":
        {
            "Perl": "Perl",
            "php": "php",
            "Ruby": "Ruby"
        },
    */
    "sublimelinter_executable_map":
    {
    },

    /*
        Maps syntax names to linters. This allows variations on a syntax
        (for example "Python (Django)") to be linted. The key is
        the base filename of the .tmLanguage syntax files, and the value
        is the linter name (lowercase) the syntax maps to.
    */
    "sublimelinter_syntax_map":
    {
        "Python Django": "python"
    },

    // An array of linter names to disable. Names should be lowercase.
    "sublimelinter_disable":
    [
    ],

    /*
        The minimum delay in seconds (fractional seconds are okay) before
        a linter is run when the "sublimelinter" setting is true. This allows
        you to have background linting active, but defer the actual linting
        until you are idle. When this value is greater than the built in linting delay,
        errors are erased when the file is modified, since the assumption is
        you don't want to see errors while you type.
    */
    "sublimelinter_delay": 0,

    // If true, lines with errors or warnings will be filled in with the outline color.
    "sublimelinter_fill_outlines": false,

    // If true, lines with errors or warnings will have a Gutter mark.
    "sublimelinter_Gutter_marks": false,

    // 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": false,

    // jshint: options for linting JavaScript. See http://jshint.com/#docs for more info.
    // By deault, eval is allowed.
    "jshint_options":
    {
        "evil": true,
        "regexdash": true,
        "browser": true,
        "wsh": true,
        "trailing": true,
        "sub": true,
        "strict": false
    },

    // A list of pep8 error numbers to ignore. By default "line too long" errors are ignored.
    // The list of error codes is in this file: https://github.com/jcrocholl/pep8/blob/master/pep8.py.
    // Search for "Ennn:", where nnn is a 3-digit number.
    "pep8_ignore":
    [
        "E501"
    ],

    /*
        If you use SublimeLinter for pyflakes checks, you can ignore some of the "undefined name xxx"
        errors (comes in handy if you work with post-processors, globals/builtins available only at runtime, etc.).
        You can control what names will be ignored with the user setting "pyflakes_ignore".

        Example:

        "pyflakes_ignore":
            [
                "some_custom_builtin_o_mine",
                "A_GLOBAL_CONSTANT"
            ],
    */
    "pyflakes_ignore":
    [
    ],

    /*
        Ordinarily pyflakes will issue a warning when 'from foo import *' is used,
        but it is ignored since the warning is not that helpful. If you want to see this warning,
        set this option to false.
    */
    "pyflakes_ignore_import_*": true,

    // Objective-J: if true, non-ascii characters are flagged as an error.
    "sublimelinter_objj_check_ascii": false
}
36
bittersweetryan

Ruby 1.9実行可能ファイルへの絶対パスを使用して動作させることができました。rbenvを使用しているので、実行したパスを取得するにはrbenv which Rubyが必要になる場合があります。 /usr/local/bin/Rubyまたは/usr/local/bin/Ruby19を入力します。

これは私のサブリメリンターのデフォルト設定がどのように見えるかです(必要に応じてこれをプロジェクト固有のファイルに入れることもできます:)

Preferences -> Package Settings -> SublimeLinter -> Settings - User

"sublimelinter_executable_map":
{
    "Ruby": "~/.rbenv/versions/1.9.3-p0/bin/Ruby"
},
41
gerrit

rvmを使用する場合は、rvm-auto-Rubyを使用できるはずです。

これには問題がありましたが、今は解決されていると思います: https://github.com/SublimeLinter/SublimeLinter/issues/

19
phoet

私もこの問題を抱えていたので、チャイムを鳴らしたかっただけです。以下は、UbuntuのST2 v2.0.1でUser/SublimeLinter.sublime-settingsファイルにあります。

Preferences -> Package Settings -> SublimeLinter -> Settings - User

{
  "sublimelinter_executable_map": {
    "Ruby": "~/.rvm/bin/rvm-auto-Ruby"
  }
}

追加後、ST2を再起動し、コンソールに移動して、以下を実行してコンソールが更新されたことを確認します。

view.settings().get("sublimelinter_executable_map")

次の出力が得られるはずです。

{'Ruby': u'~/.rvm/bin/rvm-auto-Ruby'}
16
Dan Caddigan

また、PATHとポイントRuby to rbenv shim to the sublimelinter_executable_map)を追加することで、これを機能させることができました(これは公式ドキュメントからも推奨される方法だと思います)。設定も更新せずにRubyバージョンを切り替える。

{
  "sublimelinter_executable_map": {
    "path": "/usr/local/var/rbenv/shims:/Users/luke/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin",
    "Ruby": "/usr/local/var/rbenv/shims/Ruby"

  }
}
1
Luke Hamilton

SublimeLinter 3では、rbenv(およびできればrvm)は、追加の構成なしですぐにサポートされます(Shellスタートアップの正しい場所で初期化されることを確認する以外)。

0
Aparajita