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

[Feature] option to disable auto formatting on retrieve #1729

Closed
JoernBerkefeld opened this issue Sep 23, 2024 · 3 comments · Fixed by #1846 or #1847
Closed

[Feature] option to disable auto formatting on retrieve #1729

JoernBerkefeld opened this issue Sep 23, 2024 · 3 comments · Fixed by #1846 or #1847
Assignees
Labels
c/asset COMPONENT c/query COMPONENT c/script COMPONENT e/IDE EPIC enhancement New feature or request; requires increasing the minor version of mcdev. Jira issue-type "Story"
Milestone

Comments

@JoernBerkefeld
Copy link
Contributor

Hello there!

My team started working with mcdev recently and we noticed that retrieve calls seem to be running some form of source formatting on asset files retrieved. For example, below is a snippet of AMPScript that is present within SFMC:

/* Logic to display Membership for Membership Types */
IF (
    @showbanner
    AND (
        (@MembershipTier == 'STUDIOMEMBER' AND @ShowMemberStudioBanner == 'false')
        OR (@MembershipTier == 'ESSENTIALMEMBER' AND @ShowEssentialBanner == 'false')
        OR (@MembershipTier == 'NONMEMBER' AND @ShowNonMemberBanner == 'false')
        OR (EMPTY(@IMAGE_1))
        OR (EMPTY(@IMAGE_LINK_1))
    )
) THEN
    SET @showbanner = false
ENDIF

Now, here is what is retrieved by mcdev:

/* Logic to display Membership for Membership Types */
    IF (         @showbanner AND (             (@MembershipTier == 'STUDIOMEMBER' AND @ShowMemberStudioBanner == 'false') OR (@MembershipTier == 'ESSENTIALMEMBER' AND @ShowEssentialBanner == 'false') OR (@MembershipTier == 'nonmember' AND @ShowNonMemberBanner == 'false') OR ( EMPTY(@IMAGE_1)) OR (EMPTY(@IMAGE_LINK_1))         )     ) THEN
        SET @showbanner = false
    ENDIF

Within vscode workspace settings, I have "editor.formatOnSave": false. Any ideas?

Thanks!

Andrew

Originally posted by @AndrewEllis91 in #1728

@JoernBerkefeld JoernBerkefeld added this to the 7.5.0 milestone Sep 23, 2024
@JoernBerkefeld JoernBerkefeld added e/IDE EPIC enhancement New feature or request; requires increasing the minor version of mcdev. Jira issue-type "Story" labels Sep 23, 2024
@JoernBerkefeld JoernBerkefeld modified the milestones: 7.5.0, 7.4.5 Nov 5, 2024
@JoernBerkefeld JoernBerkefeld added c/asset COMPONENT c/query COMPONENT c/script COMPONENT labels Nov 5, 2024
@JoernBerkefeld
Copy link
Contributor Author

Brain dump:

Could add a config option that will govern this in general, plus an option for retrieve and deploy to change the setting on the fly?

Maybe the config option could allow setting this per type, like with validation rules - or more easily, like with the default retrieve list?

@JoernBerkefeld JoernBerkefeld self-assigned this Nov 8, 2024
@JoernBerkefeld
Copy link
Contributor Author

JoernBerkefeld commented Nov 8, 2024

final solution:

  • options.formatOnSave added to config
  • retrieve & deploy command have new option --format, allowing you to override options.formatOnSave=false during runtime
  • retrieve & deploy command have new option --no-format, allowing you to override options.formatOnSave=true during runtime

Copy link

github-actions bot commented Nov 8, 2024

Closed by #1846.

@JoernBerkefeld JoernBerkefeld mentioned this issue Nov 8, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/asset COMPONENT c/query COMPONENT c/script COMPONENT e/IDE EPIC enhancement New feature or request; requires increasing the minor version of mcdev. Jira issue-type "Story"
Projects
None yet
1 participant