madskristensen/JavaScriptPrettier

CSHTML-files support

Alex-Sokolov opened this issue · 1 comments

Installed product versions

  • Visual Studio: 2015 Enterprise
  • This extension: 1.0.19

Description

Is it planned to add prettier-option for cshtml-files, which contain <script> tag?

Steps to recreate

  1. Open cshtml-file with javascript block
  2. Trying to prettify code

Current behavior

No way to do it

Expected behavior

Formatting code in file

It would be nice if it could work, but it will be a hard problem:

  1. Prettier does support formatting “strings of content” - but you have extra indentation that the plugin would then need to insert back. (Because your script tag is indented)
  2. You can have C# code in your script tags - prettier does not support this.
  3. We need to parse your cshtml file to find your script tags.

If someone wants to try out if it could work - then they are very welcome - but I think it’s no easy task.

Perhaps an easier thing would be to implement a “format selection” functionality instead.