Skip to content

Commit

Permalink
feat(python): add support for python (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3lm authored and SamVerschueren committed Sep 15, 2023
1 parent fec2581 commit 2c19804
Show file tree
Hide file tree
Showing 4 changed files with 4,782 additions and 0 deletions.
16 changes: 16 additions & 0 deletions grammars/grammars.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,15 @@
"base": "javascript",
"file": "tags-language-configuration.json"
}
},
{
"language": "python",
"scopeName": "source.python",
"grammar": "MagicPython.tmLanguage.json",
"extensions": [".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi", ".pyi", ".ipy", ".pyt"],
"aliases": ["Python", "py"],
"filenames": ["SConstruct", "SConscript"],
"firstLine": "^#!\\s*/?.*\\bpython[0-9.-]*\\b"
}
],
"grammars": [
Expand Down Expand Up @@ -573,6 +582,13 @@
"meta.embedded.block.typescript": "typescript",
"meta.embedded.block.typescriptreact": "typescriptreact"
}
},
{
"scopeName": "source.regexp.python",
"grammar": {
"base": "python",
"file": "MagicRegExp.tmLanguage.json"
}
}
]
}
56 changes: 56 additions & 0 deletions grammars/python/language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"comments": {
"lineComment": "#",
"blockComment": ["\"\"\"", "\"\"\""]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "\"", "close": "\"", "notIn": ["string"] },
{ "open": "r\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "R\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "u\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "U\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "f\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "F\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "b\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "B\"", "close": "\"", "notIn": ["string", "comment"] },
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "r'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "R'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "u'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "U'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "f'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "F'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "b'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "B'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "`", "close": "`", "notIn": ["string"] }
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["`", "`"]
],
"folding": {
"offSide": true,
"markers": {
"start": "^\\s*#\\s*region\\b",
"end": "^\\s*#\\s*endregion\\b"
}
},
"onEnterRules": [
{
"beforeText": "^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$",
"action": { "indent": "indent" }
}
]
}
Loading

0 comments on commit 2c19804

Please sign in to comment.