madskristensen/JavaScriptPrettier

How to set options?

Alex-Sokolov opened this issue · 4 comments

Installed product versions

  • Visual Studio: 2015 Enterprise
  • This extension: 1.0.19

Description

How to set options (https://github.com/prettier/prettier#api) via Visual Studio extension?

Steps to recreate

  1. Install extension
  2. Trying to set singleQuotes for example

Current behavior

No way to do it

Expected behavior

Extension options of config file for that

That isn't possible today, but it makes sense to add it

@madskristensen The latest release of prettier added support for config files. According to their documentation

prettier docs

Prettier uses cosmiconfig for configuration file support. This means you can configure prettier via:
A .prettierrc file, written in YAML or JSON.
A prettier.config.js file that exports an object.
A "prettier" key in your package.json file.
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn't) found.

So I am guessing all you need to do is update prettier in the vs extension, then the end-user adds .prettierrc to the root of the project :)

This is available in the newest CI version. Just place a prettier config file in the root of your project. I will close the issue when a new version is published to the public gallery