package io.v.vdl.psi;

import com.intellij.lang.ASTNode;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.IndexSink;
import com.intellij.psi.stubs.StubBase;
import com.intellij.psi.util.PsiTreeUtil;
import io.v.vdl.VdlLanguage;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;

public abstract class VdlStubElementType<S extends StubBase<T>, T extends VdlCompositeElement> extends IStubElementType<S, T> {
    public VdlStubElementType(@NonNls @NotNull String debugName) {
        super(debugName, VdlLanguage.INSTANCE);
    }

    @NotNull
    public String getExternalId() {
        return "go." + super.toString();
    }

    public void indexStub(@NotNull S stub, @NotNull IndexSink sink) {
    }

    @Override
    public boolean shouldCreateStub(ASTNode node) {
        return super.shouldCreateStub(node) && PsiTreeUtil.getParentOfType(node.getPsi(), VdlBlock.class) == null;
    }
}

@@ -653,10 +653,11 @@
 rn %22
-go
+vdl
 .%22 +

fix serialized stub names