Skip to content

Commit c83dce5

Browse files
committed
1 parent 0b2a8a5 commit c83dce5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

resharper/resharper-unity/src/Unity/Utils/DeclaredElementExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using JetBrains.ReSharper.Plugins.Unity.Core.ProjectModel;
55
using JetBrains.ReSharper.Plugins.Unity.UnityEditorIntegration.Api;
66
using JetBrains.ReSharper.Psi;
7+
using JetBrains.ReSharper.Psi.CSharp;
78
using JetBrains.ReSharper.Psi.Impl.Reflection2;
89
using JetBrains.ReSharper.Psi.Modules;
910

@@ -13,7 +14,8 @@ public static class DeclaredElementExtensions
1314
{
1415
public static bool IsFromUnityProject([NotNull] this IDeclaredElement element)
1516
{
16-
return element.GetSourceFiles().Any(sf => sf.GetProject().IsUnityProject());
17+
// GetSourceFiles may be heavy for C++ IDeclaredElement
18+
return element.PresentationLanguage.Is<CSharpLanguage>() && element.GetSourceFiles().Any(sf => sf.GetProject().IsUnityProject());
1719
}
1820

1921
public static bool IsBuiltInUnityClass(this IDeclaredElement element)

0 commit comments

Comments
 (0)