James-Yu / LaTeX-Workshop

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

Show symbols in file (i.e. Outline) #768

Closed gandalfsaxe closed 6 years ago

gandalfsaxe commented 6 years ago

Description

LaTeX Workshop does not help VSCode recognize symbols, i.e. you can't jump to a section of text with the Go To Symbol in File... command (⌘⇧O). I suggest making this into symbols for easy navigation:

How symbols look in LaTeX currently

image

It also means that the Outline pane is empty, which would otherwise be populated by the the list of symbols (i.e. sections):

image

How symbols look in Markdown

As an example, here is how the symbol list looks for a typical Markdown file:

image

And the Outline contains the same but collapsable:

image
gandalfsaxe commented 6 years ago

Btw I do see there's a "LaTeX Outline", but it doesn't currently work; if I click to open it, it contains nothing:

image

And also give this error:

image
jlelong commented 6 years ago

Can you post a minimal example reproducing the LaTeX Outline problem? I thought it had been fixed.

gandalfsaxe commented 6 years ago

Huh when I checked again it works now. I'll let you know if it happens again, and if I see a pattern in what could cause it.

Anyway my feature request of using the various section levels + chapters as a symbol list still stands, it'd be really useful 🙂

werunom commented 6 years ago

+1 vote for this. Similar request has been done here.

@jlelong - the latex-outline problem fix (tracked here) probably has not yet been pushed. In my case, it is still not working. When the fix might be released?

James-Yu commented 6 years ago

Will be released shortly.

gandalfsaxe commented 6 years ago

The purpose of this issue was primarily too add chapters, sections, subsections and subsubsections to the symbols list, i.e. command ⇧⌘O on Mac, Ctrl+Shift+O and Windows. Is that what's being released shortly? This wasn't really about populating an outline in the sidebar, but making that same outline available in the symbols list.

The only symbol I've noticed being detected is for figures. Symbols for various levels of sections would be much more useful.

James-Yu commented 6 years ago

Sections worked originally. The new release is not about providing a new feature but refining it. If there is no outline shown for your project for now, pleae provide your source file since it is currently working for other projects.

gandalfsaxe commented 6 years ago

@James-Yu I want to distinguish between outline being available in the sidebar, which I suspect you may be talking about vs. outline being available in "Go to symbol in file" command (workbench.action.gotoSymbol), which is really what this issue was about.

James-Yu commented 6 years ago

Actually in either versions of the extension, the outline view can be populated by the LaTeX content. If it's empty, something wrong happened.

In the current version:

image

image

If the outlines above is not expected behavior, please give a more concrete example.

gandalfsaxe commented 6 years ago

Ok here are concrete examples 🙂

This is the outline you're talking about

screenshot 2018-09-09 at 17 02 20

This is the "current file symbol list" I'm talking about

screenshot 2018-09-09 at 17 03 22

It's populated by equations and figures right now. What I would like to see is the same content of "Outline / LaTeX Outline" in this symbol list.

What the symbol list looks like with markdown

screenshot 2018-09-09 at 17 04 34

Basically I want the same of LaTeX

The purpose of having sections in symbol list

..is to be able to quickly jump to a section using fuzzy search. Such is possible with Markdown in VSCode (using the "Markdown All in One" extension, or as demonstrated here for the markdown editor Caret:

I think it'd be fine to have both figures, equations and outline in the symbols list, i.e. not have the outline replace, but added to the current list of symbols.

James-Yu commented 6 years ago

It is implemented in the current new version. An example: wechat photo editor_20180910103257 It is unlikely that figures and tables will be included due to the complex syntax structures these two floats have.

gandalfsaxe commented 6 years ago

Ah, excellent! Very nice.

As for figures and tables, why not just include the figure/table label if it exists, otherwise the caption if it exist, otherwise just list a generic figure? That's what happens if you "Go to Symbol in Workspace..." (⌘T) anyway:

image
James-Yu commented 6 years ago

Because regex seems not powerful enough to identify which environment the current \caption is in. I'll look into it, but it seems not quite likely.

James-Yu commented 6 years ago

This one should serve the purpose.

image

gandalfsaxe commented 6 years ago

Yes I think that’s good actually.

It’s strange the commands are called the same, with the distinction of being symbols in file and symbols in workspace. Obviously it’s also a different set of symbols l, not just a question of scope.

Anyway this issue is surely concluded now with a satisfying conclusion. Thanks for your work.