Skip to content

Commit 59eb73b

Browse files
committed
log duplicates for IDs
1 parent bb8ba2b commit 59eb73b

File tree

1 file changed

+9
-0
lines changed
  • resharper/resharper-unity/src/Yaml/Psi/Caches/UnityEditorPropertyValues

1 file changed

+9
-0
lines changed

resharper/resharper-unity/src/Yaml/Psi/Caches/UnityEditorPropertyValues/SceneHierarchy.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
using System;
12
using System.Collections.Generic;
3+
using System.Linq;
24
using JetBrains.Application.PersistentMap;
35
using JetBrains.Collections;
46
using JetBrains.Diagnostics;
@@ -7,11 +9,14 @@
79
using JetBrains.Serialization;
810
using JetBrains.Text;
911
using JetBrains.Util;
12+
using JetBrains.Util.Logging;
1013

1114
namespace JetBrains.ReSharper.Plugins.Unity.Yaml.Psi.Caches.UnityEditorPropertyValues
1215
{
1316
public class SceneHierarchy
1417
{
18+
private static readonly ILogger ourLogger = Logger.GetLogger<SceneHierarchy>();
19+
1520
public readonly Dictionary<FileID, IUnityHierarchyElement> Elements = new Dictionary<FileID, IUnityHierarchyElement>();
1621

1722
private readonly Dictionary<FileID, FileID> myGameObjectsTransforms = new Dictionary<FileID, FileID>();
@@ -46,8 +51,12 @@ public void AddSceneHierarchyElement(Dictionary<string, string> simpleValues, Di
4651
var anchor = simpleValues.GetValueSafe("&anchor");
4752
if (string.IsNullOrEmpty(anchor))
4853
return;
54+
4955

5056
var id = new FileID(null, anchor);
57+
if (Elements.ContainsKey(id))
58+
ourLogger.Verbose($"Id = {anchor.Substring(0, Math.Min(anchor.Length, 100))} is defined several times for different documents");
59+
5160
var correspondingId = GetCorrespondingSourceObjectId(referenceValues);
5261
var prefabInstanceId = GetPrefabInstanceId(referenceValues);
5362
bool isStripped = simpleValues.ContainsKey("stripped");

0 commit comments

Comments
 (0)