diff --git a/plugins/toml/core/src/main/kotlin/org/toml/lang/psi/impl/Psi.kt b/plugins/toml/core/src/main/kotlin/org/toml/lang/psi/impl/Psi.kt index 0365a163572e..1d7ca6bb1f61 100644 --- a/plugins/toml/core/src/main/kotlin/org/toml/lang/psi/impl/Psi.kt +++ b/plugins/toml/core/src/main/kotlin/org/toml/lang/psi/impl/Psi.kt @@ -18,6 +18,7 @@ import com.intellij.psi.tree.IElementType import com.intellij.psi.util.PsiTreeUtil import org.toml.lang.psi.* import org.toml.lang.psi.TomlElementTypes.* +import org.toml.lang.psi.ext.TomlLiteralKind class TomlKeyValueImpl(type: IElementType) : CompositePsiElement(type), TomlKeyValue { @@ -36,7 +37,10 @@ class TomlKeyValueImpl(type: IElementType) : CompositePsiElement(type), TomlKeyV class TomlKeySegmentImpl(type: IElementType) : CompositePsiElement(type), TomlKeySegment { - override fun getName(): String = text + override fun getName(): String = when (val child = node.findChildByType(TOML_SINGLE_LINE_STRINGS)) { + null -> text + else -> (TomlLiteralKind.fromAstNode(child) as? TomlLiteralKind.String)?.value ?: text + } override fun setName(name: String): PsiElement { return replace(TomlPsiFactory(project).createKeySegment(name))