mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52:56 +01:00
Merge pull request #143 from nathanrreed/main
fix c++ comment continuation highlighting #2497
This commit is contained in:
commit
96183b6e44
2 changed files with 33 additions and 0 deletions
|
|
@ -950,5 +950,30 @@ testTokenization('cpp', [
|
||||||
{ startIndex: 22, type: 'keyword.directive.include.end.cpp' }
|
{ startIndex: 22, type: 'keyword.directive.include.end.cpp' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
// microsoft/monaco-editor#2497 : comment continuation highlighting
|
||||||
|
{
|
||||||
|
line: '// this is a comment \\',
|
||||||
|
tokens: [{ startIndex: 0, type: 'comment.cpp' }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line: 'this is still a comment',
|
||||||
|
tokens: [{ startIndex: 0, type: 'comment.cpp' }]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
line: 'int x = 1;',
|
||||||
|
tokens: [
|
||||||
|
{ startIndex: 0, type: 'keyword.int.cpp' },
|
||||||
|
{ startIndex: 3, type: '' },
|
||||||
|
{ startIndex: 4, type: 'identifier.cpp' },
|
||||||
|
{ startIndex: 5, type: '' },
|
||||||
|
{ startIndex: 6, type: 'delimiter.cpp' },
|
||||||
|
{ startIndex: 7, type: '' },
|
||||||
|
{ startIndex: 8, type: 'number.cpp' },
|
||||||
|
{ startIndex: 9, type: 'delimiter.cpp' }
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -347,6 +347,7 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
[/[ \t\r\n]+/, ''],
|
[/[ \t\r\n]+/, ''],
|
||||||
[/\/\*\*(?!\/)/, 'comment.doc', '@doccomment'],
|
[/\/\*\*(?!\/)/, 'comment.doc', '@doccomment'],
|
||||||
[/\/\*/, 'comment', '@comment'],
|
[/\/\*/, 'comment', '@comment'],
|
||||||
|
[/\/\/.*\\$/, 'comment', '@linecomment'],
|
||||||
[/\/\/.*$/, 'comment']
|
[/\/\/.*$/, 'comment']
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -355,6 +356,13 @@ export const language = <languages.IMonarchLanguage>{
|
||||||
[/\*\//, 'comment', '@pop'],
|
[/\*\//, 'comment', '@pop'],
|
||||||
[/[\/*]/, 'comment']
|
[/[\/*]/, 'comment']
|
||||||
],
|
],
|
||||||
|
|
||||||
|
//For use with continuous line comments
|
||||||
|
linecomment: [
|
||||||
|
[/.*[^\\]$/, 'comment', '@pop'],
|
||||||
|
[/[^]+/, 'comment']
|
||||||
|
],
|
||||||
|
|
||||||
//Identical copy of comment above, except for the addition of .doc
|
//Identical copy of comment above, except for the addition of .doc
|
||||||
doccomment: [
|
doccomment: [
|
||||||
[/[^\/*]+/, 'comment.doc'],
|
[/[^\/*]+/, 'comment.doc'],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue