Skip to content

Commit

Permalink
fix: Incorrect YAML syntax highlighting for version numbers with mult…
Browse files Browse the repository at this point in the history
…iple periods #4827

fix: Incorrect YAML syntax highlighting for version numbers with multiple periods
  • Loading branch information
andrewnester committed Jun 22, 2022
2 parents 44b6c12 + e130e89 commit 915fcaf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions demo/kitchen-sink/docs/yaml.yaml
Expand Up @@ -18,6 +18,7 @@ items:
size: 8
price: 100.27
quantity: 1
version: 1.2.3.4

bill-to: &id001
street: |
Expand Down
1 change: 1 addition & 0 deletions lib/ace/mode/_test/text_yaml.txt
Expand Up @@ -18,6 +18,7 @@ items:
size: 8
price: 100.27
quantity: 1
version: 1.2.3.4

bill-to: &id001
street: |
Expand Down
7 changes: 6 additions & 1 deletion lib/ace/mode/_test/tokens_yaml.json
Expand Up @@ -97,6 +97,11 @@
["keyword",":"],
["text"," "],
["constant.numeric","1"]
],[
"start",
["meta.tag"," version"],
["keyword",":"],
["text"," 1.2.3.4"]
],[
"start"
],[
Expand Down Expand Up @@ -124,7 +129,7 @@
["indent"," "],
["meta.tag","ref-id"],
["keyword",":"],
["text"," id123"]
["text"," id123 "]
],[
"start",
["meta.tag"," city"],
Expand Down
2 changes: 1 addition & 1 deletion lib/ace/mode/yaml_highlight_rules.js
Expand Up @@ -100,7 +100,7 @@ var YamlHighlightRules = function() {
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric", // float
regex : /(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)/
regex : /(\b|[+\-\.])[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)(?=[^\d-\w]|$)$/
}, {
token : "constant.numeric", // other number
regex : /[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/
Expand Down

0 comments on commit 915fcaf

Please sign in to comment.