Преглед изворни кода

Update custom-languages playground sample to use SnippetString

Sam El-Husseini пре 8 година
родитељ
комит
8176a1a607

+ 12 - 8
website/playground/new-samples/extending-language-services/custom-languages/sample.js

@@ -35,18 +35,22 @@ monaco.languages.registerCompletionItemProvider('mySpecialLanguage', {
 			}, {
 				label: 'testing',
 				kind: monaco.languages.CompletionItemKind.Keyword,
-				insertText:'testing({{condition}})'
+				insertText: {
+					value: 'testing(${1:condition})'
+				}
 			},
 			{
 				label: 'ifelse',
 				kind: monaco.languages.CompletionItemKind.Snippet,
-				insertText: [
-					'if ({{condition}}) {',
-					'\t{{}}',
-					'} else {',
-					'\t',
-					'}'
-				].join('\n'),
+				insertText: {
+					value: [
+						'if (${1:condition}) {',
+						'\t$0',
+						'} else {',
+						'\t',
+						'}'
+					].join('\n')
+				},
 				documentation: 'If-Else Statement'
 			}
 		]