fix zon completions
This commit is contained in:
parent
71c09d3ae2
commit
d5fc288ffd
1 changed files with 16 additions and 1 deletions
|
@ -44,9 +44,24 @@ class ZonCompletionContributor : CompletionContributor() {
|
||||||
.withSuperParent(4, psiElement(ZonTypes.PROPERTY))
|
.withSuperParent(4, psiElement(ZonTypes.PROPERTY))
|
||||||
.withSuperParent(7, psiElement(ZonTypes.PROPERTY))
|
.withSuperParent(7, psiElement(ZonTypes.PROPERTY))
|
||||||
.withSuperParent(10, psiOfType<ZonFile>())
|
.withSuperParent(10, psiOfType<ZonFile>())
|
||||||
|
) { parameters, _, result ->
|
||||||
|
val placeholder = parameters.position.parentOfType<ZonPropertyPlaceholder>() ?: return@extend
|
||||||
|
val depEntry = placeholder.parentOfType<ZonEntry>() ?: return@extend
|
||||||
|
if (depEntry.isDependency) {
|
||||||
|
doAddCompletions(placeholder.text.startsWith('.'), emptySet(), ZON_DEP_KEYS, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
extend(
|
||||||
|
CompletionType.BASIC,
|
||||||
|
psiElement()
|
||||||
|
.withParent(psiElement(ZonTypes.VALUE_PLACEHOLDER))
|
||||||
|
.withSuperParent(2, psiElement(ZonTypes.LIST))
|
||||||
|
.withSuperParent(4, psiElement(ZonTypes.PROPERTY))
|
||||||
|
.withSuperParent(7, psiElement(ZonTypes.PROPERTY))
|
||||||
|
.withSuperParent(10, psiOfType<ZonFile>())
|
||||||
) {parameters, _, result ->
|
) {parameters, _, result ->
|
||||||
val placeholder = parameters.position.parentOfType<ZonValuePlaceholder>() ?: return@extend
|
val placeholder = parameters.position.parentOfType<ZonValuePlaceholder>() ?: return@extend
|
||||||
val depEntry = placeholder.parentOfType<ZonProperty>() ?: return@extend
|
val depEntry = placeholder.parentOfType<ZonEntry>() ?: return@extend
|
||||||
if (depEntry.isDependency) {
|
if (depEntry.isDependency) {
|
||||||
doAddCompletions(false, emptySet(), ZON_DEP_KEYS, result)
|
doAddCompletions(false, emptySet(), ZON_DEP_KEYS, result)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue