mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Merge branch 'main' into mdx
This commit is contained in:
commit
181f03ecce
421 changed files with 190953 additions and 358509 deletions
|
|
@ -197,6 +197,9 @@ export const language = <languages.IMonarchLanguage>{
|
|||
'__m256',
|
||||
'__m256d',
|
||||
'__m256i',
|
||||
'__m512',
|
||||
'__m512d',
|
||||
'__m512i',
|
||||
'__m64',
|
||||
'__multiple_inheritance',
|
||||
'__newslot',
|
||||
|
|
@ -272,7 +275,7 @@ export const language = <languages.IMonarchLanguage>{
|
|||
|
||||
// we include these common regular expressions
|
||||
symbols: /[=><!~?:&|+\-*\/\^%]+/,
|
||||
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
||||
escapes: /\\(?:[0abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
||||
integersuffix: /([uU](ll|LL|l|L)|(ll|LL|l|L)?[uU]?)/,
|
||||
floatsuffix: /[fFlL]?/,
|
||||
encoding: /u|u8|U|L/,
|
||||
|
|
|
|||
|
|
@ -383,5 +383,32 @@ testTokenization('elixir', [
|
|||
{ startIndex: 15, type: 'delimiter.square.elixir' }
|
||||
]
|
||||
}
|
||||
],
|
||||
// Bitstrings
|
||||
[
|
||||
{
|
||||
line: '<<height::32-integer, width::32-integer, data::binary>>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'delimiter.angle.special.elixir' },
|
||||
{ startIndex: 2, type: 'identifier.elixir' },
|
||||
{ startIndex: 8, type: 'operator.elixir' },
|
||||
{ startIndex: 10, type: 'number.elixir' },
|
||||
{ startIndex: 12, type: 'operator.elixir' },
|
||||
{ startIndex: 13, type: 'identifier.elixir' },
|
||||
{ startIndex: 20, type: 'punctuation.elixir' },
|
||||
{ startIndex: 21, type: 'white.elixir' },
|
||||
{ startIndex: 22, type: 'identifier.elixir' },
|
||||
{ startIndex: 27, type: 'operator.elixir' },
|
||||
{ startIndex: 29, type: 'number.elixir' },
|
||||
{ startIndex: 31, type: 'operator.elixir' },
|
||||
{ startIndex: 32, type: 'identifier.elixir' },
|
||||
{ startIndex: 39, type: 'punctuation.elixir' },
|
||||
{ startIndex: 40, type: 'white.elixir' },
|
||||
{ startIndex: 41, type: 'identifier.elixir' },
|
||||
{ startIndex: 45, type: 'operator.elixir' },
|
||||
{ startIndex: 47, type: 'identifier.elixir' },
|
||||
{ startIndex: 53, type: 'delimiter.angle.special.elixir' }
|
||||
]
|
||||
}
|
||||
]
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export const language = <languages.IMonarchLanguage>{
|
|||
// Keyword list shorthand
|
||||
|
||||
keywordsShorthand: [
|
||||
[/(@atomName)(:)/, ['constant', 'constant.punctuation']],
|
||||
[/(@atomName)(:)(\s+)/, ['constant', 'constant.punctuation', 'white']],
|
||||
// Use positive look-ahead to ensure the string is followed by :
|
||||
// and should be considered a keyword.
|
||||
[
|
||||
|
|
@ -532,6 +532,13 @@ export const language = <languages.IMonarchLanguage>{
|
|||
next: '@doubleQuotedHeredocDocstring'
|
||||
}
|
||||
],
|
||||
[
|
||||
/\@(module|type)?doc (~[sS])?'''/,
|
||||
{
|
||||
token: 'comment.block.documentation',
|
||||
next: '@singleQuotedHeredocDocstring'
|
||||
}
|
||||
],
|
||||
[
|
||||
/\@(module|type)?doc (~[sS])?"/,
|
||||
{
|
||||
|
|
@ -539,6 +546,13 @@ export const language = <languages.IMonarchLanguage>{
|
|||
next: '@doubleQuotedStringDocstring'
|
||||
}
|
||||
],
|
||||
[
|
||||
/\@(module|type)?doc (~[sS])?'/,
|
||||
{
|
||||
token: 'comment.block.documentation',
|
||||
next: '@singleQuotedStringDocstring'
|
||||
}
|
||||
],
|
||||
[/\@(module|type)?doc false/, 'comment.block.documentation'],
|
||||
// Module attributes
|
||||
[/\@(@variableName)/, 'variable']
|
||||
|
|
@ -549,11 +563,21 @@ export const language = <languages.IMonarchLanguage>{
|
|||
{ include: '@docstringContent' }
|
||||
],
|
||||
|
||||
singleQuotedHeredocDocstring: [
|
||||
[/'''/, { token: 'comment.block.documentation', next: '@pop' }],
|
||||
{ include: '@docstringContent' }
|
||||
],
|
||||
|
||||
doubleQuotedStringDocstring: [
|
||||
[/"/, { token: 'comment.block.documentation', next: '@pop' }],
|
||||
{ include: '@docstringContent' }
|
||||
],
|
||||
|
||||
singleQuotedStringDocstring: [
|
||||
[/'/, { token: 'comment.block.documentation', next: '@pop' }],
|
||||
{ include: '@docstringContent' }
|
||||
],
|
||||
|
||||
// Operators, punctuation, brackets
|
||||
|
||||
symbols: [
|
||||
|
|
|
|||
|
|
@ -396,6 +396,32 @@ testTokenization(
|
|||
}
|
||||
],
|
||||
|
||||
// Embedded Content #10
|
||||
[
|
||||
{
|
||||
line: '<script type="module">var i= 10;</script>',
|
||||
tokens: [
|
||||
{ startIndex: 0, type: 'delimiter.html' },
|
||||
{ startIndex: 1, type: 'tag.html' },
|
||||
{ startIndex: 7, type: '' },
|
||||
{ startIndex: 8, type: 'attribute.name.html' },
|
||||
{ startIndex: 12, type: 'delimiter.html' },
|
||||
{ startIndex: 13, type: 'attribute.value.html' },
|
||||
{ startIndex: 21, type: 'delimiter.html' },
|
||||
{ startIndex: 22, type: 'keyword.js' },
|
||||
{ startIndex: 25, type: '' },
|
||||
{ startIndex: 26, type: 'identifier.js' },
|
||||
{ startIndex: 27, type: 'delimiter.js' },
|
||||
{ startIndex: 28, type: '' },
|
||||
{ startIndex: 29, type: 'number.js' },
|
||||
{ startIndex: 31, type: 'delimiter.js' },
|
||||
{ startIndex: 32, type: 'delimiter.html' },
|
||||
{ startIndex: 34, type: 'tag.html' },
|
||||
{ startIndex: 40, type: 'delimiter.html' }
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
// Tag with Attribute
|
||||
[
|
||||
{
|
||||
|
|
|
|||
|
|
@ -160,6 +160,20 @@ export const language = <languages.IMonarchLanguage>{
|
|||
|
||||
// After <script ... type =
|
||||
scriptAfterTypeEquals: [
|
||||
[
|
||||
/"module"/,
|
||||
{
|
||||
token: 'attribute.value',
|
||||
switchTo: '@scriptWithCustomType.text/javascript'
|
||||
}
|
||||
],
|
||||
[
|
||||
/'module'/,
|
||||
{
|
||||
token: 'attribute.value',
|
||||
switchTo: '@scriptWithCustomType.text/javascript'
|
||||
}
|
||||
],
|
||||
[
|
||||
/"([^"]*)"/,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ declare var require: any;
|
|||
|
||||
registerLanguage({
|
||||
id: 'kotlin',
|
||||
extensions: ['.kt'],
|
||||
extensions: ['.kt', '.kts'],
|
||||
aliases: ['Kotlin', 'kotlin'],
|
||||
mimetypes: ['text/x-kotlin-source', 'text/x-kotlin'],
|
||||
loader: () => {
|
||||
|
|
|
|||
|
|
@ -862,6 +862,7 @@ export const language = <languages.IMonarchLanguage>{
|
|||
[/"/, { token: 'string.double', next: '@stringDouble' }]
|
||||
],
|
||||
string: [
|
||||
[/\\'/, 'string'],
|
||||
[/[^']+/, 'string'],
|
||||
[/''/, 'string'],
|
||||
[/'/, { token: 'string', next: '@pop' }]
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ declare var require: any;
|
|||
|
||||
registerLanguage({
|
||||
id: 'perl',
|
||||
extensions: ['.pl'],
|
||||
extensions: ['.pl', '.pm'],
|
||||
aliases: ['Perl', 'pl'],
|
||||
loader: () => {
|
||||
if (AMD) {
|
||||
|
|
|
|||
|
|
@ -627,11 +627,15 @@ export const language = <languages.IMonarchLanguage>{
|
|||
'range_intersect_agg',
|
||||
'range_merge',
|
||||
'rank',
|
||||
'regexp_count',
|
||||
'regexp_instr',
|
||||
'regexp_like',
|
||||
'regexp_match',
|
||||
'regexp_matches',
|
||||
'regexp_replace',
|
||||
'regexp_split_to_array',
|
||||
'regexp_split_to_table',
|
||||
'regexp_substr',
|
||||
'regr_avgx',
|
||||
'regr_avgy',
|
||||
'regr_count',
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export const conf: languages.LanguageConfiguration = {
|
|||
onEnterRules: [
|
||||
{
|
||||
beforeText: new RegExp(
|
||||
'^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\\s*$'
|
||||
'^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async|match|case).*?:\\s*$'
|
||||
),
|
||||
action: { indentAction: languages.IndentAction.Indent }
|
||||
}
|
||||
|
|
@ -52,18 +52,21 @@ export const language = <languages.IMonarchLanguage>{
|
|||
|
||||
keywords: [
|
||||
// This section is the result of running
|
||||
// `for k in keyword.kwlist: print(' "' + k + '",')` in a Python REPL,
|
||||
// `import keyword; for k in sorted(keyword.kwlist + keyword.softkwlist): print(" '" + k + "',")`
|
||||
// in a Python REPL,
|
||||
// though note that the output from Python 3 is not a strict superset of the
|
||||
// output from Python 2.
|
||||
'False', // promoted to keyword.kwlist in Python 3
|
||||
'None', // promoted to keyword.kwlist in Python 3
|
||||
'True', // promoted to keyword.kwlist in Python 3
|
||||
'_', // new in Python 3.10
|
||||
'and',
|
||||
'as',
|
||||
'assert',
|
||||
'async', // new in Python 3
|
||||
'await', // new in Python 3
|
||||
'break',
|
||||
'case', // new in Python 3.10
|
||||
'class',
|
||||
'continue',
|
||||
'def',
|
||||
|
|
@ -81,6 +84,7 @@ export const language = <languages.IMonarchLanguage>{
|
|||
'in',
|
||||
'is',
|
||||
'lambda',
|
||||
'match', // new in Python 3.10
|
||||
'nonlocal', // new in Python 3
|
||||
'not',
|
||||
'or',
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ export const language = <languages.IMonarchLanguage>{
|
|||
'borrow',
|
||||
'using',
|
||||
'borrowing',
|
||||
'mutable'
|
||||
'mutable',
|
||||
'internal'
|
||||
],
|
||||
|
||||
typeKeywords: [
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ declare var require: any;
|
|||
|
||||
registerLanguage({
|
||||
id: 'typescript',
|
||||
extensions: ['.ts', '.tsx'],
|
||||
extensions: ['.ts', '.tsx', '.cts', '.mts'],
|
||||
aliases: ['TypeScript', 'ts', 'typescript'],
|
||||
mimetypes: ['text/typescript'],
|
||||
loader: (): Promise<any> => {
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ export const language = {
|
|||
'require',
|
||||
'global',
|
||||
'return',
|
||||
'satisfies',
|
||||
'set',
|
||||
'static',
|
||||
'string',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ registerLanguage({
|
|||
'.ascx',
|
||||
'.csproj',
|
||||
'.config',
|
||||
'.props',
|
||||
'.targets',
|
||||
'.wxi',
|
||||
'.wxl',
|
||||
'.wxs',
|
||||
|
|
|
|||
|
|
@ -458,6 +458,7 @@ testTokenization('yaml', [
|
|||
{ startIndex: 4, type: 'operators.yaml' },
|
||||
{ startIndex: 5, type: 'white.yaml' },
|
||||
{ startIndex: 6, type: 'string.yaml' },
|
||||
{ startIndex: 28, type: 'white.yaml' },
|
||||
{ startIndex: 29, type: 'comment.yaml' }
|
||||
]
|
||||
}
|
||||
|
|
@ -470,8 +471,200 @@ testTokenization('yaml', [
|
|||
{ startIndex: 6, type: 'operators.yaml' },
|
||||
{ startIndex: 7, type: 'white.yaml' },
|
||||
{ startIndex: 8, type: 'string.yaml' },
|
||||
{ startIndex: 9, type: 'white.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'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
// '#' 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'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
// ': ' in Comment following Value
|
||||
[
|
||||
{
|
||||
line: 'key: value #comment: also 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'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -86,13 +86,13 @@ export const language = <languages.IMonarchLanguage>{
|
|||
[/@numberDate(?![ \t]*\S+)/, 'number.date'],
|
||||
|
||||
// Key:Value pair
|
||||
[/(".*?"|'.*?'|.*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
|
||||
[/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/, ['type', 'white', 'operators', 'white']],
|
||||
|
||||
{ include: '@flowScalars' },
|
||||
|
||||
// String nodes
|
||||
[
|
||||
/[^#]+/,
|
||||
/.+?(?=(\s+#|$))/,
|
||||
{
|
||||
cases: {
|
||||
'@keywords': 'keyword',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue