madskristensen / JavaScriptPrettier

A Visual Studio extension
Other
157 stars 30 forks source link

How to set options? #4

Closed Alex-Sokolov closed 6 years ago

Alex-Sokolov commented 7 years ago

Installed product versions

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

madskristensen commented 7 years ago

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

enewnham commented 7 years ago

@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 :)

jesperbjensen commented 6 years ago

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

jesperbjensen commented 6 years ago

Fixed in recent release: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.JavaScriptPrettier