Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0417cab

Browse files
committed
更新文档
更新文档
1 parent 50bae8a commit 0417cab

File tree

3 files changed

+66
-41
lines changed

3 files changed

+66
-41
lines changed

‎README.md

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@
22

33
Vue3 Snippets, Contains code highlighting, code snippets and formatting commonly used in vue2 and vue3.
44

5-
<a href="https://marketplace.visualstudio.com/items?itemName=Wscats.vue"><img src="https://img.shields.io/badge/Download-10k+-orange" alt="Download" /></a>
5+
<a href="https://marketplace.visualstudio.com/items?itemName=Wscats.vue"><img src="https://img.shields.io/badge/Download-60k+-orange" alt="Download" /></a>
66
<a href="https://marketplace.visualstudio.com/items?itemName=Wscats.vue"><img src="https://img.shields.io/badge/Macketplace-v1.x-brightgreen" alt="Macketplace" /></a>
77
<a href="https://github.com/Wscats/vue-snippets"><img src="https://img.shields.io/badge/Github Page-Wscats-yellow" alt="Github Page" /></a>
88
<a href="https://github.com/Wscats"><img src="https://img.shields.io/badge/Author-Eno Yao-blueviolet" alt="Eno Yao" /></a>
9+
910
<!-- <a href="https://github.com/Wscats"><img src="https://api.netlify.com/api/v1/badges/b652768b-1673-42cd-98dd-3fd807b2ebca/deploy-status" alt="Status" /></a> -->
1011

1112
<!-- <img src="./public/1.gif" /> -->
13+
1214
![Demo](public/1.gif)
1315

14-
You can turn on the statusbar `Auto Format Vue` switch at the bottom of vscode, which allows you to automatically format the `vue` file when you write it.
16+
You can turn on the statusbar `Auto Format Vue` switch at the bottom of vscode, which allows you to automatically format the vue file when you write it.
1517

1618
Or right-click to display the drop-down menu panel, click the `Format Document` menu item to format.
1719

1820
<!-- <img src="./public/2.gif" /> -->
21+
1922
![Demo](public/2.gif)
2023

2124
# Snippets
@@ -204,47 +207,49 @@ All code snippets of Vue 2 Snippets are also included here.
204207

205208
<!-- </details> -->
206209

207-
208210
# Extension Settings
209211

210-
- Use [js-beautify](https://github.com/beautify-web/js-beautify)'s config.
211-
- Use [pug-beautify](https://github.com/vingorius/pug-beautify)'s config.
212-
- Indent Size: default use the `editor.tabSize`.
212+
Use [Prettier](https://github.com/prettier/prettier)'s config.
213213

214214
```json
215-
{
216-
"html_indent_root": false, // If need to indent the root tag of template in ".vue" file
217-
"break_attr_limit": -1, // when attributes.length > the value,break attributes force; keep inline when -1.
218-
"attr_end_with_gt": true, // when "break_attr_limit" works, if don't use "\n" before tag's ">",default "true"
219-
"format_need": ["html", "js", "css"], // the list of need to format, default ["html", "js", "css"]. delete anyone if you don't need format.
220-
"js-beautify": {
221-
"indent_size": "editor.tabSize",
222-
"indent_char": " ",
223-
"indent_with_tabs": false,
224-
"brace-style": "collapse",
225-
"space_after_anon_function": true,
226-
"css": {},
227-
"js": {},
228-
"html": {
229-
// "force_format": ["template"],
230-
"wrap_attributes": "auto"
231-
}
232-
},
233-
"pug-beautify": {
234-
"fill_tab": false
235-
}
236-
}
237-
215+
vue3snippets.arrowParens
216+
vue3snippets.bracketSpacing
217+
vue3snippets.endOfLine
218+
vue3snippets.htmlWhitespaceSensitivity
219+
vue3snippets.insertPragma
220+
vue3snippets.jsxBracketSameLine
221+
vue3snippets.jsxSingleQuote
222+
vue3snippets.printWidth
223+
vue3snippets.proseWrap
224+
vue3snippets.quoteProps
225+
vue3snippets.requirePragma
226+
vue3snippets.semi
227+
vue3snippets.singleQuote
228+
vue3snippets.tabWidth
229+
vue3snippets.trailingComma
230+
vue3snippets.useTabs
231+
vue3snippets.vueIndentScriptAndStyle
238232
```
239233

240-
| Key | Example | Default |
241-
| ----------------------------- | ------------------------- | ------------------------- |
242-
| vue3snippets.html_indent_root | false | false |
243-
| vue3snippets.break_attr_limit | 2 | -1 |
244-
| vue3snippets.attr_end_with_gt | true | true |
245-
| vue3snippets.format_need | ["html"] | ["html", "js", "css"] |
246-
| vue3snippets.js-beautify | (See the config at front) | (See the config at front) |
247-
| vue3snippets.pug-beautify | {fill_tab: false} | {fill_tab: false} |
234+
| Key | Example | Default |
235+
| -------------------------------------- | ----------------------------- | --------- |
236+
| vue3snippets.printWidth | 10/20/30/40/n | 80 |
237+
| vue3snippets.tabWidth | 1/2/3/4/n | 2 |
238+
| vue3snippets.singleQuote | false/true | false |
239+
| vue3snippets.trailingComma | none/es5/all | es5 |
240+
| vue3snippets.bracketSpacing | true | true |
241+
| vue3snippets.jsxBracketSameLine | false/true | false |
242+
| vue3snippets.semi | false/true | true |
243+
| vue3snippets.requirePragma | false/true | false |
244+
| vue3snippets.insertPragma | false/true | false |
245+
| vue3snippets.useTabs | false/true | false |
246+
| vue3snippets.proseWrap | preserve/always/never | preserve |
247+
| vue3snippets.arrowParens | avoid/always | always |
248+
| vue3snippets.jsxSingleQuote | false/true | false |
249+
| vue3snippets.htmlWhitespaceSensitivity | css/strict/ignore | css |
250+
| vue3snippets.vueIndentScriptAndStyle | false/true | false |
251+
| vue3snippets.endOfLine | auto/lf/crlf/cr | lf |
252+
| vue3snippets.quoteProps | as-needed/consistent/preserve | as-needed |
248253

249254
# Thanks
250255

@@ -255,7 +260,6 @@ If you enjoy front end, you should have it! xie, yao, yong, ting, jing, lin, tia
255260

256261
If you think it's useful, you can leave us a [message and like it](https://marketplace.visualstudio.com/items?itemName=Wscats.vue&ssr=false#review-details), Your support is our driving force😀
257262

258-
259263
# Requirements
260264

261265
- [Prettier](https://github.com/prettier/prettier)
@@ -264,4 +268,4 @@ If you think it's useful, you can leave us a [message and like it](https://marke
264268

265269
# License
266270

267-
[Vue3 Snippets](https://marketplace.visualstudio.com/items?itemName=Wscats.vue) is released under the [MIT](http://opensource.org/licenses/MIT).
271+
[Vue3 Snippets](https://marketplace.visualstudio.com/items?itemName=Wscats.vue) is released under the [MIT](http://opensource.org/licenses/MIT).

‎extension.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,27 @@ function activate(context) {
1414
statusBarUi.StatusBarUi.notWatching();
1515
});
1616
let format = vscode.commands.registerCommand("vue3snippets.format", () => {
17+
let config = vscode.workspace.getConfiguration("vue3snippets");
18+
let options = {
19+
arrowParens: config.get("arrowParens"),
20+
bracketSpacing: config.get("bracketSpacing"),
21+
endOfLine: config.get("endOfLine"),
22+
htmlWhitespaceSensitivity: config.get("htmlWhitespaceSensitivity"),
23+
insertPragma: config.get("insertPragma"),
24+
jsxBracketSameLine: config.get("jsxBracketSameLine"),
25+
jsxSingleQuote: config.get("jsxSingleQuote"),
26+
printWidth: config.get("printWidth"),
27+
proseWrap: config.get("proseWrap"),
28+
quoteProps: config.get("quoteProps"),
29+
requirePragma: config.get("requirePragma"),
30+
semi: config.get("semi"),
31+
singleQuote: config.get("singleQuote"),
32+
tabWidth: config.get("tabWidth"),
33+
trailingComma: config.get("trailingComma"),
34+
useTabs: config.get("useTabs"),
35+
vueIndentScriptAndStyle: config.get("vueIndentScriptAndStyle"),
36+
}
37+
1738
const editor = vscode.window.activeTextEditor;
1839
const filepath = editor.document.uri.fsPath;
1940
if (!editor) throw new Error('no active editor');
@@ -23,7 +44,7 @@ function activate(context) {
2344
const start = new vscode.Position(0, 0);
2445
const end = new vscode.Position(lineCount + 1, 0);
2546
const range = new vscode.Range(start, end);
26-
const prettierText = prettier.format(text, { filepath });
47+
const prettierText = prettier.format(text, { ...options,filepath });
2748
editor.edit((editBuilder, error) => {
2849
error && window.showErrorMessage(error);
2950
editBuilder.replace(range, prettierText);

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"url": "https://github.com/Wscats"
1010
},
1111
"publisher": "Wscats",
12-
"version": "1.0.11",
12+
"version": "1.0.12",
1313
"license": "MIT",
1414
"engines": {
1515
"vscode": "^1.40.0"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /