Skip to content

Commit cede855

Browse files
committed
Add firestore rules language setup
1 parent 96ebb41 commit cede855

File tree

3 files changed

+75
-9
lines changed

3 files changed

+75
-9
lines changed

language-configuration.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"comments": {
3+
// symbol used for single line comment. Remove this entry if your language does not support line comments
4+
"lineComment": "//",
5+
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6+
"blockComment": [ "/*", "*/" ]
7+
},
8+
// symbols used as brackets
9+
"brackets": [
10+
["{", "}"],
11+
["[", "]"],
12+
["(", ")"]
13+
],
14+
// symbols that are auto closed when typing
15+
"autoClosingPairs": [
16+
["{", "}"],
17+
["[", "]"],
18+
["(", ")"],
19+
["\"", "\""],
20+
["'", "'"]
21+
],
22+
// symbols that that can be used to surround a selection
23+
"surroundingPairs": [
24+
["{", "}"],
25+
["[", "]"],
26+
["(", ")"],
27+
["\"", "\""],
28+
["'", "'"]
29+
]
30+
}

package.json

+13-9
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@
77
"vscode": "^1.37.0"
88
},
99
"categories": [
10-
"Other"
11-
],
12-
"activationEvents": [
13-
"onCommand:extension.helloWorld"
10+
"Programming Languages"
1411
],
1512
"main": "./out/extension.js",
1613
"contributes": {
17-
"commands": [{
18-
"command": "extension.helloWorld",
19-
"title": "Hello World"
20-
}]
21-
},
14+
"languages": [{
15+
"id": "firestorerules",
16+
"aliases": ["Firestore Rules", "firestore"],
17+
"extensions": ["rules","rule"],
18+
"configuration": "./language-configuration.json"
19+
}],
20+
"grammars": [{
21+
"language": "firestorerules",
22+
"scopeName": "source.firebase",
23+
"path": "./syntaxes/firestorerules.tmLanguage.json"
24+
}]
25+
},
2226
"scripts": {
2327
"vscode:prepublish": "yarn run compile",
2428
"compile": "tsc -p ./",
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "firestorerules",
4+
"patterns": [
5+
{
6+
"include": "#keywords"
7+
},
8+
{
9+
"include": "#strings"
10+
}
11+
],
12+
"repository": {
13+
"keywords": {
14+
"patterns": [{
15+
"name": "keyword.control.firestorerules",
16+
"match": "\\b(if|while|for|return)\\b"
17+
}]
18+
},
19+
"strings": {
20+
"name": "string.quoted.double.firestorerules",
21+
"begin": "\"",
22+
"end": "\"",
23+
"patterns": [
24+
{
25+
"name": "constant.character.escape.firestorerules",
26+
"match": "\\\\."
27+
}
28+
]
29+
}
30+
},
31+
"scopeName": "source.firebase"
32+
}

0 commit comments

Comments
 (0)