Search code examples
jsonvisual-studio-codelatexvscode-extensions

Why is the `latex-workshop` extension ignoring the clean up file extensions?


I am using the Latex Workshop extension (https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop) to edit Tex files on Mac OS using VS Code. A useful feature of this extension is cleaning up intermediary files. Ideally, I'd like to keep only the tex file and the pdf generated from compilation.

The extension supports a given setting in VS Code where it theoretically allows one to select what extensions will be erased upon the clean up command. My current settings.json file looks like this (only the very end is relevant, I believe):

{
    "r.rpath.mac": "/Users/raul/miniconda3/envs/disagreement/lib/R/bin/R",
    "r.rterm.mac": "/Users/raul/miniconda3/envs/disagreement/bin/radian",
    "r.bracketedPaste": true,
    "r.rterm.option": [],
    "workbench.editorAssociations": {
        "*.pdf": "pdf.preview"
    },
    "python.defaultInterpreterPath": "/Users/raul/miniconda3/bin/python",
    "notebook.lineNumbers": "on",
    "python.terminal.launchArgs": [
        "-m",
        "IPython",
        "--no-autoindent",
        ],
    "python.terminal.executeInFileDir": true,
    "[python]": {
        "editor.defaultFormatter": "ms-python.python",
        "editor.formatOnType": true
    },
    "editor.minimap.enabled": false,
    "jupyter.interactiveWindow.textEditor.executeSelection": true,
    "git.ignoreLegacyWarning": true,
    "quarto.render.renderOnSave": true,
    "cSpell.enableFiletypes": [
        "quarto"
    ],
    "cSpell.userWords": [
        "matplotlib"
    ],
    "workbench.colorTheme": "Atom One Light",
    "cSpell.enabled": false,
    "latex-workshop.latex.clean.fileTypes": [
        "%DOCFILE%.aux",
        "%DOCFILE%.bbl",
        "%DOCFILE%.blg",
        "%DOCFILE%.idx",
        "%DOCFILE%.ind",
        "%DOCFILE%.lof",
        "%DOCFILE%.lot",
        "%DOCFILE%.out",
        "%DOCFILE%.toc",
        "%DOCFILE%.acn",
        "%DOCFILE%.acr",
        "%DOCFILE%.alg",
        "%DOCFILE%.glg",
        "%DOCFILE%.glo",
        "%DOCFILE%.gls",
        "%DOCFILE%.fls",
        "%DOCFILE%.log",
        "%DOCFILE%.fdb_latexmk",
        "%DOCFILE%.snm",
        "%DOCFILE%.synctex(busy)",
        "%DOCFILE%.synctex.gz(busy)",
        "%DOCFILE%.nav",
        "%DOCFILE%.vrb",
        "*/*.nav",
        "%DOCFILE%.synctex.gz"
    ],
    "latex-workshop.latex.clean.subfolder.enabled": true
}

Notice how I have included "*.nav" among the options, for example. But if I try to compile a given file and then clean the auxiliary ones, I still get ".nav" files:

enter image description here

Does anyone know what's going on?


Solution

  • To configure the LaTeX Workshop extension to use the latex-workshop.latex.clean.fileTypes option, it is necessary to specify the method to be used with the following command:

    "latex-workshop.latex.clean.method": "glob",
    

    Your extension might have employed the cleanMethod: latexmk option.

    Tip: use the setting "latex-workshop.latex.autoClean.run": "onBuilt", to automatically clean them every time you build.