Skip to content

Config file location #11

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

Open
zaneduffield opened this issue Feb 14, 2025 · 0 comments · May be fixed by #24
Open

Config file location #11

zaneduffield opened this issue Feb 14, 2025 · 0 comments · May be fixed by #24
Labels
enhancement New feature or request

Comments

@zaneduffield
Copy link
Collaborator

The current version of the plugin will use the active project's root directory as the working directory for the pasfmt subprocess, which means that the search for the config file will begin there.

Usually, this will be what the user wants, but there may be some scenarios for which it is not:

  1. multiple projects are open and they format a file 'from' a project other than the active one, then the config file from the 'wrong' project will be used
  2. a file that's not a part of the current project is formatted and an unrelated config file (from the active project) is used.

A better method might be to set the working directory to the parent directory of the file being formatted, which will allow pasfmt to search upwards and find the closest pasfmt.toml file. With this method you would need to handle the case where the active editor isn't yet saved to a file, and still pick something as the working directory.

A related topic is whether the plugin should provide a setting to explicitly override the configuration file, corresponding to the --config-file CLI option of pasfmt.

@fourls fourls added the enhancement New feature or request label Feb 20, 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

Successfully merging a pull request may close this issue.

2 participants