James-Yu / LaTeX-Workshop

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

Setting Root Tex-document via sytem variable. #2360

Closed EliseyP closed 4 years ago

EliseyP commented 4 years ago

Can be root document's path saved (as path of current opened document, f.g.) to system variable (in linux at least) and used with higher priotitet than other ways (magic comment, searching etc)? This way allows us to work like TexStudio, Kile etc. It can be saved and cleaned via f.g. menu item.

tamuratak commented 4 years ago

It is totally unclear what you are saying. If you want a feature similar to TexStudio or Kile, please paste a link to the documentation.

EliseyP commented 4 years ago

Should I create new issue with more clearing info or add it there?

jlelong commented 4 years ago

Add it here. We will reopen the issue if needed.

EliseyP commented 4 years ago

As about TexStudio and explicitly set root document:

From documentation: 4.1.1 Root Document

As a last resort, you may set an explicit root document via Options -> Root Document -> Set Current Document As Explicit Root. This setting takes absolute precedence. All the commands of the "Tools" menu will be called on this document, ... no matter which document is active in the editor.

And I think that such feature - explicit setting root document can be useful. Not always we can set it via magic comment or via searching. Sometimes I need f.g. edit .sty file and qiuckly recompile tex document with opened .sty file in editor (sty-file in other folder).

As for realization such feature - I think about system variable (at least in linux). We can open in VS Code our root document and via special menu item set this document as root => save path this opened document to system variable f.g. ${VS_LW_ROOT_DOCUMENT}. And after this we can close this document, open any other sub-documents, but all build commands will be relate to our explicitly set root document - we can read this path from ${VS_LW_ROOT_DOCUMENT}. And if root document explicitly set, other ways not working.

Any time, if we need usual ways (magic comments, searching, etc), we can clear this explicitly set root document => set ${VS_LW_ROOT_DOCUMENT} to "".

As an example, it looks like this in TexStudio menu:

Screenshot_20201103_112837

At closing VS Code ${VS_LW_ROOT_DOCUMENT} variable can be cleared, or opposite, saved and used at next start Vs Code. Such behavior can be set in Latex-Workshop settings.

Sorry for my English.

tamuratak commented 4 years ago

Out of the scope of the extension.

If you find a case where the auto-detection of root files does not work, it is a bug. Please report the case as a new issue.