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

Formatter entry commands in activity bar #1006

Open
Myriad-Dreamin opened this issue Dec 16, 2024 · 6 comments
Open

Formatter entry commands in activity bar #1006

Myriad-Dreamin opened this issue Dec 16, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@Myriad-Dreamin
Copy link
Owner

@QuarticCat @Enter-tainer

Motivation

When I upgrade the integrated formatter, I have to Ctrl+S all files (about 50 files) to format and check them. I want to have formatting commands to automate that.

Description

It would be great to provide at least two commands:

  • A command that formats all files in workspace.
  • A command that formats all files depended by current document. This is suitable for people who maintain many documents in a workspace.

After providing commands, we can register them to the sidebar to tell people that they exist:

image

@Enter-tainer
Copy link
Collaborator

alternatively, you can try the cli. it comes with a format-all command. just let you know.

@Myriad-Dreamin
Copy link
Owner Author

Myriad-Dreamin commented Dec 16, 2024

alternatively, you can try the cli. it comes with a format-all command. just let you know.

I know it, but then it is not testing the functionality of integrated formatter. This is the major motivation.

@Eric-Song-Nop
Copy link
Collaborator

A command that formats all files depended by current document. This is suitable for people who maintain many documents in a workspace.
一个格式化当前文档所依赖的所有文件的命令。这适合在工作区维护多个文档的人。

This feature seems to be too much extra work, I don't think it's that useful. Just format all files in the workspace(or a directory recursively) seems good enough for almost all cases.

@QuarticCat
Copy link
Contributor

QuarticCat commented Dec 18, 2024

Since Typst doesn't have a project structure, it would be hard to define "all files". For example, I don't want it to traverse node_modules (imagine a large project using Typst doc).

Or we can only format dependencies, but that might not be sufficient (imagine we have multiple entries).

In either case, I won't use this command. CLI would be much more flexible.

@Myriad-Dreamin
Copy link
Owner Author

Since Typst doesn't have a project structure, it would be hard to define "all files". For example, I don't want it to traverse node_modules (imagine a large project using Typst doc).

Or we can only format dependencies, but that might not be sufficient (imagine we have multiple entries).

In either case, I won't use this command. CLI would be much more flexible.

I'm not sure what are you arguing about. But what I am sure is that the mentioned problem is a common curse. All tools scanning input directories recursively will run into this curse. For example, googling "rust-analyzer node_modules" you'll see some complaints that rust-analyzer hasn't solved it completely. So do you'll face similar situation when using the typstyle CLI.

@QuarticCat
Copy link
Contributor

It's easy to feed arguments to CLI. But not so for LSP commands.

@Myriad-Dreamin Myriad-Dreamin added the enhancement New feature or request label Dec 20, 2024
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