SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

invalid.illegal.unexpected-token.snippet in Sublime Text Keymap (JSON) #241

Closed evandrocoan closed 5 years ago

evandrocoan commented 5 years ago

image

[
  // extend line comments (//, #, %, --) with enter
  { "keys": ["enter"], "command": "insert_snippet", "args": {"contents": "\n${TM_CURRENT_LINE/^\\s*((?:\\/\\/[\\/!]?|#|%|--|::|(?i:rem)|'|;)\\s*).*/$1/}"},
    "context": [
      { "key": "setting.auto_indent",                "operator": "equal",          "operand": true,              "match_all": true },
      { "key": "setting.jsdocs_extend_double_slash", "operator": "equal",          "operand": true,              "match_all": true },
      { "key": "selector",                           "operator": "equal",          "operand": "comment.line",    "match_all": true },
      { "key": "auto_complete_visible",              "operator": "equal",          "operand": false,             "match_all": true },
      { "key": "preceding_text",                     "operator": "regex_contains", "operand": "^\\s*(\\/\\/[\\/!]?|#|%|--|::|(?i:rem)|'|;)", "match_all": true }
    ]
  },
  // extend line comments (//, #, %, --) with keypad enter
  { "keys": ["keypad_enter"], "command": "insert_snippet", "args": {"contents": "\n${TM_CURRENT_LINE/^\\s*((?:\\/\\/[\\/!]?|#|%|--|::|(?i:rem)|'|;)\\s*).*$/$1/}"},
    "context": [
      { "key": "setting.auto_indent",                "operator": "equal",          "operand": true,           "match_all": true },
      { "key": "setting.jsdocs_extend_double_slash", "operator": "equal",          "operand": true,           "match_all": true },
      { "key": "selector",                           "operator": "equal",          "operand": "comment.line", "match_all": true },
      { "key": "auto_complete_visible",              "operator": "equal",          "operand": false,          "match_all": true },
      { "key": "preceding_text",                     "operator": "regex_contains", "operand": "^\\s*\\/\\/[\\/!]?|#|%|--|::|(?i:rem)|'|;",  "match_all": true }
    ]
  },
]

I am using the latest version on this master branch as of today.