When file completion starts working in the \input{}
or \include{}
macros, it opens the first-level folder but you can't select second and lower-level folders. It's extremely inconvenient if you have a lot of includes organized into directory hierarchy.
Also, file completion inserts the file path using the \\
symbol which becomes interpreted as the start of the macro instead of part of the file path. Windows perfectly understands the /
symbol in file paths so you can safely unify the behavior between platforms.
If there's no resources to fix it, I can work on the fix myself, if somebody points me to the place in the codebase where the file completion resides.
Attached a screenshot with what I'm seeing each time I try to autocomplete a file path inside
include
. Cursor is at the end of the line and I pressedCtrl+Space
.latexcompleter.cpp
if (flags & CF_FORCE_GRAPHIC) {
QString fn = lineText.mid(start, c.columnNumber() - start);
int lastIndex = fn.lastIndexOf(QDir::separator());
if (lastIndex >= 0)
start = start + lastIndex + 1;
if (fn.isEmpty())
fn = workingDir + QDir::separator();
the fi(QDir... seems to givs odd results on windows, works fine on linux.
The code is already changed a bit, so I have not tried if it still fails on win.
Interesting enough, after I built the project on Windows with Qt 5.8.0 (MinGW compiler), autocompletion started working as it should.
However, it faithfully completes with Windows-style backslash (and spurious .tex extension as well) which results in the "undefined control sequence" error messages.
It's interesting how it can be solved. I suggest I will add some postprocessing to the
fi.absolutePath()
with converting of backslash to forward slash. Or someone will. This is harmless on Windows and we don't have any other choice anyway, as backslash insideinclude
macro is still considered a special character parsable by LaTeX.I just wanted to submit the same bug. Any progress? Auto-completion would be so nice, if it didn't use the backslash.
The bug is still open, so no further progress.