Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correctly tokenize YAML meta tags with non alphabetical characters after multiline string #4706

Merged
merged 2 commits into from
May 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ace/mode/_test/text_yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bill-to: &id001
street: |
123 Tornado Alley
Suite 16
ref-id: id123
city: East Centerville
state: KS

Expand Down
7 changes: 6 additions & 1 deletion lib/ace/mode/_test/tokens_yaml.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@
],[
"start",
["indent"," "],
["meta.tag","city"],
["meta.tag","ref-id"],
["keyword",":"],
["text"," id123"]
],[
"start",
["meta.tag"," city"],
["keyword",":"],
["text"," East Centerville"]
],[
Expand Down
4 changes: 2 additions & 2 deletions lib/ace/mode/yaml_highlight_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ var YamlHighlightRules = function() {
regex: "[&\\*][a-zA-Z0-9-_]+"
}, {
token: ["meta.tag", "keyword"],
regex: /^(\s*\w.*?)(:(?=\s|$))/
regex: /^(\s*\w[^\s:]*?)(:(?=\s|$))/
},{
token: ["meta.tag", "keyword"],
regex: /(\w+?)(\s*:(?=\s|$))/
regex: /(\w[^\s:]*?)(\s*:(?=\s|$))/
}, {
token : "keyword.operator",
regex : "<<\\w*:\\w*"
Expand Down