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

Add formatting option for ignoring multiline statements #62

Closed
rcjsuen opened this issue Jun 14, 2019 · 6 comments
Closed

Add formatting option for ignoring multiline statements #62

rcjsuen opened this issue Jun 14, 2019 · 6 comments

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Jun 14, 2019

RUN apt-get update -y && \
    apt-get install -y curl && \
            git \
            make

For some instructions where the RUN has multiple "layers" like the above, users may not want it to be reformatted back to the following.

RUN apt-get update -y && \
    apt-get install -y curl && \
    git \
    make
@tagirb
Copy link

tagirb commented Jul 28, 2020

Hi @rcjsuen, thanks a lot for working on this project! Are there any plans on fixing this issue?

I don't know if it'd be easier to implement, but to me it looks even better if ampersands && are moved to the next line:

RUN apt-get update -y \
    && apt-get install -y \
        git \
        make

So, essentially you just need to indent the lines not starting with && by one level.

@rcjsuen
Copy link
Owner Author

rcjsuen commented Jul 28, 2020

Hi @rcjsuen, thanks a lot for working on this project! Are there any plans on fixing this issue?

@tagirb The desire is there but I haven't really acted on it due to microsoft/language-server-protocol#567 which makes the experience of toggling this cumbersome for some LSP clients. I suppose I could always implement it and then improve on it later so that there's at least a temporary stopgap.

I don't know if it'd be easier to implement, but to me it looks even better if ampersands && are moved to the next line:

RUN apt-get update -y \
    && apt-get install -y \
        git \
        make

So, essentially you just need to indent the lines not starting with && by one level.

This suggestion would probably work better as a separate enhancement request. Most shells work with && but I believe PowerShell does not use that syntax.

@rcjsuen
Copy link
Owner Author

rcjsuen commented Feb 27, 2021

I know this has taken a long time to get addressed but clients can now ignore multiline instructions when calling the API. I've opened #88 to add a flag to the CLI to support this.

@diegocars
Copy link

diegocars commented May 26, 2021

@rcjsuen how do we ignore it? got here from this thread btw microsoft/vscode-docker#2004

@rcjsuen
Copy link
Owner Author

rcjsuen commented May 26, 2021

@rcjsuen how do we ignore it? got here from this thread btw microsoft/vscode-docker#2004

@diegocars Thanks for reaching out and bringing this to my attention. This isn't possible in the extension at the moment but it can be with a fix. I'll take a look.

@rcjsuen
Copy link
Owner Author

rcjsuen commented May 27, 2021

@diegocars I've opened microsoft/vscode-docker#2976 to enable support for this option in the VS Code extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants