Example #1
0
        public override ITreeRange Format(ITreeNode firstElement, ITreeNode lastElement, CodeFormatProfile profile,
                                          AdditionalFormatterParameters parameters = null)
        {
            parameters ??= AdditionalFormatterParameters.Empty;
            var task = new FormatTask(firstElement, lastElement, profile);

            task.Adjust(this);
            if (task.FirstElement == null)
            {
                return(new TreeRange(firstElement, lastElement));
            }

            if (!firstElement.FSharpFormatterEnabled())
            {
                return(new TreeRange(firstElement, lastElement));
            }

            var formatterSettings = GetFormattingSettings(task.FirstElement, parameters, myFormatterInfoProvider);

            DoDeclarativeFormat(formatterSettings, myFormatterInfoProvider, null, new[] { task },
                                parameters, null, null, null, false);

            return(new TreeRange(firstElement, lastElement));
        }