From d3653b0652e560db6385fdcfb263d1bef9a9ade0 Mon Sep 17 00:00:00 2001 From: "andrew.karpov" Date: Tue, 20 Jan 2026 19:04:19 +0100 Subject: [PATCH] RSRP-500888 Long Delay in Resolving Candidate Symbols Fixes RSRP-500888 Using of annotation provider on a hot path from code completion caused lots of unnecessary and expensive computation (especially `TypeElementUtil.GetAllSuperTypes`). This commit removes the `EmbeddedAnnotationProvider` altogether, and replaces its usage with direct call to `HasAttributeInstance` which is actually super fast on type elements. This commit also changes the API itself: from `DeclaredElementExtensions.IsInternalsVisibleToApplies(this IDeclaredElement, IPsiModule)` to `AccessUtil.IsInternalSymbolAccessible(ITypeMember, IPsiModule)` GitOrigin-RevId: e62a6e0fba186f7705e9cb7ecb15a88b3088935f --- .../src/FSharp/FSharp.Psi/src/IFSharpDeclaredElement.cs | 2 +- .../src/FSharp/FSharp.Psi/src/Impl/FSharpAccessRights.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/IFSharpDeclaredElement.cs b/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/IFSharpDeclaredElement.cs index 81701efe99..215c503320 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/IFSharpDeclaredElement.cs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/IFSharpDeclaredElement.cs @@ -15,7 +15,7 @@ public interface IFSharpDeclaredElement : IClrDeclaredElement string SourceName { get; } } - public interface IFSharpTypeElement : IFSharpDeclaredElement, ITypeElement, IAccessRightsOwner + public interface IFSharpTypeElement : IFSharpDeclaredElement, ITypeElement, ITypeMember { ModuleMembersAccessKind AccessKind { get; } } diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/FSharpAccessRights.cs b/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/FSharpAccessRights.cs index 9d56628106..adec16787a 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/FSharpAccessRights.cs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/FSharpAccessRights.cs @@ -12,6 +12,7 @@ using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.Modules; using JetBrains.ReSharper.Psi.Tree; +using JetBrains.ReSharper.Psi.Util; namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Impl; @@ -160,7 +161,7 @@ public static bool IsAccessible(ITypeElement typeElement, ITreeNode context) if (accessRights == AccessRights.PRIVATE && !IsTheSameOwner(fsTypeElement, context)) return false; - if (accessRights == AccessRights.INTERNAL && !typeElement.IsInternalsVisibleToApplies(context.GetPsiModule())) + if (accessRights == AccessRights.INTERNAL && !AccessUtil.IsInternalSymbolAccessible(fsTypeElement, context.GetPsiModule())) return false; if (fsTypeElement is IFSharpSourceTypeElement fsSourceTypeElement)