From cf85c0785a926dc99243b62ce0e032507fcd5db1 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 13 Nov 2018 19:39:07 +0100 Subject: [PATCH] Fixes #1180 --- ...ing-language-services-completion-provider-example.html | 8 ++++---- .../completion-provider-example/sample.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/playground.generated/extending-language-services-completion-provider-example.html b/test/playground.generated/extending-language-services-completion-provider-example.html index 793fb67b..97976a1b 100644 --- a/test/playground.generated/extending-language-services-completion-provider-example.html +++ b/test/playground.generated/extending-language-services-completion-provider-example.html @@ -67,10 +67,10 @@ monaco.languages.registerCompletionItemProvider('json', { // find out if we are completing a property in the 'dependencies' object. var textUntilPosition = model.getValueInRange({startLineNumber: 1, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column}); var match = textUntilPosition.match(/"dependencies"\s*:\s*{\s*("[^"]*"\s*:\s*"[^"]*"\s*,\s*)*("[^"]*)?$/); - if (match) { - return createDependencyProposals(); - } - return []; + var suggestions = match ? createDependencyProposals() : []; + return { + suggestions: suggestions + }; } }); diff --git a/website/playground/new-samples/extending-language-services/completion-provider-example/sample.js b/website/playground/new-samples/extending-language-services/completion-provider-example/sample.js index 5a5a2017..dfa4d030 100644 --- a/website/playground/new-samples/extending-language-services/completion-provider-example/sample.js +++ b/website/playground/new-samples/extending-language-services/completion-provider-example/sample.js @@ -29,10 +29,10 @@ monaco.languages.registerCompletionItemProvider('json', { // find out if we are completing a property in the 'dependencies' object. var textUntilPosition = model.getValueInRange({startLineNumber: 1, startColumn: 1, endLineNumber: position.lineNumber, endColumn: position.column}); var match = textUntilPosition.match(/"dependencies"\s*:\s*{\s*("[^"]*"\s*:\s*"[^"]*"\s*,\s*)*("[^"]*)?$/); - if (match) { - return createDependencyProposals(); - } - return []; + var suggestions = match ? createDependencyProposals() : []; + return { + suggestions: suggestions + }; } });