James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.47k stars 519 forks source link

When I edit a file imported via \input, the outline/structure bar doesn't scroll with my editing position. #4207

Closed changlichun closed 4 months ago

changlichun commented 4 months ago

Please fill the following fields with a star (*) and provide as much related information as possible.

Pre-checks*

Please change the following [ ] to [x] for confirmation.

  • [x] The issue has not been reported in this repository.
  • [x] The issue remains after disabling all other extensions and restarting Visual Studio Code.
  • [x] The FAQ cannot address the issue.
  • [x] The issue is not related to compiling a document, or the document can be successfully compiled in the OS terminal but not in Visual Studio Code with this extension.

Environment*

Please write exact version numbers instead of descriptors such as latest.

  • Operating System: Windows 10
  • Visual Studio Code Version: 1.87.1
  • LaTeX Workshop Version: [e.g. 8.5.0]
  • TeX Distribution Version: TeX Live 2023

Please list the environment and version number if you are using VSCodium, Snap or Flatpack versions of Visual Studio Code, and/or Visual Studio Code Remote Containers/SSH/WSL.

  • I am using XXX whose version is YY.ZZ

The Issue*

Please briefly describe the issue you come across.

  • When I edit a file imported via \input, the outline/structure bar doesn't scroll with my editing position.

Reproduction Steps

Please list out the steps to reproduce your bug. Include relevant environmental variables or any other configuration.

  1. At least two file and one is imported by \input
  2. The imported file contain only \subsubsection level structure

Expected Behavior

What were you expecting to see? Include any relevant examples or documentation links.

  • Behave like in a single file

Logs

LaTeX Workshop Output*

Please paste the whole log messages below, not parts of ones. The log should start with New log placeholder %WS1% registered.

[Paste the log here. Do not remove the surrounding backquotes (`).]

Developer Tools Console

Please paste the whole log messages below, not parts of ones. This console logs can sometimes be very important in many cases. To access the log, click Help -> Toggle Developer Tools -> Console.

[Paste the log here. Do not remove the surrounding backquotes (`).]

Anything Else?

Add any other context about the problem below.

  • I would like to provied my example code here example.tex
    
    \documentclass[]{article}
    \usepackage{lipsum}

\begin{document} \section[1]{sec 1} \lipsum[1-3]

\subsection{sub 1} \input{example-section}

\end{document}

example-section.tex

% \subsection{sec 2} % behave correctly when contain the subsection level title \subsubsection[2]{subsub 2} \lipsum[4-6] \subsubsection[3]{subsub 3}

jlelong commented 4 months ago

I cannot reproduce the issue. Are you talking about the Outline view in the Explorer panel or about the Structure view in the TeX panel? In the Outline view in the Explorer panel, make to activate Follow Cursor in the three dots

Capture d’écran 2024-03-16 à 14 42 18
changlichun commented 4 months ago

I apologize for not being clear. I am talking about the structure view. image

jlelong commented 4 months ago

Can you post a screenshot describing what you consider as an issue because I am not sure to understand what the true problem is?

changlichun commented 4 months ago

The current editing position should normally be spotlighted in the structure view, but this is not possible when the file contains only \subsubsection

image

image

jlelong commented 4 months ago

Thanks for the screenshots and for spotting the role of the first sectioning level in the included file.

James-Yu commented 4 months ago

For self-note: this issue was caused by the previous file path tracing logic, which only inspects the immediately children's file path. The fix will inspect the paths for all children and children-of-children.