public override ITreeRange Format( ITreeNode firstElement, ITreeNode lastElement, CodeFormatProfile profile, IProgressIndicator pi, IContextBoundSettingsStore overrideSettingsStore = null) { ITreeNode firstNode; ITreeNode lastNode; GetFirstAndLastNode(firstElement, lastElement, out firstNode, out lastNode); var contextBoundSettingsStore = this.GetProperContextBoundSettingsStore(overrideSettingsStore, firstNode); var globalSettings = GlobalFormatSettingsHelper .GetService(firstNode.GetSolution()) .GetSettingsForLanguage(this.myLanguage, firstNode.GetProjectFileType(), contextBoundSettingsStore); using (pi.SafeTotal(4)) { var context = new PsiCodeFormattingContext(this, firstNode, lastNode); if (profile != CodeFormatProfile.INDENT) { using (IProgressIndicator subPi = pi.CreateSubProgress(2)) { using (subPi.SafeTotal(2)) { SecretFormattingStage.DoFormat(context, subPi.CreateSubProgress(1)); SecretIndentingStage.DoIndent(context, globalSettings, subPi.CreateSubProgress(1), false); } } } else { using (IProgressIndicator subPi = pi.CreateSubProgress(4)) { SecretIndentingStage.DoIndent(context, globalSettings, subPi, true); } } } return(new TreeRange(firstElement, lastElement)); }
public override ITreeRange Format( ITreeNode firstElement, ITreeNode lastElement, CodeFormatProfile profile, IProgressIndicator pi, IContextBoundSettingsStore overrideSettingsStore = null) { ITreeNode firstNode; ITreeNode lastNode; GetFirstAndLastNode(firstElement, lastElement, out firstNode, out lastNode); var contextBoundSettingsStore = this.GetProperContextBoundSettingsStore(overrideSettingsStore, firstNode); var globalSettings = GlobalFormatSettingsHelper .GetService(firstNode.GetSolution()) .GetSettingsForLanguage(this.myLanguage, firstNode.GetProjectFileType(), contextBoundSettingsStore); using (pi.SafeTotal(4)) { var context = new PsiCodeFormattingContext(this, firstNode, lastNode); if (profile != CodeFormatProfile.INDENT) { using (IProgressIndicator subPi = pi.CreateSubProgress(2)) { using (subPi.SafeTotal(2)) { SecretFormattingStage.DoFormat(context, subPi.CreateSubProgress(1)); SecretIndentingStage.DoIndent(context, globalSettings, subPi.CreateSubProgress(1), false); } } } else { using (IProgressIndicator subPi = pi.CreateSubProgress(4)) { SecretIndentingStage.DoIndent(context, globalSettings, subPi, true); } } } return new TreeRange(firstElement, lastElement); }