diff --git a/grammars/python.cson b/grammars/python.cson index 71cb6d4..287ca22 100644 --- a/grammars/python.cson +++ b/grammars/python.cson @@ -108,7 +108,7 @@ { 'comment': 'keywords that delimit flow conditionals' 'name': 'keyword.control.conditional.python' - 'match': '\\b(if|elif|else)\\b' + 'match': '\\b(if|elif|else|match|case)\\b' } { 'comment': 'keywords that delimit an exception' @@ -848,7 +848,7 @@ 'generic_names': 'match': '[A-Za-z_][A-Za-z0-9_]*' 'illegal_names': - 'match': '\\b(and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield|await|async)\\b' + 'match': '\\b(and|as|assert|break|class|continue|def|del|elif|else|match|case|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield|await|async)\\b' 'name': 'invalid.illegal.name.python' 'keyword_arguments': 'begin': '\\b([a-zA-Z_][a-zA-Z_0-9]*)\\s*(=)(?!=)' diff --git a/grammars/tree-sitter-python.cson b/grammars/tree-sitter-python.cson index 4490d74..cfe1b97 100644 --- a/grammars/tree-sitter-python.cson +++ b/grammars/tree-sitter-python.cson @@ -35,6 +35,8 @@ folds: [ 'if_statement' 'elif_clause' 'else_clause' + 'match_statement' + 'case_clause' 'for_statement' 'try_statement' 'with_statement' @@ -126,6 +128,8 @@ scopes: '"if"': 'keyword.control' '"else"': 'keyword.control' '"elif"': 'keyword.control' + '"match"': 'keyword.control' + '"case"': 'keyword.control' '"while"': 'keyword.control' '"for"': 'keyword.control' '"return"': 'keyword.control' diff --git a/settings/language-python.cson b/settings/language-python.cson index 8538f10..79c7d33 100644 --- a/settings/language-python.cson +++ b/settings/language-python.cson @@ -5,5 +5,5 @@ 'tabLength': 4 'commentStart': '# ' 'foldEndPattern': '^\\s*[}\\])]' - 'increaseIndentPattern': '^\\s*(class|def|elif|else|except|finally|for|if|try|with|while|async\\s+(def|for|with))\\b.*:\\s*$' - 'decreaseIndentPattern': '^\\s*(elif|else|except|finally)\\b.*:\\s*$' + 'increaseIndentPattern': '^\\s*(class|def|elif|else|match|case|except|finally|for|if|try|with|while|async\\s+(def|for|with))\\b.*:\\s*$' + 'decreaseIndentPattern': '^\\s*(elif|else|case|except|finally)\\b.*:\\s*$'