Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ItemGroup>
<PackageLock Include="Fantomas.Core" Version="7.0.3" />
<PackageLock Include="Fantomas.FCS" Version="7.0.3" />
<PackageLock Include="FSharp.Core" Version="9.0.201" />
<PackageLock Include="FSharp.Core" Version="10.0.103" />
<PackageLock Include="JetBrains.Lifetimes" Version="2026.1.2" />
<PackageLock Include="JetBrains.NuGet.Versioning" Version="7.0.20251126.165" />
<PackageLock Include="JetBrains.RdFramework" Version="2026.1.2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="2.0.0.0-9.9.9.9" newVersion="9.0.0.0"/>
<bindingRedirect oldVersion="2.0.0.0-99.9.9.9" newVersion="10.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface IProvidedCache<T, in TKey>
void Remove(TKey partialKey);

//Test api
string Dump();
string Dump(TypeProvidersCache tpCache);
}

public interface IBiDirectionalProvidedCache<T, TKey> : IProvidedCache<(T model, int typeProviderId), TKey>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void Remove(int typeProviderId) =>
return true;
});

public virtual string Dump() => "";
public virtual string Dump(TypeProvidersCache tpCache) => "";

public IEnumerator<KeyValuePair<T, (int id, HashSet<int> referencingProviders)>> GetEnumerator() =>
IdsCache.GetEnumerator();
Expand Down Expand Up @@ -137,20 +137,20 @@ public bool TryGetKey(ProvidedType model, int requestingTypeProviderId, out int
? myMetadataEntitiesCache.TryGetKey(model, requestingTypeProviderId, out key)
: myCreatedByProviderTypes.TryGetLeftByRight((model, requestingTypeProviderId), out key);

public string Dump() =>
public string Dump(TypeProvidersCache tpCache) =>
string.Join("\n\n",
"Created by provider Types:\n" + string.Join("\n",
myCreatedByProviderTypes
.OrderBy(t => t.Value.type.FullName)
.Select(t =>
$"{t.Value.type.FullName} tp: {t.Value.typeProviderId} " +
$"(from {t.Value.type.Assembly.GetLogName()})")),
$"{t.Value.type.FullName} (from {t.Value.type.Assembly.GetLogName()}), " +
$"owners: {tpCache.DumpNames([t.Value.typeProviderId])}")
.OrderBy()),
"Provided Types:\n" + string.Join("\n",
myMetadataEntitiesCache
.OrderBy(t => t.Key.FullName)
.Select(t =>
$"{t.Key.FullName} tps: {string.Join("|", t.Value.referencingProviders.OrderBy().ToArray())} " +
$"(from {t.Key.Assembly.GetLogName()})")));
$"{t.Key.FullName} (from {t.Key.Assembly.GetLogName()}), " +
$"owners: {tpCache.DumpNames(t.Value.referencingProviders)}")
.OrderBy()));
}

public class ProvidedAssembliesCache : MetadataEntitiesCache<ProvidedAssembly>
Expand All @@ -159,11 +159,14 @@ public ProvidedAssembliesCache(IEqualityComparer<ProvidedAssembly> equalityCompa
{
}

public override string Dump() =>
public override string Dump(TypeProvidersCache tpCache) =>
"Provided Assemblies:\n" + string.Join("\n",
IdsCache
.Select(t => (Name: t.Key.GetLogName(), Providers: t.Value.referencingProviders.OrderBy().ToArray()))
.OrderBy(t => t.Name)
.Select(t => $"{t.Name} tps: {string.Join("|", t.Providers)}"));
.Select(t => (Assembly: t.Key, Providers: t.Value.referencingProviders.OrderBy().ToArray()))
.Select(t => t.Assembly.GetLogName() +
(t.Assembly.GetName().Name is "mscorlib" or "netstandard"
? ""
: $", owners: {tpCache.DumpNames(t.Providers)}"))
.OrderBy());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public void Remove(int typeProviderId) =>

public (T model, int typeProviderId) Get(int key) => myEntities[key];

public string Dump() => $"{typeof(T).Name}:\nCount: {myEntities.Count}";
public string Dump(TypeProvidersCache _) => $"{typeof(T).Name}:\nCount: {myEntities.Count}";
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using JetBrains.ReSharper.Plugins.FSharp.TypeProviders.Host.Utils;
using JetBrains.ReSharper.Plugins.FSharp.TypeProviders.Protocol.Utils;
using JetBrains.Util.dataStructures;
using Microsoft.FSharp.Core.CompilerServices;
Expand Down Expand Up @@ -31,7 +32,8 @@ public void Remove(int typeProviderId)

public string Dump() =>
"Type Providers:\n" + string.Join("\n",
myTypeProviders.Select(t =>
$"{t.Key} {t.Value.typeProvider.GetType().AssemblyQualifiedName} (from {Path.GetFileName(t.Value.envKey)})"));
myTypeProviders
.Select(t => $"{t.Value.typeProvider.GetDumpName()} (from {Path.GetFileName(t.Value.envKey)})")
.OrderBy());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ public void Initialize(RdTestHost processModel)

private static string RuntimeVersion(Unit _) => PlatformUtil.CurrentFrameworkDescription;

private string Dump(Unit _) =>
string.Join("\n\n",
myTypeProvidersContext.TypeProvidersCache.Dump(),
myTypeProvidersContext.ProvidedTypesCache.Dump(),
myTypeProvidersContext.ProvidedAssembliesCache.Dump(),
myTypeProvidersContext.ProvidedConstructorsCache.Dump(),
myTypeProvidersContext.ProvidedMethodsCache.Dump(),
myTypeProvidersContext.ProvidedPropertyCache.Dump());
private string Dump(Unit _)
{
var tpCache = myTypeProvidersContext.TypeProvidersCache;
return string.Join("\n\n",
tpCache.Dump(),
myTypeProvidersContext.ProvidedTypesCache.Dump(tpCache),
myTypeProvidersContext.ProvidedAssembliesCache.Dump(tpCache),
myTypeProvidersContext.ProvidedConstructorsCache.Dump(tpCache),
myTypeProvidersContext.ProvidedMethodsCache.Dump(tpCache),
myTypeProvidersContext.ProvidedPropertyCache.Dump(tpCache));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Linq;
using JetBrains.ReSharper.Plugins.FSharp.TypeProviders.Host.Cache;
using Microsoft.FSharp.Core.CompilerServices;

namespace JetBrains.ReSharper.Plugins.FSharp.TypeProviders.Host.Utils;

internal static class TestUtils
{
internal static string GetDumpName(this ITypeProvider typeProvider) =>
typeProvider.GetType().AssemblyQualifiedName;

internal static string DumpNames(this TypeProvidersCache tpCache, IEnumerable<int> ids) =>
string.Join(", ", ids.Select(x => tpCache.Get(x).GetType().FullName).OrderBy());
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageLock Include="FSharp.Core" Version="9.0.201" />
<PackageLock Include="FSharp.Core" Version="10.0.103" />
<PackageLock Include="JetBrains.Annotations" Version="2025.2.0" />
<PackageLock Include="JetBrains.FSharp.Compiler.Service" Version="2025.3.5.2" />
<PackageLock Include="JetBrains.FSharp.Compiler.Service" Version="2026.1.0" />
<PackageLock Include="JetBrains.Lifetimes" Version="2026.1.2" />
<PackageLock Include="JetBrains.RdFramework" Version="2026.1.2" />
<PackageLock Include="Microsoft.NETCore.Platforms" Version="3.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ type ScriptFcsProjectProvider(lifetime: Lifetime, logger: ILogger, checkerServic
let sequentialLifetimes = scriptsUpdateLifetimes.GetOrAdd(path, SequentialLifetimes(lifetime))
let currentLifetime = sequentialLifetimes.Next()

locks.StartBackgroundRead(currentLifetime, (fun _ ->
locks.StartReadActionAsync(currentLifetime, Action(fun _ ->
if not currentLifetime.IsAlive then () else

let newOptions = getOptionsImpl path source
Expand All @@ -157,7 +157,7 @@ type ScriptFcsProjectProvider(lifetime: Lifetime, logger: ILogger, checkerServic

| _, Some newOptions -> update path newOptions
| _ -> ()
), retryOnOperationCanceled = true).NoAwait()
)).NoAwait()


let rec getFcsProject path source allowRetry : FcsProject option =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ type internal TypeProvidersCache() =
member x.Dump() =
let typeProviders =
proxyTypeProvidersPerId
|> Seq.map (fun t -> t.Key, t.Value.GetDisplayName(true))
|> Seq.sortBy snd
|> Seq.map (fun (id, name) -> $"{id} {name}")
|> Seq.map _.Value.GetDisplayName(true)
|> Seq.sortBy id
|> String.concat "\n"

$"Type Providers:\n{typeProviders}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace JetBrains.ReSharper.Plugins.FSharp.Services.Formatter

open System
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text
open JetBrains.Application.Parts
Expand All @@ -26,7 +27,7 @@ module internal Reflection =

[<SolutionComponent(InstantiationEx.LegacyDefault)>]
type FantomasHost(solution: ISolution, fantomasFactory: FantomasProcessFactory, fantomasDetector: FantomasDetector,
schema: SettingsSchema, settingsStore: ISettingsStore) =
schema: SettingsSchema) =
let solutionLifetime = solution.GetSolutionLifetimes().UntilSolutionCloseLifetime
let mutable connection: FantomasConnection = null
let mutable formatConfigFields: string[] = [||]
Expand Down Expand Up @@ -83,8 +84,7 @@ type FantomasHost(solution: ISolution, fantomasFactory: FantomasProcessFactory,
if isNull value then "" else value |]

let toRdFcsParsingOptions (options: FSharpParsingOptions) =
let lightSyntax = Option.toNullable options.IndentationAwareSyntax
RdFcsParsingOptions(Array.last options.SourceFiles, lightSyntax,
RdFcsParsingOptions(Array.last options.SourceFiles,
List.toArray options.ConditionalDefines, options.IsExe, options.LangVersionText)

do fantomasDetector.VersionToRun.Advise(solutionLifetime, fun _ -> terminateConnection ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type FSharpImplTreeBuilder(lexer, document, decls, warnDirectives, lifetime, pat
| SynModuleDecl.Open(openDeclTarget, range) ->
x.ProcessOpenDeclTarget(openDeclTarget, range)

| SynModuleDecl.Let(_, bindings, range) ->
| SynModuleDecl.Let(_, bindings, range, _) ->
x.ProcessTopLevelBindings(bindings, range)

| SynModuleDecl.HashDirective(hashDirective, _) ->
Expand Down Expand Up @@ -201,7 +201,7 @@ type FSharpImplTreeBuilder(lexer, document, decls, warnDirectives, lifetime, pat
member x.ProcessTypeMember(typeMember: SynMemberDefn) =
match typeMember with
| SynMemberDefn.ImplicitCtor _ -> ()
| SynMemberDefn.LetBindings(bindings, _, _, range) ->
| SynMemberDefn.LetBindings(bindings, _, _, range, _) ->
x.ProcessTopLevelBindings(bindings, range)
| _ ->

Expand Down Expand Up @@ -1061,7 +1061,7 @@ type FSharpExpressionTreeBuilder(lexer, document, warnDirectives, lifetime, path
x.PushStep(typeApp, typeArgsInReferenceExprProcessor)
x.ProcessExpression(expr)

| SynExpr.LetOrUse(_, _, _, _, bindings, bodyExpr, _, _) ->
| SynExpr.LetOrUse({ Bindings = bindings; Body = bodyExpr }) ->
x.PushRange(range, ElementType.LET_OR_USE_EXPR)
x.PushExpression(bodyExpr)
x.ProcessBindings(bindings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type SynMemberDefn with
match x with
| SynMemberDefn.Member(SynBinding(xmlDoc = xmlDoc), _)
| SynMemberDefn.ImplicitCtor(xmlDoc = xmlDoc)
| SynMemberDefn.LetBindings(SynBinding(xmlDoc = xmlDoc) :: _, _, _, _)
| SynMemberDefn.LetBindings(SynBinding(xmlDoc = xmlDoc) :: _, _, _, _, _)
| SynMemberDefn.AbstractSlot(SynValSig(xmlDoc = xmlDoc), _, _, _)
| SynMemberDefn.ValField(SynField(xmlDoc = xmlDoc), _)
| SynMemberDefn.AutoProperty(xmlDoc = xmlDoc) -> xmlDoc.ToXmlDoc(false, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ protected override ProvidedAssembly[] CreateBatch(int[] keys, IProxyTypeProvider
public override string Dump() =>
"Provided Assemblies:\n" + string.Join("\n",
EntitiesPerProvider
.SelectMany(kvp => kvp.Value
.Select(entityId => Entities[entityId])
.Select(entity => (tpId: kvp.Key, Name: entity.GetLogName())))
.OrderBy(t => t.Name)
.Select(t => $"{t.tpId} {t.Name}"));
.SelectMany(kvp => kvp.Value.Select(entityId => Entities[entityId].GetLogName()))
.OrderBy());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ protected override ProxyProvidedType[] CreateBatch(int[] keys, IProxyTypeProvide
public override string Dump() =>
"Provided Types:\n" + string.Join("\n",
EntitiesPerProvider
.SelectMany(kvp => kvp.Value
.Select(entityId => Entities[entityId])
.Select(entity => (tpId: kvp.Key, entity)))
.OrderBy(t => t.entity.FullName)
.Select(t => $"{t.tpId} {t.entity.FullName} (from {t.entity.Assembly.GetLogName()})"));
.SelectMany(kvp => kvp.Value.Select(entityId => Entities[entityId]))
.Select(t => $"{t.FullName} (from {t.Assembly.GetLogName()})")
.OrderBy());
}
}
4 changes: 2 additions & 2 deletions ReSharper.FSharp/src/FSharp/PackagesLock.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<ItemGroup>
<PackageLock Include="Antlr2.Runtime" Version="2.7.7.3" />
<PackageLock Include="Fantomas.Core" Version="7.0.3" />
<PackageLock Include="FSharp.Core" Version="9.0.201" />
<PackageLock Include="FSharp.Core" Version="10.0.103" />
<PackageLock Include="JetBrains.Annotations" Version="2025.2.0" />
<PackageLock Include="JetBrains.Build.Platform.DistributedCache" Version="1.1.20250717.260" />
<PackageLock Include="JetBrains.FSharp.Compiler.Service" Version="2025.3.5.2" />
<PackageLock Include="JetBrains.FSharp.Compiler.Service" Version="2026.1.0" />
<PackageLock Include="JetBrains.HabitatDetector" Version="1.4.6" />
<PackageLock Include="JetBrains.Lifetimes" Version="2026.1.2" />
<PackageLock Include="JetBrains.NuGet.Packaging" Version="7.0.20251126.165" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,40 @@ module Module1 =
type T1() =
class end

[<Extension>]
[<|Extension|(2)>]
type T2() =
[<Extension>]
static member Foo(_: int) = ()

type T3() =
[<|Extension|(2)>]
[<Extension>]
static member Foo(_: int) = ()

[<Extension>]
[<|Extension|(3)>]
type T4() =
[<|Extension|(3)>]
[<|Extension|(4)>]
member x.Foo(_: int) = ()

[<Extension>]
[<|Extension|(5)>]
module Module2 =
[<Extension>]
let foo (_: int) = ()

module Module3 =
[<|Extension|(4)>]
[<Extension>]
let foo (_: int) = ()

[<Extension>]
[<|Extension|(6)>]
module Module4 =
type System.String with
[<Extension>]
member _.M() = ()

---------------------------------------------------------
(0): ReSharper Dead Code: Extension type doesn't have any extension members
(1): ReSharper Dead Code: Extension type doesn't have any extension members
(2): ReSharper Warning: Extension member in non-extension type looks suspicious
(3): ReSharper Warning: Extension member should be static
(4): ReSharper Warning: Extension member in non-extension type looks suspicious
(0): ReSharper Dead Code: Extension attribute is redundant
(1): ReSharper Dead Code: Extension attribute is redundant
(2): ReSharper Dead Code: Extension attribute is redundant
(3): ReSharper Dead Code: Extension attribute is redundant
(4): ReSharper Warning: Extension member should be static
(5): ReSharper Dead Code: Extension attribute is redundant
(6): ReSharper Dead Code: Extension attribute is redundant

This file was deleted.

Loading
Loading