mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[toml] Handle quoted key segments in getName
Keys `foo` and `"foo"` introduce the same named entity, and so should have the same name. closes https://github.com/JetBrains/intellij-community/pull/1754 GitOrigin-RevId: 2920a63b6a28fcfe374478434e2e017b7aaf502c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9c0e634333
commit
16c27d5e50
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user