Add CompletionItem with snippet support to the example

Many users are asking about snippet support in Monaco. Enhancing the
example on in the playground with a snippet CompletionItem will help
users learn about the feature more easily without having to dig through
Stack Overflow and GitHub issues.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
pull/1703/head
Remy Suen 2019-12-13 08:41:19 -05:00
parent 5b7c0c4bbb
commit 3a3d0106b6
2 changed files with 14 additions and 0 deletions

View File

@ -57,6 +57,13 @@ function createDependencyProposals() {
kind: monaco.languages.CompletionItemKind.Function,
documentation: "Recursively mkdir, like <code>mkdir -p</code>",
insertText: '"mkdirp": "*"'
},
{
label: '"my-third-party-library"',
kind: monaco.languages.CompletionItemKind.Function,
documentation: "Describe your library here",
insertText: '"${1:my-third-party-library}": "${2:1.2.3}"',
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
}
];
}

View File

@ -19,6 +19,13 @@ function createDependencyProposals() {
kind: monaco.languages.CompletionItemKind.Function,
documentation: "Recursively mkdir, like <code>mkdir -p</code>",
insertText: '"mkdirp": "*"'
},
{
label: '"my-third-party-library"',
kind: monaco.languages.CompletionItemKind.Function,
documentation: "Describe your library here",
insertText: '"${1:my-third-party-library}": "${2:1.2.3}"',
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
}
];
}