Skip to content

Commit 915fcaf

Browse files
authored
fix: Incorrect YAML syntax highlighting for version numbers with multiple periods #4827
fix: Incorrect YAML syntax highlighting for version numbers with multiple periods
2 parents 44b6c12 + e130e89 commit 915fcaf

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

demo/kitchen-sink/docs/yaml.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ items:
1818
size: 8
1919
price: 100.27
2020
quantity: 1
21+
version: 1.2.3.4
2122

2223
bill-to: &id001
2324
street: |

lib/ace/mode/_test/text_yaml.txt

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ items:
1818
size: 8
1919
price: 100.27
2020
quantity: 1
21+
version: 1.2.3.4
2122

2223
bill-to: &id001
2324
street: |

lib/ace/mode/_test/tokens_yaml.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@
9797
["keyword",":"],
9898
["text"," "],
9999
["constant.numeric","1"]
100+
],[
101+
"start",
102+
["meta.tag"," version"],
103+
["keyword",":"],
104+
["text"," 1.2.3.4"]
100105
],[
101106
"start"
102107
],[
@@ -124,7 +129,7 @@
124129
["indent"," "],
125130
["meta.tag","ref-id"],
126131
["keyword",":"],
127-
["text"," id123"]
132+
["text"," id123 "]
128133
],[
129134
"start",
130135
["meta.tag"," city"],

lib/ace/mode/yaml_highlight_rules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ var YamlHighlightRules = function() {
100100
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
101101
}, {
102102
token : "constant.numeric", // float
103-
regex : /(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)/
103+
regex : /(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)$/
104104
}, {
105105
token : "constant.numeric", // other number
106106
regex : /[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/

0 commit comments

Comments
 (0)