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

Ignoring multi line comments #135

Open
Nishant-Pall opened this issue Sep 8, 2021 · 0 comments
Open

Ignoring multi line comments #135

Nishant-Pall opened this issue Sep 8, 2021 · 0 comments

Comments

@Nishant-Pall
Copy link

Is there a way to make prettier ignore commented lines inside the file that's supposed to be formatted?
I noticed this when I commented a whole function, and once I execute :Prettier, Prettier stripped out the indentation and basically pushed all of the lines above each other with no spaces to the left. Something like this.

Before calling :Prettier

//const reducer = (state = initialState, action) => {
    //switch (action.type) {
        //case BUY_CAKE:
            //return {
                //...state,
                //numOfCakes: state.numOfCakes - 1,
            //};
        //case BUY_ICECREAM:
            //return {
                //...state,
                //numOfIceCreams: state.numOfIceCreams - 1,
            //};
        //default:
            //return state;
    //}
//};

and after calling :Prettier

//const reducer = (state = initialState, action) => {
//switch (action.type) {
//case BUY_CAKE:
//return {
//...state,
//numOfCakes: state.numOfCakes - 1,
//};
//case BUY_ICECREAM:
//return {
//...state,
//numOfIceCreams: state.numOfIceCreams - 1,
//};
//default:
//return state;
//}
//};

It does work in vscode, but apparently doesnt in neovim

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

No branches or pull requests

1 participant