コード例 #1
0
        private void WriteSignatureDocumentation(
            IFastJsonWriter writer,
            SignatureHelpItemData selectedItem,
            SignatureHelpParameterData?selectedParameter,
            CancellationToken cancellationToken
            )
        {
            writer.WritePropertyStartObject("info");
            writer.WritePropertyStartArray("parts");
            var documentation = selectedItem.DocumentationFactory(cancellationToken);

            writer.WriteTaggedTexts(documentation);
            writer.WriteEndArray();

            if (selectedParameter == null)
            {
                writer.WriteEndObject();
                return;
            }

            writer.WritePropertyStartObject("parameter");
            writer.WriteProperty("name", selectedParameter.Name);

            writer.WritePropertyStartArray("parts");
            var parameterDocumentation = selectedParameter.DocumentationFactory(cancellationToken);

            writer.WriteTaggedTexts(parameterDocumentation);
            writer.WriteEndArray();

            writer.WriteEndObject();
            writer.WriteEndObject();
        }
コード例 #2
0
        private void WriteSignatureParts(
            IFastJsonWriter writer,
            SignatureHelpItemData item,
            SignatureHelpItemsData items,
            out SignatureHelpParameterData?selectedParameter
            )
        {
            selectedParameter = null;
            writer.WritePropertyStartArray("parts");
            writer.WriteTaggedTexts(item.PrefixDisplayParts);
            var parameterIndex = 0;

            foreach (var parameter in item.Parameters)
            {
                if (parameterIndex > 0)
                {
                    writer.WriteTaggedTexts(item.SeparatorDisplayParts);
                }
                var selected = items.ArgumentIndex == parameterIndex;
                writer.WriteTaggedTexts(parameter.PrefixDisplayParts, selected);
                writer.WriteTaggedTexts(parameter.DisplayParts, selected);
                writer.WriteTaggedTexts(parameter.SuffixDisplayParts, selected);
                if (selected)
                {
                    selectedParameter = parameter;
                }
                parameterIndex += 1;
            }
            writer.WriteTaggedTexts(item.SuffixDisplayParts);
            writer.WriteEndArray();
        }