mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 12:45:39 +01:00
Fix incorrect key:value detection
This commit is contained in:
parent
ae158a2524
commit
30a786cf5f
2 changed files with 51 additions and 1 deletions
|
|
@ -473,5 +473,55 @@ testTokenization('yaml', [
|
||||||
{ startIndex: 10, type: 'comment.yaml' }
|
{ startIndex: 10, type: 'comment.yaml' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// ': ' in double-quoted Value
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'key: "va: lue"',
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
startIndex: 0,
|
||||||
|
type: 'type.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 3,
|
||||||
|
type: 'operators.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 4,
|
||||||
|
type: 'white.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 5,
|
||||||
|
type: 'string.yaml'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// ': ' in single-quoted Value
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: "key: 'va: lue'",
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
startIndex: 0,
|
||||||
|
type: 'type.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 3,
|
||||||
|
type: 'operators.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 4,
|
||||||
|
type: 'white.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 5,
|
||||||
|
type: 'string.yaml'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
[/@numberDate(?![ \t]*\S+)/, 'number.date'],
|
[/@numberDate(?![ \t]*\S+)/, 'number.date'],
|
||||||
|
|
||||||
// Key:Value pair
|
// Key:Value pair
|
||||||
[/(".*?"|'.*?'|.*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
|
[/(".*?"|'.*?'|[^'"]*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
|
||||||
|
|
||||||
{ include: '@flowScalars' },
|
{ include: '@flowScalars' },
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue