rajasegar / alacritty-themes

:rainbow: :lollipop: Themes :candy: :heart_eyes: for Alacritty: A cross-platform GPU-accelerated Terminal emulator
MIT License
685 stars 70 forks source link

Using alacritty-themes deindent commented out sections in the default yaml file #259

Open Naeddyr opened 11 months ago

Naeddyr commented 11 months ago

Trying out alacritty for the first time, and came across this; also first time configuring anything with YAML.

When alacritty-themes is run to change the configuration yaml-file, it deindents commented lines in the default alacritty.yaml you can get from here.

Example configuration:

# Font configuration
#font:
  # Normal (roman) font face
  #normal:
    # Font family
    #
    # Default:
    #   - (macOS) Menlo
    #   - (Linux/BSD) monospace
    #   - (Windows) Consolas
    #family: monospace

    # The `style` can be specified to pick a specific face.
    #style: Regular

is turned into:

# Font configuration
#font:
# Normal (roman) font face
#normal:
# Font family
#
# Default:
#   - (macOS) Menlo
#   - (Linux/BSD) monospace
#   - (Windows) Consolas
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Regular

The comments are indented before the #, so apparently whatever yaml-parser is being used by alacritty-themes removes the "superfluous" white-space before it, breaking the formatting of the commented example yaml-sections and breaking the configuration without apparent cause.

I'm not sure where the issue really should be put, alacritty project (the comment indenting could be done differently) or here (the comment indenting is affecting this project and maybe there's a yaml flag that lets you keep all whitespace), but it's more likely someone will care about it here, so here you go.

rajasegar commented 11 months ago

@Naeddyr I think the problem is we are not properly stringifying the yaml document with proper indentation https://github.com/rajasegar/alacritty-themes/blob/5438488f67665640987bde3033851d4081d7531c/index.js#L98C25-L98C25