/// <summary>
        /// Creates new foldings and updates a <see cref="FoldingManager"/> with them.
        /// </summary>
        public static IEnumerable <NewFolding> GenerateFoldings(this FoldingManager manager, TextDocument document, IFoldingStrategy strategy)
        {
            int firstErrorOffset;
            var newFoldings = strategy.CreateNewFoldings(document, out firstErrorOffset).ToList();

            manager.UpdateFoldings(newFoldings);
            return(newFoldings);
        }