Skip to content

Commit 8cf9adb

Browse files
authored
Merge pull request #2273 from JetBrains/net221-mte-duplicate-project-names
Ensure Unity Explorer project names are distinct
2 parents 8a5b930 + 99ba598 commit 8cf9adb

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Since 2018.1, the version numbers and release cycle match Rider's versions and r
2626

2727
### Fixed
2828

29-
- Rider: Fix massive performance issue when opening very large projects on certain file systems ([RIDER-53358](https://youtrack.jetbrains.com/issue/RIDER-53358), [#2271](https://github.com/JetBrains/resharper-unity/pull/2271))
29+
- Fix massive performance issue when opening very large projects on certain file systems ([RIDER-53358](https://youtrack.jetbrains.com/issue/RIDER-53358), [#2271](https://github.com/JetBrains/resharper-unity/pull/2271))
30+
- Fix excessive memory traffic when opening very large projects ([#2271](https://github.com/JetBrains/resharper-unity/pull/2271))
3031
- Rider: Fix incorrectly showing both Unity and Unity DLL project action groups ([#2219](https://github.com/JetBrains/resharper-unity/pull/2219))
3132
- Rider: Fix incorrectly showing "switch to full UI" action when already in full UI ([RIDER-71185](https://youtrack.jetbrains.com/issue/RIDER-71185), [#2220](https://github.com/JetBrains/resharper-unity/pull/2220))
3233
- Rider: Fix debugging unit test when debugger is already attached to the editor ([RIDER-70660](https://youtrack.jetbrains.com/issue/RIDER-70660), [#2232](https://github.com/JetBrains/resharper-unity/pull/2232))
@@ -39,6 +40,7 @@ Since 2018.1, the version numbers and release cycle match Rider's versions and r
3940
- Rider: Fix loss of connection to Unity editor after refreshing assets ([RIDER-73901](https://youtrack.jetbrains.com/issue/RIDER-73901), [#2262](https://github.com/JetBrains/resharper-unity/pull/2262))
4041
- Rider: Fix display of unprintable characters in console output when debugging batchmode tests ([RIDER-74056](https://youtrack.jetbrains.com/issue/RIDER-74056), [#2265](https://github.com/JetBrains/resharper-unity/pull/2265))
4142
- Rider: Fix performance issue displaying long log issues from Unity ([RIDER-70574](https://youtrack.jetbrains.com/issue/RIDER-70574), [#2270](https://github.com/JetBrains/resharper-unity/pull/2270))
43+
- Rider: Fix showing duplicate project names in Unity Explorer under certain circumstances ([RIDER-67457](https://youtrack.jetbrains.com/issue/RIDER-67457), [#2273](https://github.com/JetBrains/resharper-unity/pull/2273))
4244

4345

4446

resharper/resharper-unity/src/Unity/Yaml/ProjectModel/MetaProjectFileType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public class MetaProjectFileType : YamlProjectFileType
1515
[UsedImplicitly] public new static MetaProjectFileType? Instance { get; private set; }
1616

1717
public MetaProjectFileType()
18-
: base(Name, "Unity Yaml", new[] { UnityFileExtensions.MetaFileExtensionWithDot })
18+
: base(Name, "Unity Meta File", new[] { UnityFileExtensions.MetaFileExtensionWithDot })
1919
{
2020
}
2121
}
22-
}
22+
}

rider/src/main/kotlin/com/jetbrains/rider/plugins/unity/explorer/UnityExplorer.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class UnityExplorer(project: Project) : SolutionViewPaneBase(project, createRoot
2626
const val ShowTildeFoldersOption = "show-tilde-folders"
2727
const val DefaultProjectPrefix = "Assembly-CSharp"
2828

29+
val DefaultProjectPrefixRegex = ("$DefaultProjectPrefix[.-]?").toRegex()
30+
2931
val Icon = UnityIcons.ToolWindows.UnityExplorer
3032
val IgnoredExtensions = hashSetOf("meta", "tmp")
3133

rider/src/main/kotlin/com/jetbrains/rider/plugins/unity/explorer/UnityExplorerFileSystemNode.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ open class UnityExplorerFileSystemNode(project: Project,
123123

124124
protected fun addProjects(presentation: PresentationData) {
125125
val projectNames = entities // One node for each project that this directory is part of
126-
.mapNotNull { containingProjectNode(it) }
127-
.map(::stripDefaultProjectPrefix)
128-
.filter { it.isNotEmpty() }
129-
.sortedWith(String.CASE_INSENSITIVE_ORDER)
126+
.mapNotNull { containingProjectNode(it) }
127+
.map(::stripDefaultProjectPrefix)
128+
.filter { it.isNotEmpty() }
129+
.sortedWith(String.CASE_INSENSITIVE_ORDER)
130+
.distinct()
130131
if (projectNames.any()) {
131132
var description = projectNames.take(3).joinToString(", ")
132133
if (projectNames.count() > 3) {
@@ -144,7 +145,7 @@ open class UnityExplorerFileSystemNode(project: Project,
144145
// Assembly-CSharp => ""
145146
// Assembly-CSharp-Editor => Editor
146147
// Assembly-CSharp.Player => Player
147-
return it.name.removePrefix(UnityExplorer.DefaultProjectPrefix).removePrefix("-").removePrefix(".")
148+
return it.name.replace(UnityExplorer.DefaultProjectPrefixRegex, "")
148149
}
149150

150151
private fun containingProjectNode(entity: ProjectModelEntity): ProjectModelEntity? {

0 commit comments

Comments
 (0)