Skip to content

Commit

Permalink
feat: add option to change color decoration type
Browse files Browse the repository at this point in the history
  • Loading branch information
voorjaar committed May 22, 2021
1 parent aeb92e1 commit 166147b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Browse your utilities usages, have an overview of your design system, identify "
| `windicss.enableRemToPxPreview` | boolean | true | Enable Rem to Px Preview. |
| `windicss.enableEmmetCompletion` | boolean | false | Enable . trigger for emmet. |
| `windicss.enableCodeFolding` | boolean | false | Enable ClassNames Code Folding. |
| `windicss.colorDecoratorsType` | string | 'cube' | Configure the type of color decorations, optional ['border', 'bg', 'cube', 'picker'], default is 'cube'. |
| `windicss.foldByLength` | boolean | false | Folding code by length. Default option is false, will fold by utility count. |
| `windicss.foldCount` | number | 3 | Used by foldByCount. |
| `windicss.foldLength` | number | 25 | Used by foldByLength |
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@
"default": false,
"description": "Enable ClassNames Code Folding."
},
"windicss.colorDecoratorsType": {
"type": "string",
"default": "cube",
"description": "Configure the type of color decorations, optional ['border', 'bg', 'cube', 'picker'], default is 'cube'."
},
"windicss.foldCount": {
"type": "number",
"default": 3,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ export default class Extension {
}

registerDecorations() {
if (!this.processor) return [];
if (!this.processor || !this.get<boolean>('enableColorDecorators')) return [];
const disposables: Disposable[] = [];
const type: 'picker' | 'bg' | 'border' | 'cube' = 'bg';
const type = this.get<'picker' | 'bg' | 'border' | 'cube'>('colorDecoratorsType');
const decoration = new Decorations(this, this.processor);
if (type === 'picker') {
for (const [ext] of Object.entries(fileTypes)) {
Expand Down

0 comments on commit 166147b

Please sign in to comment.