Skip to content

Commit 07812d3

Browse files
committed
fix: invalid handling for comments in postgresql.conf syntax
1 parent 8575e89 commit 07812d3

File tree

1 file changed

+55
-42
lines changed

1 file changed

+55
-42
lines changed

syntaxes/pgconf.tmLanguage.json

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,48 @@
4747
{
4848
"match": "\\\\.",
4949
"name": "constant.character.escape.pgconf"
50-
},
51-
{
52-
"include": "#number-unit"
53-
},
54-
{
55-
"include": "#boolean"
5650
}
5751
]
5852
},
59-
"enum": {
60-
"match": "[a-zA-Z_][a-zA-Z0-9_\\.\\-]*",
53+
"quoted-value": {
54+
"match": "(')(\\w+)(')",
6155
"captures": {
62-
"0": {
63-
"name": "variable.parameter.enum.pgconf"
56+
"1": {
57+
"name": "punctuation.definition.string.begin.pgconf"
58+
},
59+
"3": {
60+
"name": "punctuation.definition.string.end.pgconf"
61+
},
62+
"2": {
63+
"name": "string.quoted.single.pgconf",
64+
"patterns": [
65+
{
66+
"match": "\\\\.",
67+
"name": "constant.character.escape.pgconf"
68+
},
69+
{
70+
"include": "#number-unit"
71+
},
72+
{
73+
"include": "#boolean"
74+
}
75+
]
6476
}
6577
}
6678
},
67-
"param-name": {
68-
"match": "[a-zA-Z_][a-zA-Z0-9_\\-]*(\\.[a-zA-Z_][a-zA-Z0-9_\\-]*)*",
79+
"enum": {
80+
"match": "[a-zA-Z_][a-zA-Z0-9_\\.\\-]*",
6981
"captures": {
7082
"0": {
71-
"name": "keyword.other.definition.pgconf"
83+
"name": "variable.parameter.enum.pgconf"
7284
}
7385
}
7486
},
7587
"param-value": {
7688
"patterns": [
89+
{
90+
"include": "#quoted-value"
91+
},
7792
{
7893
"include": "#string"
7994
},
@@ -95,43 +110,41 @@
95110
"comment": "Full line comment",
96111
"name": "comment.line.number-sign.pgconf"
97112
},
113+
{
114+
"begin": "(^[ \\t]+)?(?=#)",
115+
"beginCaptures": {
116+
"1": {
117+
"name": "punctuation.whitespace.comment.leading.pgconf"
118+
}
119+
},
120+
"end": "(?!\\G)",
121+
"patterns": [
122+
{
123+
"begin": "#",
124+
"beginCaptures": {
125+
"0": {
126+
"name": "punctuation.definition.comment.pgconf"
127+
}
128+
},
129+
"end": "\\n",
130+
"name": "comment.line.number-sign.pgconf"
131+
}
132+
]
133+
},
98134
{
99-
"comment": "Line with parameter definition",
100-
"match": "^\\s*(\\S+)\\s*(=)?\\s*(\\S+)\\s*(#.*)?$",
135+
"comment": "Parameter definition",
136+
"match": "^\\s*([a-zA-Z0-9_.-]+)\\s*(=)?",
101137
"captures": {
102138
"1": {
103-
"patterns": [
104-
{
105-
"include": "#param-name"
106-
}
107-
]
139+
"name": "keyword.other.definition.pgconf"
108140
},
109141
"2": {
110142
"name": "punctuation.separator.key-value.pgconf"
111-
},
112-
"3": {
113-
"name": "meta.other.value.pgconf",
114-
"patterns": [
115-
{
116-
"include": "#param-value"
117-
}
118-
]
119-
},
120-
"4": {
121-
"patterns": [
122-
{
123-
"begin": "#",
124-
"beginCaptures": {
125-
"0": {
126-
"name": "punctuation.definition.comment.pgconf"
127-
}
128-
},
129-
"end": "\\n",
130-
"name": "comment.line.number-sign.pgconf"
131-
}
132-
]
133143
}
134144
}
145+
},
146+
{
147+
"include": "#param-value"
135148
}
136149
]
137150
}

0 commit comments

Comments
 (0)