[ // Auto-pair quotes { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "(?:[bfruBFRU]|[^\"[:alnum:]_])$", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double - punctuation.definition.string.end", "match_all": true }, { "key": "eol_selector", "operator": "equal", "operand": "source.python", "match_all": true } ] }, // Auto-pair single quotes { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "(?:[bfruBFRU]|[^'[:alnum:]_])$", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }, { "key": "eol_selector", "operator": "equal", "operand": "source.python", "match_all": true } ] }, // Auto-pair curly brackets { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$0}"}, "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "not_regex_contains", "operand": "^\\{", "match_all": true }, { "key": "selector", "operator": "equal", "operand": "meta.fstring.python", "match_all": true }, { "key": "selector", "operator": "equal", "operand": "string.quoted", "match_all": true } ] }, // Replace a '{|}' with '{{|' when typing within f-string { "keys": ["{"], "command": "fstringbrace", "context": [ { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }, { "key": "selector", "operator": "equal", "operand": "meta.fstring.python", "match_all": true }, { "key": "selector", "operator": "equal", "operand": "constant.character.format.placeholder.other", "match_all": true } ] } ]