Skip to content

Commit 2c19804

Browse files
d3lmSamVerschueren
authored andcommitted
feat(python): add support for python (#2)
1 parent fec2581 commit 2c19804

File tree

4 files changed

+4782
-0
lines changed

4 files changed

+4782
-0
lines changed

grammars/grammars.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,15 @@
410410
"base": "javascript",
411411
"file": "tags-language-configuration.json"
412412
}
413+
},
414+
{
415+
"language": "python",
416+
"scopeName": "source.python",
417+
"grammar": "MagicPython.tmLanguage.json",
418+
"extensions": [".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi", ".pyi", ".ipy", ".pyt"],
419+
"aliases": ["Python", "py"],
420+
"filenames": ["SConstruct", "SConscript"],
421+
"firstLine": "^#!\\s*/?.*\\bpython[0-9.-]*\\b"
413422
}
414423
],
415424
"grammars": [
@@ -573,6 +582,13 @@
573582
"meta.embedded.block.typescript": "typescript",
574583
"meta.embedded.block.typescriptreact": "typescriptreact"
575584
}
585+
},
586+
{
587+
"scopeName": "source.regexp.python",
588+
"grammar": {
589+
"base": "python",
590+
"file": "MagicRegExp.tmLanguage.json"
591+
}
576592
}
577593
]
578594
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"comments": {
3+
"lineComment": "#",
4+
"blockComment": ["\"\"\"", "\"\"\""]
5+
},
6+
"brackets": [
7+
["{", "}"],
8+
["[", "]"],
9+
["(", ")"]
10+
],
11+
"autoClosingPairs": [
12+
{ "open": "{", "close": "}" },
13+
{ "open": "[", "close": "]" },
14+
{ "open": "(", "close": ")" },
15+
{ "open": "\"", "close": "\"", "notIn": ["string"] },
16+
{ "open": "r\"", "close": "\"", "notIn": ["string", "comment"] },
17+
{ "open": "R\"", "close": "\"", "notIn": ["string", "comment"] },
18+
{ "open": "u\"", "close": "\"", "notIn": ["string", "comment"] },
19+
{ "open": "U\"", "close": "\"", "notIn": ["string", "comment"] },
20+
{ "open": "f\"", "close": "\"", "notIn": ["string", "comment"] },
21+
{ "open": "F\"", "close": "\"", "notIn": ["string", "comment"] },
22+
{ "open": "b\"", "close": "\"", "notIn": ["string", "comment"] },
23+
{ "open": "B\"", "close": "\"", "notIn": ["string", "comment"] },
24+
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
25+
{ "open": "r'", "close": "'", "notIn": ["string", "comment"] },
26+
{ "open": "R'", "close": "'", "notIn": ["string", "comment"] },
27+
{ "open": "u'", "close": "'", "notIn": ["string", "comment"] },
28+
{ "open": "U'", "close": "'", "notIn": ["string", "comment"] },
29+
{ "open": "f'", "close": "'", "notIn": ["string", "comment"] },
30+
{ "open": "F'", "close": "'", "notIn": ["string", "comment"] },
31+
{ "open": "b'", "close": "'", "notIn": ["string", "comment"] },
32+
{ "open": "B'", "close": "'", "notIn": ["string", "comment"] },
33+
{ "open": "`", "close": "`", "notIn": ["string"] }
34+
],
35+
"surroundingPairs": [
36+
["{", "}"],
37+
["[", "]"],
38+
["(", ")"],
39+
["\"", "\""],
40+
["'", "'"],
41+
["`", "`"]
42+
],
43+
"folding": {
44+
"offSide": true,
45+
"markers": {
46+
"start": "^\\s*#\\s*region\\b",
47+
"end": "^\\s*#\\s*endregion\\b"
48+
}
49+
},
50+
"onEnterRules": [
51+
{
52+
"beforeText": "^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$",
53+
"action": { "indent": "indent" }
54+
}
55+
]
56+
}

0 commit comments

Comments
 (0)