Latex-workshop: Includegraphics autocompletion misses the first subdirectory level

Created on 12 Apr 2020  路  14Comments  路  Source: James-Yu/LaTeX-Workshop

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, and check that you still see this issue. [Required]

You still see this issue?: Yes

Make sure to visit the wiki FAQ before filling an issue.

You visited the wiki?: Yes

If your issue is with compiling a document (not having to do with finding the root file of a project), check first that you can compile manually.

You can compile a TeX document manually?: Not applicable

Describe the bug [Required]

When trying to autocomplete an \includegraphics call the first level of directories inside the root directory is ignored. For example if the root rirectory tree is

rootdir -> root.tex
           -> dir1
                -> dir11
                     fig1.pdf
                     fig2.pdf
                -> dir12

the autocompletion only shows dir11/ as first proposal.

Note that \input autocompletion works fine with the same directory tree.
I tried changing the setting of latex-workshop.intellisense.file.base which should not make a difference in my case and that doesn't change the behavior.
In my actual directory the subdirectories are called Images and Logos so no fancy names here.

To Reproduce

Steps to reproduce the behavior:
Except testing on an own document, not sure what could be a relevant way to reproduce this

Expected behavior

An \includegraphics auto completion that does not ignore the first sub-directory level.

Logs [Required]

Please paste the whole log messages here, not parts of ones. It is very important to identify problems.

LaTeX Workshop Output [Required]

To access the log, click the 'TeX' icon on the Activity Bar on the left side, select 'View Log Messages', then select 'View LaTeX Workshop extension log'.

[17:53:17] Found root file from active editor: d:\BambOoxX\test\test.tex
[17:53:17] Root file remains unchanged from: d:\BambOoxX\test\test.tex.
[17:53:23] BUILD command invoked.
[17:53:23] Found root file from active editor: d:\BambOoxX\test\test.tex
[17:53:23] Root file remains unchanged from: d:\BambOoxX\test\test.tex.
[17:53:23] Building root file: d:\BambOoxX\test\test.tex
[17:53:23] Build root file d:\BambOoxX\test\test.tex
[17:53:23] Recipe step 1: arara, --verbose,d:\BambOoxX/test/test
[17:53:23] cwd: d:\BambOoxX\test
[17:53:23] LaTeX build process spawned. PID: 13508.
[17:53:23] File watcher: responding to change in d:\BambOoxX\test\test.tex
[17:53:23] Parsing d:\BambOoxX\test\test.tex
[17:53:23] Parse fls file.
[17:53:23] Cannot find fls file.
[17:53:31] Recipe of length 1 finished. PID: 13508.
[17:53:31] Successfully built d:\BambOoxX\test\test.tex.
[17:53:31] No PDF viewer connected for d:\BambOoxX\test\test.pdf
[17:53:31] Parse fls file.
[17:53:31] Cannot find fls file.
[17:53:31] SyncTex after build invoked.
[17:53:31] Open external viewer for syncTeX from d:\BambOoxX\test\test.pdf

Developer Tools Console [Required]

To access the log, click 'help' -> 'Toggle Developer Tools. Paste anything suspicious.

[Paste the log here]

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop [Required]

  • OS: Windows 10
  • VS Code version: 1.44.0
  • Extension version: 8.8.0
  • TeX distribution version: MiKTeX 2.9.7380

Additional questions

Are you using LaTeX Workshop with VS Code Remote?

No

Additional context

Add any other context about the problem here.

All 14 comments

It should show all directories containing image files. To debug your issue, we need a minimal working example to reproduce it. In particular, post the file structure under dir1.

Well, don't ask me why, but after changing the root directory name to something dummy and then changing it back to its original name, it works fine. Sorry for disturbing your sunday.

Sorry to bother you again, but the problem resurfaced. This time, I cannot solve it by switching the root tex name or the root directory name.
I tried to reproduce it with the same directory structure but located in my desktop directory and that works fine. The only things I can think of are :

  • The absolute path in the test case is much shorter (34 vs 99) characters
  • The files are located on the system partition while on the problematic case they are on a data partition (which are also two physically different drives).

I know you asked me for a minimal working example to reproduce, but since I am myself unable to show the problem on such an example on my system, would you have any suggestions to help corner the issue ?

This sounds a bit strange.
Could any information from https://github.com/James-Yu/LaTeX-Workshop/wiki/Intellisense#files be helpful?

I do not think that the location of the file system is problematic. On the contrary, I remember at some point that the was a limit on the number of characters for intellisense (hard coded in vscode) microsoft/vscode/issues/74133, microsoft/vscode/issues/77391

Hmm, that's interesting. Unfortunatly I already checked for the extension specific intellisense settings, but it doesn't change the behavior.
It might be related to this 128 character limit, which is probably reached when searching for a subfile in my root directory.
Do you know if there is a way with the console to see the raw Intellisense output ?

Do you know if there is a way with the console to see the raw Intellisense output ?

Unfortunately, I do not think so. The easiest way would be to use run the extension within VSCode debugger, see https://github.com/James-Yu/LaTeX-Workshop/blob/master/CONTRIBUTING.md

Then you need to look into https://github.com/James-Yu/LaTeX-Workshop/blob/master/src/providers/completer/input.ts

A possibly related question, I saw somewhere that the extension parses a graphicspath call. Does it make any inclusions to this by itself ?

I'm asking this because I jsut found out that my document compiles fine even when missing the firs picture directory level, while I do not use any \graphicspath.

My bad, found, an old one.

Ok, so this seems to be the reason. When commenting the graphicspath call, everythin goes back to normal. Is this the expectec behavior of the \graphicspath parsing by the extension ?

@jlelong Any ideas on the source of this behavior (pure curiosity)

When some graphics paths are defined, only the files under those directories are listed for completion. Is this your question? If not, what behaviour are you referring to?

Ok, then the behavior I had was the expected one. Surprinsingly, I saw nothing about this in the FAQ. Can you confirm ? If there is no information about this at the moment, it could help other users to add an item about this detail in the FAQ, don't you think ?

I agree that this is not as crystal clear as it should be https://github.com/James-Yu/LaTeX-Workshop/wiki/Intellisense#files
I will fix it.

I believe, you omitted a not In your previous comment ^^

New FAQ entry: https://github.com/James-Yu/LaTeX-Workshop/wiki/FAQ#autocompletion-for-includegraphics-seems-incomplete

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BjoernDaase picture BjoernDaase  路  3Comments

LordScree picture LordScree  路  5Comments

mdrozdo picture mdrozdo  路  4Comments

tenhobi picture tenhobi  路  4Comments

TiemenSch picture TiemenSch  路  6Comments