mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 20:52:56 +01:00
Fix microsoft/monaco-editor#858 C++ includes
This commit is contained in:
parent
7195ea606e
commit
7eb290dff4
2 changed files with 15 additions and 6 deletions
|
|
@ -391,17 +391,19 @@ testTokenization('cpp', [
|
||||||
[{
|
[{
|
||||||
line: '#include<iostream>',
|
line: '#include<iostream>',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: 'keyword.cpp' },
|
{ startIndex: 0, type: 'keyword.directive.include.cpp' },
|
||||||
{ startIndex: 8, type: 'delimiter.angle.cpp' },
|
{ startIndex: 8, type: 'keyword.directive.include.begin.cpp' },
|
||||||
{ startIndex: 9, type: 'identifier.cpp' },
|
{ startIndex: 9, type: 'string.include.identifier.cpp' },
|
||||||
{ startIndex: 17, type: 'delimiter.angle.cpp' }
|
{ startIndex: 17, type: 'keyword.directive.include.end.cpp' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '#include "/path/to/my/file.h"',
|
line: '#include "/path/to/my/file.h"',
|
||||||
tokens: [
|
tokens: [
|
||||||
{ startIndex: 0, type: 'keyword.cpp' },
|
{ startIndex: 0, type: 'keyword.directive.include.cpp' },
|
||||||
{ startIndex: 8, type: '' },
|
{ startIndex: 8, type: '' },
|
||||||
{ startIndex: 9, type: 'string.cpp' }
|
{ startIndex: 9, type: 'keyword.directive.include.begin.cpp' },
|
||||||
|
{ startIndex: 10, type: 'string.include.identifier.cpp' },
|
||||||
|
{ startIndex: 28, type: 'keyword.directive.include.end.cpp' }
|
||||||
]
|
]
|
||||||
}, {
|
}, {
|
||||||
line: '',
|
line: '',
|
||||||
|
|
|
||||||
|
|
@ -268,6 +268,8 @@ export const language = <ILanguage>{
|
||||||
// [[ attributes ]].
|
// [[ attributes ]].
|
||||||
[/\[\[.*\]\]/, 'annotation'],
|
[/\[\[.*\]\]/, 'annotation'],
|
||||||
|
|
||||||
|
[/^\s*#include/, { token: 'keyword.directive.include', next: '@include' }],
|
||||||
|
|
||||||
// Preprocessor directive
|
// Preprocessor directive
|
||||||
[/^\s*#\s*\w+/, 'keyword'],
|
[/^\s*#\s*\w+/, 'keyword'],
|
||||||
|
|
||||||
|
|
@ -338,6 +340,11 @@ export const language = <ILanguage>{
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[/.*/, 'string.raw']
|
[/.*/, 'string.raw']
|
||||||
|
],
|
||||||
|
|
||||||
|
include: [
|
||||||
|
[/(\s*)(<)([^<>]*)(>)/, ['', 'keyword.directive.include.begin', 'string.include.identifier', { token: 'keyword.directive.include.end', next: '@pop'}]],
|
||||||
|
[/(\s*)(")([^"]*)(")/, ['', 'keyword.directive.include.begin', 'string.include.identifier', { token: 'keyword.directive.include.end', next: '@pop'}]]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue