Skip to content

Commit 9609653

Browse files
dkwon17fbricon
authored andcommitted
Improve application.properties TextMate grammar
Signed-off-by: David Kwon <[email protected]>
1 parent d489d5b commit 9609653

File tree

2 files changed

+84
-10
lines changed

2 files changed

+84
-10
lines changed
Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,89 @@
11
{
2-
"fileTypes": [
3-
"properties"
2+
"information_for_contributors": [
3+
"This file was referenced from https://github.com/microsoft/vscode/blob/master/extensions/ini/syntaxes/ini.tmLanguage.json",
4+
"This file has been edited to fit the needs for java.properties syntax highlighting"
45
],
5-
"foldingStartMarker": "^[a-zA-Z0-9.-_]+=.*\\\n",
6-
"foldingStopMarker": "^(.*(?<!\\)\n)",
7-
"keyEquivalent": "^~J",
6+
"name": "Java Properties",
7+
"scopeName": "source.java-properties",
88
"patterns": [
99
{
10-
"include": "source.ini"
10+
"comment": "Matching for comments that start with #",
11+
"begin": "(^[ \\t]+)?(?=#)",
12+
"beginCaptures": {
13+
"1": {
14+
"name": "punctuation.whitespace.comment.leading.java-properties"
15+
}
16+
},
17+
"end": "(?!\\G)",
18+
"patterns": [
19+
{
20+
"begin": "#",
21+
"beginCaptures": {
22+
"0": {
23+
"name": "punctuation.definition.comment.java-properties"
24+
}
25+
},
26+
"end": "\\n",
27+
"name": "comment.line.number-sign.java-properties"
28+
}
29+
]
30+
},
31+
{
32+
"comment": "Matching for property keys",
33+
"captures": {
34+
"1": {
35+
"name": "keyword.other.definition.java-properties"
36+
},
37+
"4": {
38+
"name": "punctuation.separator.key-value.java-properties"
39+
}
40+
},
41+
"match": "^\\s*([\\/a-zA-Z0-9%_.-]+)\\s*(?=[=\\\\])"
42+
},
43+
{
44+
"comment": "Matching the equals sign and property value",
45+
"begin": "=",
46+
"end": "(?<!\\\\)\\n",
47+
"patterns": [
48+
{
49+
"include": "#numbers"
50+
}
51+
]
52+
},
53+
{
54+
"comment": "Matching for section (text enclosed between square brackets [])",
55+
"captures": {
56+
"1": {
57+
"name": "punctuation.definition.entity.java-properties"
58+
},
59+
"4": {
60+
"name": "punctuation.definition.entity.java-properties"
61+
}
62+
},
63+
"match": "^(\\[)(.*?)(\\])",
64+
"name": "entity.name.section.group-title.java-properties"
1165
}
1266
],
13-
"scopeName": "source.ini.properties",
14-
"uuid": "D364E829-7643-4AFF-948D-3C0D6B4EA8A4"
67+
"repository": {
68+
"numbers": {
69+
"patterns": [
70+
{
71+
"match": "(?x)\n\\b(?<!\\$)\n0(x|X)\n(\n (?<!\\.)[0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?[Ll]?(?!\\.)\n |\n (\n [0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?\\.?\n |\n ([0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?)?\\.[0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?\n )\n [Pp][+-]?[0-9]([0-9_]*[0-9])?[FfDd]?\n)\n\\b(?!\\$)",
72+
"name": "constant.numeric.hex.java-properties"
73+
},
74+
{
75+
"match": "\\b(?<!\\$)0(b|B)[01]([01_]*[01])?[Ll]?\\b(?!\\$)",
76+
"name": "constant.numeric.binary.java-properties"
77+
},
78+
{
79+
"match": "\\b(?<!\\$)0[0-7]([0-7_]*[0-7])?[Ll]?\\b(?!\\$)",
80+
"name": "constant.numeric.octal.java-properties"
81+
},
82+
{
83+
"match": "(?x)\n(?<!\\$)\n(\n \\b[0-9]([0-9_]*[0-9])?\\.\\B(?!\\.)\n |\n \\b[0-9]([0-9_]*[0-9])?\\.([Ee][+-]?[0-9]([0-9_]*[0-9])?)[FfDd]?\\b\n |\n \\b[0-9]([0-9_]*[0-9])?\\.([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]\\b\n |\n \\b[0-9]([0-9_]*[0-9])?\\.([0-9]([0-9_]*[0-9])?)([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]?\\b\n |\n (?<!\\.)\\B\\.[0-9]([0-9_]*[0-9])?([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]?\\b\n |\n \\b[0-9]([0-9_]*[0-9])?([Ee][+-]?[0-9]([0-9_]*[0-9])?)[FfDd]?\\b\n |\n \\b[0-9]([0-9_]*[0-9])?([Ee][+-]?[0-9]([0-9_]*[0-9])?)?[FfDd]\\b\n |\n \\b(0|[1-9]([0-9_]*[0-9])?)(?!\\.)[Ll]?\\b\n)\n(?!\\$)",
84+
"name": "constant.numeric.decimal.java-properties"
85+
}
86+
]
87+
}
88+
}
1589
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,12 @@
286286
"grammars": [
287287
{
288288
"language": "microprofile-properties",
289-
"scopeName": "source.ini.properties",
289+
"scopeName": "source.java-properties",
290290
"path": "./language-support/properties-support/java-properties.tmLanguage.json"
291291
},
292292
{
293293
"language": "quarkus-properties",
294-
"scopeName": "source.ini.properties",
294+
"scopeName": "source.java-properties",
295295
"path": "./language-support/properties-support/java-properties.tmLanguage.json"
296296
},
297297
{

0 commit comments

Comments
 (0)