Skip to content

Commit 164619e

Browse files
dscalzirgrunber
andauthored
Support Java Properties grammar. (#2636)
* Place language configuration & TextMate grammar under language-support. * Add aliases attribute for user-friendly display Co-authored-by: Roland Grunberg <[email protected]>
1 parent e53156d commit 164619e

File tree

4 files changed

+188
-1
lines changed

4 files changed

+188
-1
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"information_for_contributors": [
3+
"This file has been converted from https://github.com/textmate/java.tmbundle/blob/master/Syntaxes/JavaProperties.plist",
4+
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
5+
"Once accepted there, we are happy to receive an update request."
6+
],
7+
"version": "https://github.com/textmate/java.tmbundle/blob/79b8b61865e40de0ff04bb16fe1076b154b9894c/Syntaxes/JavaProperties.plist",
8+
"fileTypes": [
9+
"properties"
10+
],
11+
"foldingStartMarker": "^[a-zA-Z0-9.-_]+=.*\\\r\n",
12+
"foldingStopMarker": "^(.*(?<!\\)\r\n)",
13+
"keyEquivalent": "^~J",
14+
"name": "Java Properties",
15+
"patterns": [
16+
{
17+
"comment": "Ignore blank lines",
18+
"match": "^\\s*$"
19+
},
20+
{
21+
"include": "#comment-line"
22+
},
23+
{
24+
"include": "#property-name"
25+
},
26+
{
27+
"include": "#property-definition"
28+
}
29+
],
30+
"repository": {
31+
"comment-line": {
32+
"captures": {
33+
"1": {
34+
"name": "punctuation.whitespace.comment.leading.java-properties"
35+
},
36+
"2": {
37+
"name": "punctuation.definition.comment.java-properties"
38+
}
39+
},
40+
"match": "^(\\s*)([#!])(.+)?$\\n?",
41+
"name": "comment.line.java-properties"
42+
},
43+
"property-definition": {
44+
"begin": "^(\\s*)((?:\\\\[ \\t]|\\\\:|\\\\=|[^:=\\s])+)(?:\\s*([:=]))?\\s*",
45+
"beginCaptures": {
46+
"1": {
47+
"name": "punctuation.whitespace.leading.java-properties"
48+
},
49+
"2": {
50+
"name": "support.constant.java-properties",
51+
"patterns": [
52+
{
53+
"match": "\\\\(?:[ \\t:=\\\\ntfr\\\"']|u[0-9A-Fa-f]{4})",
54+
"name": "constant.character.escape.java-properties"
55+
}
56+
]
57+
},
58+
"3": {
59+
"name": "punctuation.separator.key-value.java-properties"
60+
}
61+
},
62+
"contentName": "string.unquoted.java-properties",
63+
"end": "(?<!\\\\{1})$\\n",
64+
"name": "meta.key-value.java-properties",
65+
"patterns": [
66+
{
67+
"comment": "Leading space on a continued line is ignored",
68+
"match": "^\\s*",
69+
"name": "punctuation.whitespace.leading.java-properties"
70+
},
71+
{
72+
"match": "(\\\\{1})(?=$\\n)",
73+
"name": "punctuation.separator.continuation.java-properties"
74+
},
75+
{
76+
"match": "\\\\(?:[\\\\ntfr\\\"']|u[0-9A-Fa-f]{4})",
77+
"name": "constant.character.escape.java-properties"
78+
}
79+
]
80+
},
81+
"property-name": {
82+
"captures": {
83+
"1": {
84+
"name": "punctuation.whitespace.comment.leading.java-properties"
85+
},
86+
"2": {
87+
"name": "support.constant.java-properties",
88+
"patterns": [
89+
{
90+
"match": "\\\\(?:[ \\t:=\\\\ntfr\\\"']|u[0-9A-Fa-f]{4})",
91+
"name": "constant.character.escape.java-properties"
92+
}
93+
]
94+
}
95+
},
96+
"comment": "A property name with no value",
97+
"match": "^(\\s*)((?:\\\\[ \\t]|\\\\:|\\\\=|[^:=\\s])+)(?:\\s*([:=]))?\\s*$\\n",
98+
"name": "meta.key-value.java-properties"
99+
}
100+
},
101+
"scopeName": "source.java-properties",
102+
"uuid": "D364E829-7643-4AFF-948D-3C0D6B4EA8A4"
103+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"comments": {
3+
"lineComment": "#"
4+
},
5+
"brackets": [
6+
[
7+
"{",
8+
"}"
9+
],
10+
[
11+
"[",
12+
"]"
13+
],
14+
[
15+
"(",
16+
")"
17+
]
18+
],
19+
"autoClosingPairs": [
20+
[
21+
"{",
22+
"}"
23+
],
24+
[
25+
"[",
26+
"]"
27+
],
28+
[
29+
"(",
30+
")"
31+
],
32+
[
33+
"\"",
34+
"\""
35+
],
36+
[
37+
"'",
38+
"'"
39+
]
40+
],
41+
"surroundingPairs": [
42+
[
43+
"{",
44+
"}"
45+
],
46+
[
47+
"[",
48+
"]"
49+
],
50+
[
51+
"(",
52+
")"
53+
],
54+
[
55+
"\"",
56+
"\""
57+
],
58+
[
59+
"'",
60+
"'"
61+
],
62+
[
63+
"<",
64+
">"
65+
]
66+
]
67+
}

package.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,24 @@
153153
".java",
154154
".class"
155155
],
156-
"configuration": "./language-configuration.json"
156+
"configuration": "./language-support/java/language-configuration.json"
157+
},
158+
{
159+
"id": "java-properties",
160+
"aliases": [
161+
"Java Properties"
162+
],
163+
"extensions": [
164+
".properties"
165+
],
166+
"configuration": "./language-support/properties/java-properties-configuration.json"
167+
}
168+
],
169+
"grammars": [
170+
{
171+
"language": "java-properties",
172+
"scopeName": "source.java-properties",
173+
"path": "./language-support/properties/JavaProperties.tmLanguage.json"
157174
}
158175
],
159176
"snippets": [

0 commit comments

Comments
 (0)