You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disable all the other extensions except for LaTeX Workshop and LaTeX Utilities, and check that you still see this issue.
You still see this issue?: Yes
Issue
The extension fails to locate definitions for custom commands declared in .cls files located in the same directory. However, these commands resolve correctly when texdef is executed manually.
Say we have a \newcommand{\testcommand}[1]{\textbf{#1}} in test20250425.cls, and a test.tex below:
% test.tex\documentclass{test20250425}
\begin{document}
\section{Introduction}
This is a test document to check the functionality of the LaTeX template.
\testcommand{123}
\end{document}
Case 1: .cls File in the Same Directory
Open test.tex, which uses a local class file test20250425.cls that defines \testcommand.
Trigger "Go to Definition" on \testcommand{123} (Command + Click / Ctrl + Click)
Observe the error: Could not find definition for \testcommand.
% /path/to/test20250425.cls, line 15:
\newcommand{\testcommand}[1]{\textbf{#1}}
Expected Behavior
The extension should correctly resolve macros defined in local .cls files and either allow users to configure the TeX engine used by texdef, or automatically detect the appropriate one based on the project context.
Bug Report
Disable all the other extensions except for LaTeX Workshop and LaTeX Utilities, and check that you still see this issue.
You still see this issue?: Yes
Issue
The extension fails to locate definitions for custom commands declared in
.clsfiles located in the same directory. However, these commands resolve correctly whentexdefis executed manually.To Reproduce
Reproduction repository: texdef-fontspec-repro
Say we have a
\newcommand{\testcommand}[1]{\textbf{#1}}intest20250425.cls, and atest.texbelow:Case 1:
.clsFile in the Same DirectoryOpen
test.tex, which uses a local class filetest20250425.clsthat defines\testcommand.Trigger "Go to Definition" on
\testcommand{123}(Command + Click / Ctrl + Click)Observe the error:
Could not find definition for \testcommand.Verify the command works manually using
texdef:texdef --source --Find --tex latex --class test20250425 \testcommandExpected output:
Case 2: Packages That Require XeLaTeX
Edit
test20250425.clsand uncomment the following lines:Trigger "Go to Definition" again. The same error persists.
Run the
texdefcommand manually, which fails with:texdef --source --Find --tex latex --class test20250425 \testcommandOutput:
Change the engine to
xelatexand rerun the command. This time it succeeds:texdef --source --Find --tex xelatex --class test20250425 \testcommandOutput:
Expected Behavior
The extension should correctly resolve macros defined in local
.clsfiles and either allow users to configure the TeX engine used bytexdef, or automatically detect the appropriate one based on the project context.Logs
LaTeX Utilities Output
Desktop
Additional context
In the extension, the process fails because
spawndoes not setcwd, so local.clsfiles can't be found.LaTeX-Utilities/src/providers/macroDefinitions.ts
Line 96 in a3265cc
See proposed fix in the corresponding PR: fix(texdef): improve error handling, set CWD, and add
--texconfig #408Preview
before.mp4