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

Enable formatter to skip instructions that span multiple lines #2976

Merged
merged 1 commit into from
May 27, 2021

Conversation

rcjsuen
Copy link
Contributor

@rcjsuen rcjsuen commented May 27, 2021

Some users want to format instructions that span multiple lines in Dockerfiles themselves. The new setting added here will allow users to decide whether instructions that span multiple lines should be ignored by the formatter or not.

FROM scratch
RUN echo && \
            echo && \
                echo && \
        echo
  1. Create the Dockerfile above.
  2. Format the document. The lines in the RUN instruction will be formatted.
  3. Undo the change so that it's back to its original form.
  4. Open the settings.json file and add the following setting.
{
    "docker.languageserver.formatter.ignoreMultilineInstructions": true
}
  1. Format the document again. The RUN instruction should not be formatted.

This fixes #992 and #2004.

Some users want to format instructions that span multiple lines in
Dockerfiles themselves. The new setting added here will allow users to
decide whether instructions that span multiple lines should be ignored
by the formatter or not.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
@karolz-ms
Copy link
Contributor

Thank you, Remy! 🤗

@karolz-ms karolz-ms merged commit ef8dc97 into microsoft:main May 27, 2021
@rcjsuen rcjsuen deleted the formatter-ignore-multiline branch May 27, 2021 16:44
@rcjsuen
Copy link
Contributor Author

rcjsuen commented May 27, 2021

@karolz-ms Thanks for the quick review. Have a good day!

@microsoft microsoft locked and limited conversation to collaborators Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep indentation for multiline statements
2 participants