File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 165165 "type" : " string" ,
166166 "default" : " #AED0A4" ,
167167 "description" : " Placeholder Color"
168+ },
169+ "windicss.runOnSave" : {
170+ "type" : " boolean" ,
171+ "default" : true ,
172+ "description" : " A flag that controls whether or not Windi CSS classes will be sorted on save on save."
168173 }
169174 }
170175 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { registerCompletions } from './lib/completions';
22import { registerCommands } from './lib/commands' ;
33import { registerCodeFolding } from './lib/folding' ;
44import { init } from './lib/core' ;
5- import { workspace } from 'vscode' ;
5+ import { commands , workspace } from 'vscode' ;
66import type { Core } from './interfaces' ;
77import type { ExtensionContext } from 'vscode' ;
88
@@ -32,6 +32,16 @@ export async function activate(ctx: ExtensionContext) {
3232 registerCompletions ( ctx , CORE ) ;
3333 registerCodeFolding ( ctx ) ;
3434 registerCommands ( ctx , CORE ) ;
35+
36+ // if runOnSave is enabled in settings, trigger command on file save
37+ if ( workspace . getConfiguration ( ) . get ( 'windicss.runOnSave' ) ) {
38+ ctx . subscriptions . push (
39+ workspace . onDidSaveTextDocument ( ( _e ) => {
40+ commands . executeCommand ( 'windicss.sort' ) ;
41+ } )
42+ ) ;
43+ }
44+
3545 console . log ( 'Windi CSS Intellisense is now active!' ) ;
3646}
3747
You can’t perform that action at this time.
0 commit comments