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

Unable to handle sequential tokens #1

Closed
JGLAHE opened this issue Apr 13, 2024 · 1 comment · Fixed by #2
Closed

Unable to handle sequential tokens #1

JGLAHE opened this issue Apr 13, 2024 · 1 comment · Fixed by #2
Assignees

Comments

@JGLAHE
Copy link

JGLAHE commented Apr 13, 2024

Hey, thanks for taking time to develop this great extension!

I don't work with frontend stuff (mostly scripting) and 50% of time this extension does what I need...

However, consider the following perl code block:

 die   qq{\n \$abs_filepath undefined or empty.\n}                           . EXIT_MSG_     unless  undef_empty($abs_filepath);
die                   qq{\n Absolute path '$abs_filepath' does not exist.\n}         .       EXIT_MSG_  unless     -e          $abs_filepath;
        die        qq{\n Absolute file path '$abs_filepath' is not a regular file.\n} . EXIT_MSG_            unless -f          $abs_filepath;
  die             qq{\n Absolute file path '$abs_filepath' is not readable.\n}  .     EXIT_MSG_      unless -r          $abs_filepath;

Maybe I'm mis-interpreting how the setting work, but it currently takes me several steps modifying settings.json and re-running (and manual editing) to get:

        die qq{\n \$abs_filepath undefined or empty.\n}                        . EXIT_MSG_ unless undef_empty($abs_filepath);
        die qq{\n Absolute path '$abs_filepath' does not exist.\n}             . EXIT_MSG_ unless -e          $abs_filepath;
        die qq{\n Absolute file path '$abs_filepath' is not a regular file.\n} . EXIT_MSG_ unless -f          $abs_filepath;
        die qq{\n Absolute file path '$abs_filepath' is not readable.\n}       . EXIT_MSG_ unless -r          $abs_filepath;

My at any given step, my setting.json would be e.g.

    "autoalign.moveableItems": [
        "=",
        //":",
        "+=",
        "-="
    ],
    "autoalign.nonMoveableItems": [
        "==",
        "!=",
        "*",
        "<=",
        ">=",
        "=<",
        "for(",
        "for (",
        "if(",
        "if (",
        "-(",
        "- (",
        "(\"",
        "('",
        "(`",
        "=~",
        "&:",
        ">:",
        "*:",
        "::",
        ":active",
        ":checked",
        ":disabled",
        ":empty",
        ":enabled",
        ":first-",
        ":focus",
        ":hover",
        ":in-range",
        ":invalid",
        ":lang",
        ":last-",
        ":link",
        ":not",
        ":nth-",
        ":only-",
        ":optional",
        ":out-of-range",
        ":read-",
        ":required",
        ":root",
        ":target",
        ":valid",
        ":visited",
        "`",
        "http:",
        "https:"
    ],
    "autoalign.nonMoveableItemsAdditional": [
        //"/",
        //": ",
        ".\n}",

    ],
    "autoalign.minSeparationLeft": 0,
    "autoalign.moveableItemsAdditional": [
        //" die",
        " unless",
        //"#",
        //" .",
        //"=>"
    ],
    "autoalign.skipLinesEndingWithItems": [

        //"{",
        //"["
    ],
    "autoalign.skipLinesEndingWithItemsAdditional": [

    ],
    "autoalign.columnWidth": 1,
    "autoalign.separationRight": 0,
}

where .\n} in

    "autoalign.nonMoveableItemsAdditional": [
        //"/",
        //": ",
        ".\n}",

isn't recognized, meaning I have to delete the "." in the printing statement and use " .", to match the concatenation operator, thus

    "autoalign.moveableItemsAdditional": [
        //" die",
        " unless",
        //"#",
        " .",
        //"=>"
    ],

However, it seems only one token can be active at a time, e.g. if autoalign.moveableItemsAdditional was set as above, only the " ." would be aligned, and the " unless" would be ignored, meaning several iterations are required to get all tokens aligned).

Is there an obvious solution to this that I'm missing?

Cheers, thanks again!

@DungGramer DungGramer self-assigned this Apr 14, 2024
@DungGramer DungGramer linked a pull request Apr 14, 2024 that will close this issue
@DungGramer
Copy link
Owner

Hi JGLAHE,
I wanted to let you know that I've released a new version of the repository that addresses the bug you reported.

With this solution, I added config delimiter, you can define what character want to align.
Example:
image

Please check out the latest version and let me know if everything works as expected.

If you find the repository helpful, I'd really appreciate it if you could star it or leave a comment. This helps me a lot and encourages me to keep improving the project.

Thank you for your support and feedback!

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

Successfully merging a pull request may close this issue.

2 participants