Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more subcommands and arguments in tectonic -X watch --exec especially on VSCode #1168

Open
KagaJiankui opened this issue Mar 4, 2024 · 0 comments

Comments

@KagaJiankui
Copy link

KagaJiankui commented Mar 4, 2024

I'm trying to use the V2 CLI tectonic -X watch --exec compile on VSCode. Under three different contexts, the CLI gives out three different abnormalities:

  1. If tectonic -X watch --exec compile is invoked in a seperate Powershell7 terminal running in Windows Terminal, it runs forever into a deadloop due to the change made to intermediate file filename.aux. Designating "compile src/filename.tex -o build/filename --hide build/filename/filename.aux" or "--keep-intermediates" gives the relief.
  2. If tectonic -X watch --exec "compile ./src/${filename.tex}" is invoked by VSCode tasks, tectonic complaining about
    error: unexpected argument './src/filename.tex' found
    Usage: watch [OPTIONS]
    For more information, try '--help'.
    
  3. This is the most strange part. Either invoke the tectonic -X watch --exec compile without any arguments provided to compile by task or in VSCode terminal (with "terminal.integrated.persistentSessionReviveProcess": "never" configured), tectonic complain about
    [Running `"tectonic.exe" -X compile ./src/report_lab2.tex --keep-intermediates --synctex -o ./build/report_lab2`]
    'tectonic.exe' 不是内部或外部命令,也不是可运行的程序
    或批处理文件。
    [Finished Running. Exit Status: 1]
    

But if launch VSCode from Powershell in (1), the command works again magically, only when invoked in VSCode Terminal. Echoing the environment variables to a txt and compare them in VSCode tells no difference.

Directory Structure

+---.vscode
|       tasks.json
|
+---build
|   \---filename
|           filename.aux
|           filename.log
|           filename.pdf
|           filename.synctex.gz
|
\---src
    |   listingset.tex
    |   filename.pdf
    |   filename.tex
    |
    \---index.assets
            20240303235337.png
            20240303235723.png

listingset.tex and contents of index.assets are dependencies required by filename.tex, which contains no \write18.

VSCode Tasks

Erroneous

    {
      "label": "Tectonic - Watch", // This one does not work
      "type": "shell",
      "command": "tectonic",
      "isBackground": true,
      "args": [
        "-X",
        "watch",
        "--exec",
        "\"compile",
        "./src/${fileBasenameNoExtension}.tex",
        "-o",
        "./build/${fileBasenameNoExtension}\""
        // "-x",
        // "--print"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "presentation": {
        "reveal": "silent"
      },
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "problemMatcher": {
        "owner": "LaTeX",
        "fileLocation": [
          "autoDetect",
          "${workspaceFolder}/src"
        ],
        "pattern": [
          {
            "regexp": "^(info|note|warning|error):\\s?(.*\\.(tex|cls|bib|sty)):(\\d+):(\\d*)\\s?(.*)$",
            "file": 2,
            "line": 4,
            "endColumn": 5,
            "severity": 1,
            "message": 6
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "^\\[Running `tectonic\\.exe -X .+`\\]",
          "endsPattern": "^\\[Finished.*Status: \\d+\\]"
        }
      }
    }

Working

{
      "label": "Tectonic - Compile", // This one works
      "type": "shell",
      "command": "tectonic",
      "isBackground": true,
      "args": [
        "-X",
        "compile",
        "--synctex",
        "--keep-intermediates",
        "--keep-logs",
        "./src/${fileBasenameNoExtension}.tex",
        "-o",
        "${workspaceFolder}/build/${fileBasenameNoExtension}"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "presentation": {
        "reveal": "silent"
      },
      "options": {
        "cwd": "${workspaceFolder}"
      },
      "problemMatcher": {
        "owner": "LaTeX",
        "fileLocation": [
          "autoDetect",
          "${workspaceFolder}/src"
        ],
        "pattern": [
          {
            "regexp": "^(info|note|warning|error):\\s?(.*\\.(tex|cls|bib|sty)):(\\d+):(\\d*)\\s?(.*)$",
            "file": 2,
            "line": 4,
            "endColumn": 5,
            "severity": 1,
            "message": 6
          }
        ],
        "background": {
          "activeOnStart": true,
          "beginsPattern": "^\\[Running `tectonic\\.exe -X .+`\\]",
          "endsPattern": "^\\[Finished.*Status: \\d+\\]"
        }
      }
    }
@KagaJiankui KagaJiankui changed the title [FR&Bug] Support more subcommands and arguments in tectonic -X watch --exec especially on VSCode Support more subcommands and arguments in tectonic -X watch --exec especially on VSCode Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant