massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / Readme.md
1 # Prettier formatter for coc.nvim
2
3 Coc extension to format your JavaScript / TypeScript / CSS / JSON using [Prettier](https://github.com/prettier/prettier).
4
5 A fork of [prettier-vscode](https://github.com/prettier/prettier-vscode)
6
7 ## Installation
8
9 Run vim command:
10
11 ```
12 :CocInstall coc-prettier
13 ```
14
15 ## Usage
16
17 ### Setup `Prettier` command in your `init.vim` or `.vimrc`
18
19 ```
20 command! -nargs=0 Prettier :CocCommand prettier.formatFile
21 ```
22
23 Then you can use `:Prettier` to format current buffer.
24
25 ### Remap keys for range format in your `init.vim` or `.vimrc`
26
27 ```
28 vmap <leader>f  <Plug>(coc-format-selected)
29 nmap <leader>f  <Plug>(coc-format-selected)
30 ```
31
32 Then you can `<leader>f` for range format.
33
34 Prettier range format only support languageId including: `javascript`,
35 `javascriptreact`, `typescript`, `typescriptreact`, `json` and `graphql`.
36
37 ### Update your `coc-settings.json` for format on save.
38
39 Open settings file with:
40
41     :CocConfig
42
43 Add:
44
45 ```
46   "coc.preferences.formatOnSaveFiletypes": ["css", "markdown"],
47 ```
48
49 to setup the languages which you want to format on save.
50
51 **Note:** prettier extension have lower priority, if the document have other
52 registered document format provider, prettier would not work.
53
54 To check the format is done by prettier, check out the output message after
55 format, which should contains `Formatted by prettier`.
56
57 To make prettier do the format, use command `:CocCommand prettier.formatFile`
58
59 To save without formatting, use `:noa w`
60
61 ## Settings
62
63 ### Prettier's Settings
64
65 Settings will be read from (listed by priority):
66
67 1. [Prettier configuration file](https://prettier.io/docs/en/configuration.html)
68 1. `.editorconfig`
69
70 Or if no prettier configuration file exist
71
72 1. `.editorconfig`
73 1. Coc prettier's settings (described below with their default)
74
75 #### prettier.printWidth (default: 80)
76
77 Fit code within this line limit
78
79 #### prettier.tabWidth (default: 2)
80
81 Number of spaces it should use per tab
82
83 #### prettier.singleQuote (default: false)
84
85 If true, will use single instead of double quotes
86
87 #### prettier.trailingComma (default: 'none')
88
89 Controls the printing of trailing commas wherever possible. Valid options:
90
91 - "none" - No trailing commas
92 - "es5" - Trailing commas where valid in ES5 (objects, arrays, etc)
93 - "all" - Trailing commas wherever possible (function arguments)
94
95 #### prettier.bracketSpacing (default: true)
96
97 Controls the printing of spaces inside object literals
98
99 #### prettier.jsxBracketSameLine (default: false)
100
101 If true, puts the `>` of a multi-line jsx element at the end of the last line instead of being alone on the next line
102
103 #### prettier.parser (default: 'babylon') - JavaScript only
104
105 Which parser to use. Valid options are 'flow' and 'babylon'.
106
107 #### prettier.semi (default: true)
108
109 Whether to add a semicolon at the end of every line (semi: true),
110 or only at the beginning of lines that may introduce ASI failures (semi: false)
111
112 #### prettier.useTabs (default: false)
113
114 If true, indent lines with tabs
115
116 #### prettier.proseWrap (default: 'preserve')
117
118 (Markdown) wrap prose over multiple lines.
119
120 #### prettier.arrowParens (default: 'avoid')
121
122 Include parentheses around a sole arrow function parameter
123
124 ### Coc specific settings
125
126 These settings are specific to Coc and need to be set in the Coc settings file. See the [documentation](https://github.com/neoclide/coc.nvim/wiki/Using-the-configuration-file) for how to do that.
127
128 #### prettier.formatterPriority (default: 1) - priority of formatter
129
130 Change it to `-1` if you don't want prettier to have higher priority than
131 formatter provided by other language server.
132
133 #### prettier.eslintIntegration (default: false) - JavaScript and TypeScript only
134
135 Use _[prettier-eslint](https://github.com/prettier/prettier-eslint)_ instead of _prettier_.
136 Other settings will only be fallbacks in case they could not be inferred from ESLint rules.
137
138 #### prettier.tslintIntegration (default: false) - JavaScript and TypeScript only
139
140 Use _[prettier-tslint](https://github.com/azz/prettier-tslint)_ instead of _prettier_.
141 Other settings will only be fallbacks in case they could not be inferred from TSLint rules.
142
143 #### prettier.stylelintIntegration (default: false) - CSS, SCSS and LESS only
144
145 Use _[prettier-stylelint](https://github.com/hugomrdias/prettier-stylelint)_ instead of _prettier_.
146 Other settings will only be fallbacks in case they could not be inferred from stylelint rules.
147
148 #### prettier.requireConfig (default: false)
149
150 Require a 'prettierconfig' to format
151
152 #### prettier.ignorePath (default: .prettierignore)
153
154 Supply the path to an ignore file such as `.gitignore` or `.prettierignore`.
155 Files which match will not be formatted. Set to `null` to not read ignore files. Restart required.
156
157 #### prettier.disableLanguages (default: ["vue"])
158
159 A list of languages IDs to disable this extension on. Restart required.
160 _Note: Disabling a language enabled in a parent folder will prevent formatting instead of letting any other formatter to run_
161
162 #### prettier.statusItemText (default: "Prettier")
163
164 Text of status item indicating current buffer can be formatted by prettier.
165
166 #### prettier.onlyUseLocalVersion (default: false)
167
168 Only use the version of prettier installed by the client, ignoring the version bundled with coc-prettier
169
170 #### prettier.disableSuccessMessage (default: false)
171
172 Disable the 'Formatted by prettier' message which is echoed every time a file is successfully formatted
173
174 ## Prettier resolution
175
176 This extension will use prettier from your project's local dependencies. Should prettier not be installed locally with your project's dependencies, a copy will be bundled with the extension.
177
178 ### ESLint and TSLint Integration
179
180 `prettier-eslint` and `prettier-tslint` are included with the installation of this extension. There is no need for a separate local or global install of either for functionality.
181
182 `eslint`, `tslint`, and all peer dependencies required by your specific configuration must be installed locally. Global installations will not be recognized.
183
184 ## Contribute
185
186 Feel free to open issues or PRs!