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

How to keep comments on their own lines after formating #1348

Closed
blachawk opened this issue Feb 19, 2018 · 6 comments
Closed

How to keep comments on their own lines after formating #1348

blachawk opened this issue Feb 19, 2018 · 6 comments

Comments

@blachawk
Copy link

blachawk commented Feb 19, 2018

I have a general question in regards to Beautify css/sass/scss/less by michelaemelluso for Visual Studio Code.

Within LESS files, when we format our documents by pressing ALT+SHIFT+F

How can we keep our comments on their own lines?

Right now if I have the following scenerio...

.demoa {
text-align:left;
}
//demob instructions for LESS note visibility only
.demob {
text-align: right
}

and then format, it ends up like this....

.demoa {
text-align:left;
}//demob instructions for LESS note visibility only
.demob {
text-align: right
}

I don't want the comment to bump up to previous lines. I want my LESS comment to be on it's own line.

Any tips on that?

@bitwiseman
Copy link
Member

bitwiseman commented Mar 1, 2018

When I put the following into the website, the comment is maintained on it's own line:

<style>
	.demoa {
		text-align: left;
	}

	//demob instructions for LESS note visibility only
	.demob {
		text-align: right
	}
</style>

Internally, this uses the css beautifier on the text inside the style tags. I'm not sure what would be causing the behavior you described. Is that VS Code plugin using the latest version?

@pawelzwronek
Copy link

@bitwiseman you can see this behavior on http://jsbeautifier.org/

@blachawk
Copy link
Author

@bardiharborow that's because you are not really in a style-sheet, you are using the style element on another page, perhaps an html page.

@bitwiseman
Copy link
Member

@pawelzwronek
Strange. I tried it on the website and it didn't happen, and now it does. :| Adding to the milestone.

@ghost
Copy link

ghost commented Apr 19, 2018

There is a pull request that should address this issue: #1291. It's waiting on a review.

@bitwiseman bitwiseman modified the milestones: v1.7.x, v1.7.6 May 21, 2018
@djmtype
Copy link

djmtype commented May 24, 2018

I just wanted to add, inside .scss files, regular css comments (/* comment */) are kept on their own line, but sass-flavored comments (// comment) are not.

@bitwiseman bitwiseman modified the milestones: v1.8.0-rc2, 1.8.0 Aug 22, 2018
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

4 participants