nova-prettier icon indicating copy to clipboard operation
nova-prettier copied to clipboard

Format Selection doesn't work

Open ricardo-lewis opened this issue 4 years ago • 4 comments

Editor > Prettier > Format works fine, but Editor > Prettier > Format Selection does not.

ricardo-lewis avatar Oct 14 '21 00:10 ricardo-lewis

Do you have some info on what kind of file & selection it doesn't work with? And have you tried different selections in different types of files? Also, can you share the output from the extension console. To see it first enable extension development in Preferences > General. Then you can open the console through Extensions > Show extension console

alexanderweiss avatar Oct 24 '21 10:10 alexanderweiss

I have the same issue. I tried TypeScript files and CSS files. When I look at the Debug Pane, it just says 'Formatting -file-' followed by 'No changes for -file-'.

WillemSleegers avatar Nov 09 '21 12:11 WillemSleegers

It's not working for me either. Here is the output of the extentions console.

Prettier[16:12:47.139000] Formatting /Users/david/Sites/project/index.html
Prettier[16:12:47.270000] No changes for /Users/david/Sites/project/index.html

Here is my .prettierrc

{
	"proseWrap": "preserve",
	"bracketSameLine": true,
	"singleQuote": true,
	"endOfLine": "lf",
	"printWidth": 100,
	"order": "smacss",
	"tabWidth": 2,
	"useTabs": true
}

this was the selection i tried to format. I just wanted it to shorten the lines.

<main class="container">
        <h2>What is this landing page about?</h2>
	<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam ipsum voluptatum accusamus quos a. Magni facere inventore officiis, in consectetur sunt qui odio facilis debitis accusantium nisi praesentium iste delectus.</p>
	<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Vel quasi eligendi quibusdam asperiores unde animi voluptas aut hic cupiditate suscipit!</p>

	<h2>Tell Me More</h2>
	<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Animi incidunt qui molestiae laborum dolore, error nam odit laboriosam sit. Ipsa perferendis dolorum non ullam, quod libero nemo officiis quis? Vitae temporibus pariatur repudiandae veniam quia illum hic qui, ab ullam.</p>

</main>

davidbdyer avatar Apr 18 '23 20:04 davidbdyer

This seems to be an issue with Prettier's HTML parser (and some others like Vue). I can't seem to get it to work with the Prettier CLI either so I don't quite understand how it works in VSCode.

alexanderweiss avatar May 01 '23 10:05 alexanderweiss