Skip to content

Numbering on textDocument/documentSymbol #910

@LeoSchae

Description

@LeoSchae

I noticed, that when requesting for textDocument/documentSymbol the resulting sections (SymbolKind.Module = 2) only have a number if they are assigned with a label.

A small example would be a document with

\section{Section}\label{sec:outer} % 1 Section
\subsection{Subsection} % 1.1 Subsection

\section{Section'} % 2 Section'
\subsection{Subsection'}\label{sec:inner} % 2.1 Subsection'

The resulting document symbols would be:

1 Section
Subsection
Section'
2.1 Subsection'

So the numbers are correct. But when a section has no label, it is not assigned any number.

Similarly,

\section{Section}\label{sec:outer} % 1 Section
\subsection{Subsection} % 1.1 Subsection
\section{Section'} % 2 Section'
\subsection{Dummy} % 2.1 Dummy
\subsection*{Subsection'}\label{sec:inner} % Subsection'

would result in

1 Section
Subsection
Section'
Dummy
2.1 Subsection'

even though the last subsection does not have a number (it is assigned the number from the previous section, and when Dummy section is removed the number would be 2).
[This is not bad, since we can not use the label anyway, because there is no number.]

I guess my expectation would be for the document symbol to always include the number that appears in the actual document. So the names that are after the % in the code.

I have not looked at the code yet, so I don't know if this is feasible in the current way the document is parsed. I also noticed a similar thing for equations. Equations in the symbol list will be numbered only if they have a label.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions