Skip to content

Commit

Permalink
feat: support custom configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
simonguo committed Feb 2, 2024
1 parent 80c411b commit e53b4c4
Show file tree
Hide file tree
Showing 13 changed files with 1,593 additions and 105 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ out
node_modules
.vscode-test/
*.vsix
yarn.lock
yarn.lock
.DS_Store
4 changes: 2 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"printWidth": 100,
"tabWidth":2,
"singleQuote":true
"tabWidth": 2,
"singleQuote": true
}
5 changes: 5 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js'
});
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ src/**
.gitignore
tsconfig.json
vsc-extension-quickstart.md
tslint.json
tslint.json
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Markdown table prettier extension for Visual Studio Code.
Eg.

```
| name | email | description |
| -- | -- | --- |
| zhang | zhang@a.com | zhang |
| wang | wang@a.com | wang |
| li | [email protected] | li |
| amity | amity@a.com | amity |
| batman | batman@a.com | batman |
| name | email | description |
| ------ | ------------ | ----------- |
| amity | amity@a.com | amity |
| batman | batman@a.com | batman |
| li | [email protected] | li |
| wang | wang@a.com | wang |
| zhang | zhang@a.com | zhang |
```

Formated:
Expand All @@ -35,6 +35,25 @@ Formated:
| zhang | [email protected] | zhang |
```

## Configuration

Edit your user or workspace settings to configure the extension.

```json
// settings.json
{
"markdownTableSortPrettier.enable": true,
"markdownTableSortPrettier.sortOrder": "asc",
"markdownTableSortPrettier.sortColumn": 0,
"markdownTableSortPrettier.ignoreCharacters": ["~", " "]
}
```

- `markdownTableSortPrettier.enable` - Enable/disable markdown table sort. (default: `true`)
- `markdownTableSortPrettier.sortOrder` - Sort order, `asc` or `desc`. (default: `asc`)
- `markdownTableSortPrettier.sortColumn` - Sort column, `0` or `1` or `2`... (default: `0`)
- `markdownTableSortPrettier.ignoreCharacters` - Ignore characters. (default: `['~',' ']`)

## Referenced

- https://github.com/prettier/prettier
Expand Down
59 changes: 48 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-markdown-table-sort",
"displayName": "Markdown Table Sort",
"displayName": "Markdown Table Sort Prettier",
"description": "Markdown table prettier extension for Visual Studio Code",
"version": "1.0.4",
"license": "MIT",
Expand All @@ -17,29 +17,66 @@
"url": "https://github.com/simonguo/vscode-markdown-table-sort.git"
},
"engines": {
"vscode": "^1.22.0"
"vscode": "^1.85.0"
},
"activationEvents": [
"onLanguage:markdown"
],
"icon": "resources/logo.jpeg",
"main": "./out/extension",
"main": "./out/extension.js",
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "npm run compile && node ./node_modules/vscode/bin/test"
"pretest": "npm run compile",
"test": "vscode-test"
},
"devDependencies": {
"@types/mocha": "^2.2.42",
"@types/node": "^7.0.43",
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.6",
"@types/node": "^16.18.34",
"@types/vscode": "^1.85.0",
"@types/prettier": "^1.13.2",
"@vscode/test-cli": "^0.0.3",
"@vscode/test-electron": "^2.3.8",
"glob": "^7.1.6",
"mocha": "^8.2.1",
"tslint": "^5.8.0",
"typescript": "^2.6.1",
"vscode": "^1.1.6"
"typescript": "^5.3.3"
},
"dependencies": {
"@types/prettier": "^1.13.2",
"prettier": "^1.14.3"
},
"contributes": {
"configuration": [
{
"title": "Markdown Table Sort Prettier",
"properties": {
"markdownTableSortPrettier.enable": {
"type": "boolean",
"default": true,
"description": "Enable markdown table sort prettier"
},
"markdownTableSortPrettier.sortOrder": {
"type": "string",
"default": "asc",
"description": "Sort order, asc or desc"
},
"markdownTableSortPrettier.sortColumn": {
"type": "number",
"default": 0,
"description": "Sort column index"
},
"markdownTableSortPrettier.ignoreCharacters": {
"type": "array",
"default": [
" ",
"~"
],
"description": "Ignore characters"
}
}
}
]
}
}
}
Loading

0 comments on commit e53b4c4

Please sign in to comment.