File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
resharper/resharper-unity/src Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ namespace JetBrains.ReSharper.Plugins.Unity
8
8
public static class ProjectExtensions
9
9
{
10
10
public const string AssetsFolder = "Assets" ;
11
+ public const string PackagesFolder = "Packages" ;
11
12
public const string ProjectSettingsFolder = "ProjectSettings" ;
12
13
13
14
public static bool HasUnityReference ( [ NotNull ] this ISolution solution )
Original file line number Diff line number Diff line change @@ -137,7 +137,27 @@ private static bool IsRemovedAsset(ProjectItemChange change)
137
137
private static bool ShouldHandleChange ( ProjectItemChange change )
138
138
{
139
139
// String comparisons, treat as expensive if we're doing this very frequently
140
- return ! IsItemMetaFile ( change ) ;
140
+ return IsAssetOrPackage ( change ) && ! IsItemMetaFile ( change ) ;
141
+ }
142
+
143
+ private static bool IsAssetOrPackage ( ProjectItemChange change )
144
+ {
145
+ var rootFolder = GetRootFolder ( change . OldParentFolder ) ;
146
+ if ( rootFolder == null )
147
+ return false ;
148
+ if ( string . Compare ( rootFolder . Name , ProjectExtensions . AssetsFolder , StringComparison . OrdinalIgnoreCase ) == 0 )
149
+ return true ;
150
+ if ( string . Compare ( rootFolder . Name , ProjectExtensions . PackagesFolder , StringComparison . OrdinalIgnoreCase ) == 0 )
151
+ return true ;
152
+ var project = change . ProjectItem . GetProject ( ) ;
153
+ return project != null && project . HasSubItems ( rootFolder . Name ) ;
154
+ }
155
+
156
+ private static IProjectFolder GetRootFolder ( IProjectItem item )
157
+ {
158
+ while ( item ? . ParentFolder != null && item . ParentFolder . Kind != ProjectItemKind . PROJECT )
159
+ item = item . ParentFolder ;
160
+ return item as IProjectFolder ;
141
161
}
142
162
143
163
private static bool IsItemMetaFile ( ProjectItemChange change )
You can’t perform that action at this time.
0 commit comments