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

Option for local indentconfig.yaml or paths: in latexindent.yaml #516

Closed
torik42 opened this issue Feb 8, 2024 · 6 comments
Closed

Option for local indentconfig.yaml or paths: in latexindent.yaml #516

torik42 opened this issue Feb 8, 2024 · 6 comments
Labels
enhancement enhancement which might be to an existing feature or the development of a new feature feature-request user-centred feature request for an enhancement to an existing feature, or for a new feature implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix

Comments

@torik42
Copy link

torik42 commented Feb 8, 2024

I would like to have an option to specify local indentconfig.yaml files, or even better, include the paths: functionality in all the yaml configuration files.

Please correct me, if this is already possible. I couldn’t find anything in the documentation and couldn’t make it work. I tried to use

# latexindent.yaml
paths:
- /absolute/path/to/config.yaml

in the local directory and call latexindent with -l switch. The indent.log shows

INFO:  YAML settings read: -l switch
       Multiple localSettings found, separated by commas:
       localSettings.yaml, latexindent.yaml, .localSettings.yaml, .latexindent.yaml
       Adding latexindent.yaml to YAML read paths
INFO:  YAML settings, reading from the following files:
       Reading USER settings from latexindent.yaml
       ---
       paths:
         - /absolute/path/to/config.yaml

INFO:  Backup procedure (-w flag active):

So the /absolute/path/to/config.yaml was never read.

The idea is to have several configuration files with different replacements/configurations (the focus is on replacements, I think) and then choose the correct one according to the project. If the paths: entry would be parsed for every configuration file, one could even nest configuration files. This would be useful to allow for fine-grained selection and still providing a preselection in a single file which just loads multiple paths.

@cmhughes cmhughes added the feature-request user-centred feature request for an enhancement to an existing feature, or for a new feature label Feb 9, 2024
@cmhughes
Copy link
Owner

cmhughes commented Feb 9, 2024

Many thanks, this sounds reasonable and, I hope, fairly straight forward to implement.

@cmhughes
Copy link
Owner

For my reference, it'll be this loop that needs updating

foreach my $settings (@absPaths) {

Note that it'll need to be documented that paths can not be specified using the y switch.

@cmhughes cmhughes added the enhancement enhancement which might be to an existing feature or the development of a new feature label Apr 7, 2024
@torik42
Copy link
Author

torik42 commented Apr 15, 2024

If anyone else is interested, as a workaround, I currently use

export LATEXINDENT_CONFIG=$(pwd)/indentconfig.yaml

to load a specific subset of additional rules with

# indentconfig.yaml
paths:
- path/to/default.yaml
- path/to/other-config-1.yaml
- path/to/other-config-2.yaml

It’s still not possible to nest them, but one can have multiple lists for different purposes.

@cmhughes
Copy link
Owner

This is implemented as of 1a629f2

It'll be part of the next release. Please leave this issue open until I've made the release, hopefully coming soon...

@cmhughes cmhughes added the implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix label Apr 28, 2024
@cmhughes
Copy link
Owner

implemented and released at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.24

@cmhughes
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement enhancement which might be to an existing feature or the development of a new feature feature-request user-centred feature request for an enhancement to an existing feature, or for a new feature implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix
Projects
None yet
Development

No branches or pull requests

2 participants