showyourwork / showyourwork

A workflow for reproducible and open scientific articles

Home Page:https://show-your.work

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VSCode integration instructions don't seem to work anymore

HealthyPear opened this issue · comments

Following the instructions described here
https://show-your.work/en/latest/faqs/#using-latex-workshop-in-vscode

the build doesn't start.

I think the underlying issue is that now calling just showyourwork is deprecated and one needs to use the build subcommand,

It is unclear to me how to make it work from the settings.json file because latex-workshop.latex.external.build.command is supposed to be a single command so showyourwork build fails with [13:43:45.988]

[Build] LaTeX build process spawned with PID undefined.
[13:43:45.989][Build] LaTeX fatal error on PID undefined. Error: spawn showyourwork build ENOENT
[13:43:45.989]Error: spawn showyourwork build ENOENT
	at ChildProcess._handle.onexit (node:internal/child_process:283:19)
	at onErrorNT (node:internal/child_process:476:16)
	at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
[13:43:45.990][Build] Does the executable exist? $PATH: /Users/michele/Applications/miniforge3/envs/showyourwork/bin:/Users/michele/Applications/miniforge3/condabin:/Users/michele/Applications/rust/bin:/Library/TeX/texbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/michele/Applications/rust/bin, $Path: undefined, $SHELL: /bin/bash

#342 might be related to this.

Thanks for raising this. I don't really use VSCode these so I'm probably not the right person to help debug, but would it work if you add "build" to "latex-workshop.latex.external.build.args"?

Yes sorry I forgot to show also the outcome of that try

Usage: showyourwork [OPTIONS] COMMAND [ARGS]...
Try 'showyourwork --help' for help.

Error: No such command 'build --conda-frontend=mamba'.

If it can help, I opened this discussion upstream

James-Yu/LaTeX-Workshop#4150

maybe it's something that is possible from there (or a bug)

Ah wait: if I use only build as build.args it works!

OK the right thing to do is

"latex-workshop.latex.external.build.command": "showyourwork",
    "latex-workshop.latex.external.build.args": [
        "build",
        "--conda-frontend=mamba"
    ],

I can maybe update the docs? those instructions for sure don't work because it just calls the CLI help

we should test/update also the recipes/tools combination accordingly

I can maybe update the docs? those instructions for sure don't work because it just calls the CLI help

Please open a PR with this update - thanks!

Please open a PR with this update - thanks!

OK!


Regarding the recipe/tool case I can't seem to make it work though: my best guess was an analogue fix wrt what is in the docs right now

"latex-workshop.latex.recipe.default": "showyourwork",
    "latex-workshop.latex.recipes": [
        {
            "name": "showyourwork",
            "tools": [
                "showyourwork"
            ]
        }
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "showyourwork",
            "command": "showyourwork",
            "args": [
                "build",
                "--conda-frontend=mamba",
            ],
            "env": {}
        },
    ],

but it fails with

The `showyourwork` command must be called from the top level of a git repository.
`showyourwork` by itself runs a document build. Did you mean to run `showyourwork setup`?

so it's like if, contrary to using latex-workshop.latex.external.build.command it doesn't know where to run it.

I tried to add "--project %WORKSPACE_FOLDER%" to the tool's args, but same result.

Said this, I don't think one actually needs the recipe/tools approach at all as the docs suggest

If you also want to use LaTeX Workshop’s AutoBuild on save (or on file change), you can add the following lines to the settings file

this is not necessary if you do just

{
    "latex-workshop.latex.external.build.command": "showyourwork",
    "latex-workshop.latex.external.build.args": [
        "build",
        "--conda-frontend=mamba"
    ],
    "latex-workshop.latex.autoBuild.run": "onSave",
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.latex.outDir": "%WORKSPACE_FOLDER%"
}