static dynamic ToMonacoCompletionItems(XCB.ScriptContext context, CompletionModel model)
        {
            dynamic arr = context.CreateArray();

            var filteredCompletions = model?.FilteredItems;

            if (filteredCompletions == null || filteredCompletions.Count == 0)
            {
                return(arr);
            }

            foreach (var completion in filteredCompletions)
            {
                if (completion.Span.End > model.Text.Length)
                {
                    continue;
                }

                var displayText = completion.ToString();

                // Check for the property added by the internal SymbolCompletionItem helper
                string insertionText;
                completion.Properties.TryGetValue("InsertionText", out insertionText);

                // Check for the property added by us during filtering
                string itemDetail;
                completion.Properties.TryGetValue(itemDetailPropertyName, out itemDetail);

                arr.push(context.CreateObject(o => {
                    o.label = displayText;
                    if (itemDetail != null)
                    {
                        o.detail = itemDetail;
                    }
                    if (insertionText != null)
                    {
                        o.insertText = insertionText;
                    }
                    o.kind = MonacoExtensions.ToMonacoCompletionItemKind(completion.Tags);
                }));
            }

            return(arr);
        }
Beispiel #2
0
 dynamic ProvideCompletionItems(dynamic self, dynamic args)
 => ProvideCompletionItems(
     args [0].id.ToString(),
     MonacoExtensions.FromMonacoPosition(args [1]),
     MonacoExtensions.FromMonacoCancellationToken(args [2]));
Beispiel #3
0
 dynamic ProvideSignatureHelp(dynamic self, dynamic args)
 => ProvideSignatureHelp(
     args [0].id.ToString(),
     MonacoExtensions.FromMonacoPosition(args [1]),
     MonacoExtensions.FromMonacoCancellationToken(args [2]));