public async Task RazorCSharpFormattingAsync()
        {
            var options = new FormattingOptions()
            {
                TabSize      = 4,
                InsertSpaces = true
            };

            var range = TextSpan.FromBounds(0, DocumentText.Length).AsRange(DocumentText);
            var edits = await RazorFormattingService.FormatAsync(DocumentUri, DocumentSnapshot, range, options, CancellationToken.None);

#if DEBUG
            // For debugging purposes only.
            var changedText = DocumentText.WithChanges(edits.Select(e => e.AsTextChange(DocumentText)));
            _ = changedText.ToString();
#endif
        }
Exemple #2
0
        public async Task RazorCSharpFormattingAsync()
        {
            var options = new FormattingOptions()
            {
                TabSize      = 4,
                InsertSpaces = true
            };

            var useSourceTextDiffer = DifferType != DifferType.GetTextChanges;

            options["UseSourceTextDiffer"] = new OmniSharp.Extensions.LanguageServer.Protocol.Models.BooleanNumberString(useSourceTextDiffer);

            var range = TextSpan.FromBounds(0, DocumentText.Length).AsRange(DocumentText);
            var edits = await RazorFormattingService.FormatAsync(DocumentUri, DocumentSnapshot, range, options, CancellationToken.None);

#if DEBUG
            // For debugging purposes only.
            var changedText = DocumentText.WithChanges(edits.Select(e => e.AsTextChange(DocumentText)));
            _ = changedText.ToString();
#endif
        }