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] Specify Path of Compiled pdf File #423

Open
davidleejy opened this issue Jan 26, 2024 · 7 comments
Open

[Feature] Specify Path of Compiled pdf File #423

davidleejy opened this issue Jan 26, 2024 · 7 comments

Comments

@davidleejy
Copy link

davidleejy commented Jan 26, 2024

At the moment, the compiled pdf file is saved in the same directory as the typ file, and with the same name as the typ file.

In this feature request, I would like to propose the possibility of offering users the option to:

1. Specify the location to save the compiled pdf file.
Recognizing relative paths (with respect to the directory containing the typ file) will be convenient for specifying the compiled pdf file to be saved in directories nearby.

2. Specify the filename of the compiled pdf file.

These two features would help users like myself who are trying to get the compiled pdf to appear in the directory above the typst file's directory as depicted in this file structure:

parent-dir/
├─ Intro-Set-Theory.pdf     (this is the compiled pdf)
├─ intro-set-theory/
│  ├─ main.typ      (this is the typ file that will be compiled)
│  ├─ template.typ
│  ├─ theorems.typ
│  ├─ math-scripts.typ

In #420, someone asked what might the UI look like, and I replied with two possibilities off the top of my head:

1. Each project has its own config file to specify preferences. This config file is optional and exists to specify preferences deviating from defaults.
This is similar to the commonly encountered concept of a project's directory housing a file with project-specific preferences for an IDE's configuration, compilation instructions, or git.

2. A single "central" Typst LSP config file that specifies preferences for all projects.

Possibility (2) appears to be less convenient than (1) should there arise the need to share preferences among co-authors. In (1), an author could commit the config file alongside their project's typ files to, say, a shared git repository, and a co-author cloning the repository would experience the preference settings "just work out of the box" without needing to copy-and-paste preferences into his own Typst LSP config file if possibility (2) had instead been effected.

Thank you for reading, and would be happy to receive feedback/suggestions from others.

@Myriad-Dreamin
Copy link
Collaborator

Myriad-Dreamin commented Jan 26, 2024

A previous PR #39 tried to solve that.

@Myriad-Dreamin
Copy link
Collaborator

(1) sounds more sensible than (2), because a project knows yield to some directory or with even specific file name, but a global configuration doesn't. It sounds like a task specific parameter in VSCode.
(2) is a personal preference that change the default behavior that: generate all PDF in the parent directory of their main file. It sounds like a user/workspace preference in VSCode.
similar idea can migrate to other editors.

Both of them makes sense to me, but it is a problem that how LSP manages them. At least, we still don't have any configuration file for a document.

@davidleejy
Copy link
Author

davidleejy commented Jan 26, 2024

Thanks for weighing in @Myriad-Dreamin . If the contributors/maintainers would like, I'm ready to close this issue and move ongoing discussions to Issue #39 .

@Myriad-Dreamin
Copy link
Collaborator

Since #39 is an old PR and inactive, we can keep discussions in this issue.

@Euphrasiologist
Copy link

I'm keen on this change. Is it worth continuing on with the old PR?

@harrysw1729
Copy link

I could be misunderstanding the OP here. Sorry if that's the case.

Given that VS Code supports workspace settings that override user settings in case of conflicts, the two possibilities suggested by the OP don't appear mutually exclusive. Users just need to specify the relative path for storing the compiled outputs in the extension's settings. Whether the path parameter should be project-specific or global is determined by whether the user writes the config to VS Code's user or workspace settings.

@Eutropios
Copy link

I could be misunderstanding the OP here. Sorry if that's the case.

Given that VS Code supports workspace settings that override user settings in case of conflicts, the two possibilities suggested by the OP don't appear mutually exclusive. Users just need to specify the relative path for storing the compiled outputs in the extension's settings. Whether the path parameter should be project-specific or global is determined by whether the user writes the config to VS Code's user or workspace settings.

The issue is that not everybody who uses this language server uses it with VSCode. As this is the only language server for typst, a lot of people use it in Neovim. The feature that this issue is addressing (the ability to specify an output directory) is not present within the language server itself, whereas the ability to compile a pdf onSave is.

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

5 participants