mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52:56 +01:00
Fix values mixed with comments
This commit is contained in:
parent
30a786cf5f
commit
c7ce77ba18
2 changed files with 111 additions and 1 deletions
|
|
@ -458,6 +458,7 @@ testTokenization('yaml', [
|
||||||
{ startIndex: 4, type: 'operators.yaml' },
|
{ startIndex: 4, type: 'operators.yaml' },
|
||||||
{ startIndex: 5, type: 'white.yaml' },
|
{ startIndex: 5, type: 'white.yaml' },
|
||||||
{ startIndex: 6, type: 'string.yaml' },
|
{ startIndex: 6, type: 'string.yaml' },
|
||||||
|
{ startIndex: 28, type: 'white.yaml' },
|
||||||
{ startIndex: 29, type: 'comment.yaml' }
|
{ startIndex: 29, type: 'comment.yaml' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -470,6 +471,7 @@ testTokenization('yaml', [
|
||||||
{ startIndex: 6, type: 'operators.yaml' },
|
{ startIndex: 6, type: 'operators.yaml' },
|
||||||
{ startIndex: 7, type: 'white.yaml' },
|
{ startIndex: 7, type: 'white.yaml' },
|
||||||
{ startIndex: 8, type: 'string.yaml' },
|
{ startIndex: 8, type: 'string.yaml' },
|
||||||
|
{ startIndex: 9, type: 'white.yaml' },
|
||||||
{ startIndex: 10, type: 'comment.yaml' }
|
{ startIndex: 10, type: 'comment.yaml' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -523,5 +525,113 @@ testTokenization('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'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// '#' 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 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'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// Comment following Value
|
||||||
|
[
|
||||||
|
{
|
||||||
|
line: 'key: value #comment',
|
||||||
|
tokens: [
|
||||||
|
{
|
||||||
|
startIndex: 0,
|
||||||
|
type: 'type.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 3,
|
||||||
|
type: 'operators.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 4,
|
||||||
|
type: 'white.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 5,
|
||||||
|
type: 'string.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 10,
|
||||||
|
type: 'white.yaml'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
startIndex: 11,
|
||||||
|
type: 'comment.yaml'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
|
|
||||||
// String nodes
|
// String nodes
|
||||||
[
|
[
|
||||||
/[^#]+/,
|
/.+?(?=(\s+#|$))/,
|
||||||
{
|
{
|
||||||
cases: {
|
cases: {
|
||||||
'@keywords': 'keyword',
|
'@keywords': 'keyword',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue