Skip to content

Commit

Permalink
[dotnet] more lazy LanguageService
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 079c4a2de7014f40ec82c2b5bd840cddb3a77792
  • Loading branch information
Nikita Popov authored and auduchinok committed Nov 25, 2024
1 parent f659d0a commit 5b5df18
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Concurrent;
using JetBrains.Application.Parts;
using JetBrains.Application.Components;
using JetBrains.ReSharper.Plugins.FSharp.Psi.Impl.Tree;
using JetBrains.ReSharper.Plugins.FSharp.Psi.Parsing;
using JetBrains.ReSharper.Plugins.FSharp.Services.Formatter;
Expand All @@ -20,7 +20,7 @@ namespace JetBrains.ReSharper.Plugins.FSharp.Psi.CodeFormatter
[Language(typeof(FSharpLanguage))]
public class FSharpCodeFormatter : CodeFormatterBase<FSharpFormatSettingsKey>
{
private readonly FSharpFormatterInfoProvider myFormatterInfoProvider;
private readonly ILazy<FSharpFormatterInfoProvider> myFormatterInfoProvider;

private readonly ConcurrentDictionary<FormatterImplHelper.TokenTypePair, bool> myGluingCache = new();

Expand All @@ -45,7 +45,7 @@ public class FSharpCodeFormatter : CodeFormatterBase<FSharpFormatSettingsKey>
private static readonly NodeTypeSet RightBraceEndNodes = new(FSharpTokenType.RBRACE, FSharpTokenType.BAR_RBRACE);

public FSharpCodeFormatter(FSharpLanguage language, CodeFormatterRequirements requirements,
FSharpFormatterInfoProvider formatterInfoProvider) : base(language, requirements)
ILazy<FSharpFormatterInfoProvider> formatterInfoProvider) : base(language, requirements)
{
myFormatterInfoProvider = formatterInfoProvider;
}
Expand Down Expand Up @@ -91,9 +91,9 @@ public override ITreeRange Format(ITreeNode firstElement, ITreeNode lastElement,
if (!firstElement.IsFSharpExperimentalFeatureEnabled(ExperimentalFeature.Formatter))
return new TreeRange(firstElement, lastElement);

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

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

return new TreeRange(firstElement, lastElement);
Expand Down

0 comments on commit 5b5df18

Please sign in to comment.