Explorar el Código

Remove ES6 syntax from example

KapitanOczywisty hace 4 años
padre
commit
51fe304f01

+ 23 - 21
test/playground.generated/extending-language-services-semantic-tokens-provider-example.html

@@ -149,25 +149,27 @@ monaco.editor.defineTheme('myCustomTheme', {
 });
 
 const editor = monaco.editor.create(document.getElementById("container"), {
-    value: `Available token types:
-    [comment] [string] [keyword] [number] [regexp] [operator] [namespace]
-    [type] [struct] [class] [interface] [enum] [typeParameter] [function]
-    [member] [macro] [variable] [parameter] [property] [label]
-
-Available token modifiers:
-    [type.declaration] [type.documentation] [type.member] [type.static]
-    [type.abstract] [type.deprecated] [type.modification] [type.async]
-
-Some examples:
-    [class.static.token]     [type.static.abstract]
-    [class.static.token]     [type.static]
-
-    [struct]
-
-    [function.private]
-
-An error case:
-    [notInLegend]`,
+    value: [
+        'Available token types:',
+        '    [comment] [string] [keyword] [number] [regexp] [operator] [namespace]',
+        '    [type] [struct] [class] [interface] [enum] [typeParameter] [function]',
+        '    [member] [macro] [variable] [parameter] [property] [label]',
+        '',
+        'Available token modifiers:',
+        '    [type.declaration] [type.documentation] [type.member] [type.static]',
+        '    [type.abstract] [type.deprecated] [type.modification] [type.async]',
+        '',
+        'Some examples:',
+        '    [class.static.token]     [type.static.abstract]',
+        '    [class.static.token]     [type.static]',
+        '',
+        '    [struct]',
+        '',
+        '    [function.private]',
+        '',
+        'An error case:',
+        '    [notInLegend]'
+    ].join('\n'),
     language: "plaintext",
     theme: 'myCustomTheme',
     // semantic tokens provider is disabled by default
@@ -176,9 +178,9 @@ An error case:
 
 // currently there isn't builtin token handling
 editor._themeService._knownThemes.forEach(function (theme) {
-    theme.getTokenStyleMetadata = (type, modifiers) => {
+    theme.getTokenStyleMetadata = function (type, modifiers) {
         // use theme rules match
-        const style = theme._tokenTheme._root.match([type, ...modifiers].join('.'));
+        const style = theme._tokenTheme._root.match([type].concat(modifiers).join('.'));
         return {
             foreground: style._foreground,
             italic: style._fontStyle & 1,

+ 23 - 21
website/playground/new-samples/extending-language-services/semantic-tokens-provider-example/sample.js

@@ -112,25 +112,27 @@ monaco.editor.defineTheme('myCustomTheme', {
 });
 
 const editor = monaco.editor.create(document.getElementById("container"), {
-    value: `Available token types:
-    [comment] [string] [keyword] [number] [regexp] [operator] [namespace]
-    [type] [struct] [class] [interface] [enum] [typeParameter] [function]
-    [member] [macro] [variable] [parameter] [property] [label]
-
-Available token modifiers:
-    [type.declaration] [type.documentation] [type.member] [type.static]
-    [type.abstract] [type.deprecated] [type.modification] [type.async]
-
-Some examples:
-    [class.static.token]     [type.static.abstract]
-    [class.static.token]     [type.static]
-
-    [struct]
-
-    [function.private]
-
-An error case:
-    [notInLegend]`,
+    value: [
+        'Available token types:',
+        '    [comment] [string] [keyword] [number] [regexp] [operator] [namespace]',
+        '    [type] [struct] [class] [interface] [enum] [typeParameter] [function]',
+        '    [member] [macro] [variable] [parameter] [property] [label]',
+        '',
+        'Available token modifiers:',
+        '    [type.declaration] [type.documentation] [type.member] [type.static]',
+        '    [type.abstract] [type.deprecated] [type.modification] [type.async]',
+        '',
+        'Some examples:',
+        '    [class.static.token]     [type.static.abstract]',
+        '    [class.static.token]     [type.static]',
+        '',
+        '    [struct]',
+        '',
+        '    [function.private]',
+        '',
+        'An error case:',
+        '    [notInLegend]'
+    ].join('\n'),
     language: "plaintext",
     theme: 'myCustomTheme',
     // semantic tokens provider is disabled by default
@@ -139,9 +141,9 @@ An error case:
 
 // currently there isn't builtin token handling
 editor._themeService._knownThemes.forEach(function (theme) {
-    theme.getTokenStyleMetadata = (type, modifiers) => {
+    theme.getTokenStyleMetadata = function (type, modifiers) {
         // use theme rules match
-        const style = theme._tokenTheme._root.match([type, ...modifiers].join('.'));
+        const style = theme._tokenTheme._root.match([type].concat(modifiers).join('.'));
         return {
             foreground: style._foreground,
             italic: style._fontStyle & 1,