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

Feature: Support --pdf-standard in tinymist.typstExtraArgs #1127

Open
akshaybabloo opened this issue Jan 8, 2025 · 7 comments
Open

Feature: Support --pdf-standard in tinymist.typstExtraArgs #1127

akshaybabloo opened this issue Jan 8, 2025 · 7 comments
Labels
enhancement New feature or request

Comments

@akshaybabloo
Copy link

Describe the bug

I am following https://github.com/Myriad-Dreamin/tinymist/tree/main/editors/vscode#passing-extra-cli-arguments and I am trying to set in the PDF standard with this

{
    "tinymist.exportPdf": "never",
    "tinymist.fontPaths": [
        "fonts"
    ],
    "tinymist.typstExtraArgs": [
        "--pdf-standard=a-2b",
        "main.typ"
    ],
}

But I get an error as failed to parse typstExtraArgs: error: unexpected argument '--pdf-standard' found

Package/Software version:

VSCode version(Help -> About):

Version: 1.96.2
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Linux x64 6.8.0-49-generic

tinymist extension version: v0.11.0. Get it by tinymist --version in terminal.

tinymist 
Build Timestamp:     2025-01-02T13:41:01.157088129Z
Build Git Describe:  v0.12.16
Commit SHA:          0ba8be333f85c2885f2ac8b14a266c0a35002651
Commit Date:         None
Commit Branch:       None
Cargo Target Triple: x86_64-unknown-linux-gnu
Typst Version:       0.12.0
Typst Source:        git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist-v0.12.0#58426a90a7ef721738a01be09793d33e55eb75a9

Logs:

tinymist server log(Output Panel -> tinymist):

[2025-01-08T02:35:13Z INFO  tinymist] tinymist version information: [["Build Timestamp", "2025-01-02T13:41:01.157088129Z"], ["Build Git Describe", "v0.12.16"], ["Commit SHA", "0ba8be333f85c2885f2ac8b14a266c0a35002651"], ["Commit Date", "None"], ["Commit Branch", "None"], ["Cargo Target Triple", "x86_64-unknown-linux-gnu"], ["Typst Version", "0.12.0"], ["Typst Source", "git+https://github.com/Myriad-Dreamin/typst.git?tag=tinymist-v0.12.0#58426a90a7ef721738a01be09793d33e55eb75a9"]]
[2025-01-08T02:35:13Z INFO  tinymist] starting Language server: LspArgs {
        mirror: MirrorArgs {
            mirror: "",
            replay: "",
        },
        font: CompileFontArgs {
            font_paths: [],
            ignore_system_fonts: false,
        },
    }
[2025-01-08T02:35:13Z INFO  sync_lsp] handling initialize - (0) at Instant { tv_sec: 1327036, tv_nsec: 294963560 }
[2025-01-08T02:35:13Z INFO  tinymist::init] color theme: Some("dark")
[2025-01-08T02:35:13Z INFO  tinymist::server] LanguageState: initialized with config Config { const_config: ConstConfig { position_encoding: Utf16, cfg_change_registration: true, notify_will_rename_files: true, tokens_dynamic_registration: true, tokens_overlapping_token_support: false, tokens_multiline_token_support: false, doc_line_folding_only: true, doc_fmt_dynamic_registration: true }, compile: CompileConfig { output_path: PathPattern(""), export_pdf: Never, font_opts: CompileFontArgs { font_paths: [], ignore_system_fonts: false }, system_fonts: None, font_paths: [], fonts: OnceCell(Uninit), notify_status: true, periscope_args: None, typst_extra_args: None, color_theme: Some("dark"), has_default_entry_path: false, lsp_inputs: {}, entry_resolver: EntryResolver { root_path: None, roots: ["/home/akshay/code/personal/phd-thesis"], entry: None } }, semantic_tokens: Enable, formatter_mode: Disable, formatter_print_width: Some(120), support_html_in_markdown: true, completion: CompletionFeat { trigger_on_snippet_placeholders: false, trigger_suggest: true, trigger_parameter_hints: true, trigger_suggest_and_parameter_hints: true, postfix: Some(true), postfix_ufcs: Some(true), postfix_ufcs_left: Some(true), postfix_ufcs_right: Some(true), postfix_snippets: None } }
[2025-01-08T02:35:13Z INFO  sync_lsp] handled  initialize - (0) in 434.11µs
[Error - 15:35:13] Server initialization failed.
  Message: failed to parse typstExtraArgs: error: unexpected argument '--pdf-standard' found

  tip: to pass '--pdf-standard' as a value, use '-- --pdf-standard'

Usage: typst-cli [OPTIONS] [INPUT]

For more information, try '--help'.

  Code: -32602 
[Error - 15:35:13] Tinymist Typst Language Server client: couldn't create connection to server.
  Message: failed to parse typstExtraArgs: error: unexpected argument '--pdf-standard' found

  tip: to pass '--pdf-standard' as a value, use '-- --pdf-standard'

Usage: typst-cli [OPTIONS] [INPUT]

