.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / .release / 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 your 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 ## Settings
60
61 ### Prettier's Settings
62
63 Settings will be read from (listed by priority):
64
65 1. [Prettier configuration file](https://prettier.io/docs/en/configuration.html)
66 1. `.editorconfig`
67
68 Or if no prettier configuration file exist
69
70 1. `.editorconfig`
71 1. Coc prettier's settings (described below with their default)
72
73 #### prettier.printWidth (default: 80)
74
75 Fit code within this line limit
76
77 #### prettier.tabWidth (default: 2)
78
79 Number of spaces it should use per tab
80
81 #### prettier.singleQuote (default: false)
82
83 If true, will use single instead of double quotes
84
85 #### prettier.trailingComma (default: 'none')
86
87 Controls the printing of trailing commas wherever possible. Valid options:
88
89 - "none" - No trailing commas
90 - "es5" - Trailing commas where valid in ES5 (objects, arrays, etc)
91 - "all" - Trailing commas wherever possible (function arguments)
92
93 #### prettier.bracketSpacing (default: true)
94
95 Controls the printing of spaces inside object literals
96
97 #### prettier.jsxBracketSameLine (default: false)
98
99 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
100
101 #### prettier.parser (default: 'babylon') - JavaScript only
102
103 Which parser to use. Valid options are 'flow' and 'babylon'.
104
105 #### prettier.semi (default: true)
106
107 Whether to add a semicolon at the end of every line (semi: true),
108 or only at the beginning of lines that may introduce ASI failures (semi: false)
109
110 #### prettier.useTabs (default: false)
111
112 If true, indent lines with tabs
113
114 #### prettier.proseWrap (default: 'preserve')
115
116 (Markdown) wrap prose over multiple lines.
117
118 #### prettier.arrowParens (default: 'avoid')
119
120 Include parentheses around a sole arrow function parameter
121
122 ### Coc specific settings
123
124 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-configuration-file) for how to do that.
125
126 #### prettier.formatterPriority (default: 1) - priority of fomatter
127
128 Change it to `-1` if you don't want prettier to have higher priority than
129 formatter provided by other language server.
130
131 #### prettier.eslintIntegration (default: false) - JavaScript and TypeScript only
132
133 Use _[prettier-eslint](https://github.com/prettier/prettier-eslint)_ instead of _prettier_.
134 Other settings will only be fallbacks in case they could not be inferred from ESLint rules.
135
136 #### prettier.tslintIntegration (default: false) - JavaScript and TypeScript only
137
138 Use _[prettier-tslint](https://github.com/azz/prettier-tslint)_ instead of _prettier_.
139 Other settings will only be fallbacks in case they could not be inferred from TSLint rules.
140
141 #### prettier.stylelintIntegration (default: false) - CSS, SCSS and LESS only
142
143 Use _[prettier-stylelint](https://github.com/hugomrdias/prettier-stylelint)_ instead of _prettier_.
144 Other settings will only be fallbacks in case they could not be inferred from stylelint rules.
145
146 #### prettier.requireConfig (default: false)
147
148 Require a 'prettierconfig' to format
149
150 #### prettier.ignorePath (default: .prettierignore)
151
152 Supply the path to an ignore file such as `.gitignore` or `.prettierignore`.
153 Files which match will not be formatted. Set to `null` to not read ignore files. Restart required.
154
155 #### prettier.disableLanguages (default: ["vue"])
156
157 A list of languages IDs to disable this extension on. Restart required.
158 _Note: Disabling a language enabled in a parent folder will prevent formatting instead of letting any other formatter to run_
159
160 #### prettier.statusItemText (default: "Prettier")
161
162 Text of status item indicating current buffer can't be formatted by prettier.
163
164 ## Prettier resolution
165
166 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.
167
168 ### ESLint and TSLint Integration
169
170 `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.
171
172 `eslint`, `tslint`, and all peer dependencies required by your specific configuration must be installed locally. Global installations will not be recognized.
173
174 ## Contribute
175
176 Feel free to open issues or PRs!