Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbering on textDocument/documentSymbol #910

Open
LeoSchae opened this issue Aug 2, 2023 · 0 comments
Open

Numbering on textDocument/documentSymbol #910

LeoSchae opened this issue Aug 2, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@LeoSchae
Copy link

LeoSchae commented Aug 2, 2023

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.

@pfoerster pfoerster added the enhancement New feature or request label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants