public Indenter(
                AbstractIndentationService <TSyntaxRoot> service,
                SyntacticDocument document,
                IEnumerable <AbstractFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                Document = document;

                this._service          = service;
                this._syntaxFacts      = document.Document.GetLanguageService <ISyntaxFactsService>();
                this.OptionSet         = optionSet;
                this.Root              = (TSyntaxRoot)document.Root;
                this.LineToBeIndented  = lineToBeIndented;
                this._tabSize          = this.OptionSet.GetOption(FormattingOptions.TabSize, Root.Language);
                this.CancellationToken = cancellationToken;

                this.Rules  = rules;
                this.Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, OptionSet),
                    this._tabSize,
                    this.OptionSet.GetOption(FormattingOptions.IndentationSize, Root.Language),
                    tokenStream: null);
            }
            public Indenter(
                AbstractIndentationService <TSyntaxRoot> service,
                SyntacticDocument document,
                IEnumerable <AbstractFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                Document = document;

                _service          = service;
                _syntaxFacts      = document.Document.GetRequiredLanguageService <ISyntaxFactsService>();
                OptionSet         = optionSet;
                OptionService     = document.Document.Project.Solution.Workspace.Services.GetRequiredService <IOptionService>();
                Root              = (TSyntaxRoot)document.Root;
                LineToBeIndented  = lineToBeIndented;
                _tabSize          = this.OptionSet.GetOption(FormattingOptions.TabSize, Root.Language);
                CancellationToken = cancellationToken;

                Rules  = rules;
                Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, OptionSet.AsAnalyzerConfigOptions(OptionService, Root.Language)),
                    _tabSize,
                    this.OptionSet.GetOption(FormattingOptions.IndentationSize, Root.Language),
                    tokenStream: null,
                    _syntaxFacts);
            }
Пример #3
0
            public Indenter(
                AbstractIndentationService <TSyntaxRoot> service,
                SyntacticDocument document,
                IEnumerable <AbstractFormattingRule> rules,
                IndentationOptions options,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                Document = document;

                _service          = service;
                _syntaxFacts      = document.Document.GetRequiredLanguageService <ISyntaxFactsService>();
                Options           = options;
                Root              = (TSyntaxRoot)document.Root;
                LineToBeIndented  = lineToBeIndented;
                _tabSize          = options.FormattingOptions.TabSize;
                CancellationToken = cancellationToken;

                Rules  = rules;
                Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, options.FormattingOptions),
                    _tabSize,
                    options.FormattingOptions.IndentationSize,
                    tokenStream: null,
                    document.Document.GetRequiredLanguageService <IHeaderFactsService>());
            }