[js] WEB-74235 optimize getting mapping for empty cases

GitOrigin-RevId: 1d83dd42d430207e9ed9b8d0b255e97848657321
This commit is contained in:
Konstantin Ulitin
2025-08-01 06:52:22 +02:00
committed by intellij-monorepo-bot
parent e616a79348
commit c77a96eb17

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang;
import com.intellij.injected.editor.VirtualFileWindow;
@@ -119,6 +119,7 @@ public abstract class PerFileMappingsBase<T> implements PersistentStateComponent
}
synchronized (myMappings) {
ensureStateLoaded();
if (myMappings.isEmpty()) return null; // fast path
T t = getMappingForHierarchy(file);
if (t != null) return t;
t = getMappingForHierarchy(originalFile);