Symbol name is empty in auto-close completion

I’m trying to write a language definition for LaTeX. In <scopes> I have the following definitions:

      <scope name="tex.environment.begin">
            <symbol type="tag" name-selector="tex.identifier.type">
                <context behavior="start">
                    <auto-close string="\end" completion="{${name}}" />
                </context>
            </symbol>
            <expression>(\\begin)(\{)(.*?)(\})</expression>
            <capture number="1" name="tex.keyword.construct"/>
            <capture number="2" name="tex.bracket"/>
            <capture number="3" name="tex.identifier.type"/>
            <capture number="4" name="tex.bracket"/>
        </scope>
        <scope name="tex.environment.end">
            <symbol type="tag" name-selector="tex.identifier.type">
                <context behavior="end"/>
            </symbol>
            <expression>(\\end)(\{)(.*?)(\})</expression>
            <capture number="1" name="tex.keyword.construct"/>
            <capture number="2" name="tex.bracket"/>
            <capture number="3" name="tex.identifier.type"/>
            <capture number="4" name="tex.bracket"/>
        </scope>

To test this, I write the following code:

\begin{foo}
\end

Auto-completion adds {} after \end, but without the name – it should add {foo}.

This <symbol> had initially type="block" but I changed it to tag to use the Symbols sidebar to check whether the name foo is correctly recognized (blocks don’t seem to be added there). The sidebar correctly contains the symbol foo. Why doesn’t auto-closing work properly in this case?