For more information, try '--help'.

  Code: -32602 

tinymist client log(Help -> Toggle Developer Tools -> Console):

console.ts:137 [Extension Host] rejected promise not handled within 1 second: Error: Client is not running
EYi @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
console.ts:137 [Extension Host] stack trace: Error: Client is not running
    at Cp.sendRequest (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:39:114255)
    at qc.executeCommand (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:60:1364)
    at jS (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7319)
    at ds (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7065)
EYi @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
mainThreadExtensionService.ts:78 [myriad-dreamin.tinymist]Client is not running
$onExtensionRuntimeError @ mainThreadExtensionService.ts:78
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
mainThreadExtensionService.ts:79 Error: Client is not running
    at Cp.sendRequest (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:39:114255)
    at qc.executeCommand (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:60:1364)
    at jS (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7319)
    at ds (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7065)
$onExtensionRuntimeError @ mainThreadExtensionService.ts:79
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
console.ts:137 [Extension Host] rejected promise not handled within 1 second: Error: Client is not running
EYi @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
console.ts:137 [Extension Host] stack trace: Error: Client is not running
    at Cp.sendRequest (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:39:114255)
    at qc.executeCommand (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:60:1364)
    at jS (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7319)
    at ds (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7065)
EYi @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
mainThreadExtensionService.ts:78 [myriad-dreamin.tinymist]Client is not running
$onExtensionRuntimeError @ mainThreadExtensionService.ts:78
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
mainThreadExtensionService.ts:79 Error: Client is not running
    at Cp.sendRequest (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:39:114255)
    at qc.executeCommand (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:60:1364)
    at jS (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7319)
    at ds (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7065)
$onExtensionRuntimeError @ mainThreadExtensionService.ts:79
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
console.ts:137 [Extension Host] rejected promise not handled within 1 second: Error: Client is not running
EYi @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
console.ts:137 [Extension Host] stack trace: Error: Client is not running
    at Cp.sendRequest (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:39:114255)
    at qc.executeCommand (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:60:1364)
    at jS (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7319)
    at ds (/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7065)
EYi @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
mainThreadExtensionService.ts:78 [myriad-dreamin.tinymist]Client is not running
$onExtensionRuntimeError @ mainThreadExtensionService.ts:78
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
mainThreadExtensionService.ts:79 Error: Client is not running
    at Cp.sendRequest (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:39:114255)
    at qc.executeCommand (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:60:1364)
    at jS (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7319)
    at ds (vscode-file://vscode-app/home/akshay/.vscode/extensions/myriad-dreamin.tinymist-0.12.16-linux-x64/out/extension.js:71:7065)
$onExtensionRuntimeError @ mainThreadExtensionService.ts:79
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1243
fire @ event.ts:1274
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
@Enter-tainer
Copy link
Collaborator

does typst-cli support this --pdf-standard=a-2b?

@akshaybabloo
Copy link
Author

does typst-cli support this --pdf-standard=a-2b?

Yes it does, here is the output for typst watch --help (screenshot below)

image

@akshaybabloo
Copy link
Author

Can't say for sure. If you are importing Typst 0.12.0 (saw this is the Cargo.toml) you maybe using the latest version of the CLI too? Not sure how the typst-cli is used in the code.

@Eric-Song-Nop
Copy link
Collaborator

This argument is just not suported yet, for now only the following arguments are supported I think:

pub struct CompileExtraOpts {
    /// The root directory for compilation routine.
    pub root_dir: Option<ImmutPath>,
    /// Path to entry
    pub entry: Option<ImmutPath>,
    /// Additional input arguments to compile the entry file.
    pub inputs: ImmutDict,
    /// Additional font paths.
    pub font: CompileFontArgs,
    /// Package related arguments.
    pub package: CompilePackageArgs,
    /// The creation timestamp for various output.
    pub creation_timestamp: Option<chrono::DateTime<chrono::Utc>>,
    /// Path to certification file
    pub cert: Option<ImmutPath>,
}

@Enter-tainer
Copy link
Collaborator

Can't say for sure. If you are importing Typst 0.12.0 (saw this is the Cargo.toml) you maybe using the latest version of the CLI too? Not sure how the typst-cli is used in the code.

Just a side note: we do use typst. But we use it as a library. typst-cli is not directly used. So we may miss updates in it. In this case, we didn't support pdf standard yet.

@akshaybabloo
Copy link
Author

akshaybabloo commented Jan 9, 2025

Okay, then I will change this ticket to a feature ticket

@akshaybabloo akshaybabloo changed the title Setting tinymist.typstExtraArgs gives errors Request: Support --pdf-standard in tinymist.typstExtraArgs Jan 9, 2025
@akshaybabloo akshaybabloo changed the title Request: Support --pdf-standard in tinymist.typstExtraArgs Feature: Support --pdf-standard in tinymist.typstExtraArgs Jan 9, 2025
@Myriad-Dreamin Myriad-Dreamin added the enhancement New feature or request label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants