Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 518685 - [lsp] Orion assumes that textDocument/completion request…
…s will always return a CompletionList

As textDocument/completion responses from the server can come in the
form of a CompletionList or a CompletionItem[], we should check which
type has been returned instead of assuming that it is a
CompletionList.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
  • Loading branch information
rcjsuen committed Jun 23, 2017
1 parent 7916a21 commit d2d8a94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bundles/org.eclipse.orion.client.ui/web/orion/lsp/utils.js
Expand Up @@ -241,7 +241,11 @@ define([
return editorContext.getFileMetadata().then(function(meta) {
return getEditorContextPosition(editorContext, args.selection.start).then(function(position) {
return provider.completion(meta.location, position).then(function(results) {
var items = results.items;
// textDocument/completion requests may return a CompletionItem[] or a CompletionList
var items = results;
if (results.items) {
items = results.items;
}
if (Array.isArray(items) && items.length > 0) {
return Deferred.all(resolveCompletionItems(provider, editorContext, items)).then(function(proposals) {
return new Deferred().resolve(proposals);
Expand Down

0 comments on commit d2d8a94

Please sign in to comment.