Skip to content

Commit 45d78fe

Browse files
committed
Switch to new pattern rules.
1 parent 9702836 commit 45d78fe

File tree

4 files changed

+90
-163
lines changed

4 files changed

+90
-163
lines changed

package.json

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "python-string-sql",
3-
"displayName": "python-string-sql",
4-
"description": "highlight python strings as sql",
5-
"version": "1.1.0",
6-
"publisher": "ptweir",
2+
"name": "highlight-string-code",
3+
"displayName": "Highlight Code in String",
4+
"description": "Highlight specific language code in string",
5+
"version": "1.0.1",
6+
"publisher": "iuyoy",
77
"icon": "docs/logo.png",
88
"repository": {
9-
"url": "https://github.com/ptweir/python-string-sql"
9+
"url": "https://github.com/iuyoy/python-string-sql"
1010
},
1111
"engines": {
1212
"vscode": "^1.32.0"
@@ -17,54 +17,26 @@
1717
],
1818
"contributes": {
1919
"grammars": [
20-
{
21-
"path": "./syntaxes/highlight-sql-string.json",
22-
"scopeName": "python-sql.injection",
23-
"injectTo": [
24-
"source.python"
25-
],
26-
"embeddedLanguages": {
27-
"meta.embedded.sql": "sql"
28-
}
29-
},
3020
{
3121
"path": "./syntaxes/highlight-html-string.json",
32-
"scopeName": "python-html.injection",
22+
"scopeName": "string-html.injection",
3323
"injectTo": [
34-
"source.python"
24+
"source"
3525
],
3626
"embeddedLanguages": {
3727
"meta.embedded.block.html": "html"
3828
}
3929
},
4030
{
41-
"path": "./syntaxes/highlight-sql-shell-string.json",
42-
"scopeName": "shell-sql.injection",
31+
"path": "./syntaxes/highlight-sql-string.json",
32+
"scopeName": "string-sql.injection",
4333
"injectTo": [
44-
"source.shell"
34+
"source"
4535
],
4636
"embeddedLanguages": {
4737
"meta.embedded.sql": "sql"
4838
}
4939
}
50-
],
51-
"snippets": [
52-
{
53-
"language": "python",
54-
"path": "./snippets/python.json"
55-
}
56-
],
57-
"keybindings": [
58-
{
59-
"command": "editor.action.insertSnippet",
60-
"key": "cmd+s",
61-
"mac": "ctrl+s",
62-
"when": "editorTextFocus",
63-
"args": {
64-
"langId": "python",
65-
"name": "SQL_highlighted_string"
66-
}
67-
}
6840
]
6941
}
7042
}
Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,17 @@
11
{
2-
"fileTypes": [
3-
"py"
4-
],
5-
"injectionSelector": "L:string.quoted.multi.python, L:meta.fstring.python - (comment.line.number-sign.python, punctuation.definition.comment.python)",
6-
"repository": {
7-
"keep-variables": {
8-
"patterns": [
9-
{
10-
"begin": "\\{",
11-
"end": "\\}",
12-
"beginCaptures": {
13-
"1": {
14-
"name": "punctuation.section.embedded.begin.py"
15-
},
16-
"2": {
17-
"name": "punctuation.section.embedded"
18-
}
19-
},
20-
"endCaptures": {
2+
"injectionSelector": "L:source",
3+
"patterns": [
4+
{
5+
"begin": "(<!--(html).*-->)",
6+
"end": "(<!--(\\!html).*-->)",
7+
"captures": {
218
"1": {
22-
"name": "punctuation.section.embedded.end.py"
9+
"name": "comment.block.html"
2310
},
2411
"2": {
25-
"name": "punctuation.section.embedded"
12+
"name": "entity.name.function"
2613
}
27-
},
28-
"patterns": [
29-
{
30-
"include": "text.html.derivative"
31-
}
32-
]
33-
}
34-
]
35-
}
36-
},
37-
"patterns": [
38-
{
39-
"begin": "( *--html| *--beginhtml| *--begin-html)",
40-
"end": "( *--\\!html| *--endhtml| *--end-html)",
41-
"captures": {
42-
"1": {
43-
"name": "variable.parameter"
44-
}
45-
},
14+
},
4615
"patterns": [
4716
{
4817
"include": "text.html.derivative"
@@ -53,5 +22,5 @@
5322
]
5423
}
5524
],
56-
"scopeName": "python-html.injection"
25+
"scopeName": "string-html.injection"
5726
}

syntaxes/highlight-sql-shell-string.json

Lines changed: 0 additions & 45 deletions
This file was deleted.

syntaxes/highlight-sql-string.json

Lines changed: 69 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,76 @@
11
{
2-
"fileTypes": [
3-
"py"
4-
],
5-
"injectionSelector": "L:string.quoted.multi.python, L:meta.fstring.python - (comment.line.number-sign.python, punctuation.definition.comment.python)",
6-
"patterns": [
7-
{
8-
"begin": "(--sql)",
9-
"end": "(;)",
10-
"captures": {
11-
"1": {
12-
"name": "variable.parameter"
13-
}
14-
},
15-
"patterns": [
2+
"scopeName": "string-sql.injection",
3+
"name": "source.stringcode",
4+
"injectionSelector": "L:source - (source.stringcode, keyword.operator) ",
5+
"patterns": [
166
{
17-
"include": "source.sql"
18-
}
19-
]
20-
},
21-
{
22-
"begin": "(--beginsql|--begin-sql)",
23-
"end": "(--endsql|--end-sql)",
24-
"captures": {
25-
"1": {
26-
"name": "variable.parameter"
27-
}
28-
},
29-
"patterns": [
7+
"begin": "(--(sql).*)",
8+
"beginCaptures": {
9+
"1": {
10+
"name": "comment.line.double-dash.sql"
11+
},
12+
"2": {
13+
"name": "entity.name.function"
14+
}
15+
},
16+
"end": "(;)",
17+
"endCaptures": {
18+
"1": {
19+
"name": "keyword.operator"
20+
}
21+
},
22+
"patterns": [
23+
{
24+
"include": "source.sql"
25+
}
26+
],
27+
"contentName": "keyword.operator"
28+
},
3029
{
31-
"match": "(;)",
32-
"captures": {
33-
"1": {
34-
"name": "keyword.operator"
35-
}
36-
}
30+
"begin": "(--(beginsql|begin-sql).*)",
31+
"end": "(--(endsql|end-sql))",
32+
"captures": {
33+
"1": {
34+
"name": "comment.line.double-dash.sql"
35+
},
36+
"2": {
37+
"name": "entity.name.function"
38+
}
39+
},
40+
"patterns": [
41+
{
42+
"match": "(;)",
43+
"captures": {
44+
"1": {
45+
"name": "keyword.operator"
46+
}
47+
}
48+
},
49+
{
50+
"include": "source.sql"
51+
}
52+
],
53+
"contentName": "keyword.operator"
3754
},
3855
{
39-
"include": "source.sql"
56+
"begin": "(SELECT|INSERT|DELETE|UPDATE|DROP|ALTER|CREATE)",
57+
"end": "(;)",
58+
"beginCaptures": {
59+
"1": {
60+
"name": "keyword.other.DML.sql"
61+
}
62+
},
63+
"endCaptures": {
64+
"1": {
65+
"name": "keyword.operator"
66+
}
67+
},
68+
"patterns": [
69+
{
70+
"include": "source.sql"
71+
}
72+
],
73+
"contentName": "source.stringcode, keyword.operator"
4074
}
41-
]
42-
}
43-
],
44-
"scopeName": "python-sql.injection"
75+
]
4576
}

0 commit comments

Comments
 (0)