@@ -78,22 +78,43 @@ export class ResxProvider implements vscode.CustomTextEditorProvider {
7878 catch ( e ) {
7979 console . log ( e ) ;
8080 }
81-
81+
8282 async function updateWebview ( ) {
83+ const config = vscode . workspace . getConfiguration ( 'resx-editor' ) ;
84+ const enableColumnSorting = config . get < boolean > ( 'enableColumnSorting' , true ) ;
85+
8386 webviewPanel . webview . postMessage ( {
8487 type : 'update' ,
8588 text : JSON . stringify ( await resx . resx2js ( document . getText ( ) , true ) )
8689 } ) ;
90+
91+ webviewPanel . webview . postMessage ( {
92+ type : 'config' ,
93+ enableColumnSorting : enableColumnSorting
94+ } ) ;
8795 }
88-
96+
8997 const changeDocumentSubscription = vscode . workspace . onDidChangeTextDocument ( e => {
9098 if ( e . document . uri . toString ( ) === document . uri . toString ( ) ) {
9199 updateWebview ( ) ;
92100 }
93101 } ) ;
94102
103+ const changeConfigurationSubscription = vscode . workspace . onDidChangeConfiguration ( e => {
104+ if ( e . affectsConfiguration ( 'resx-editor.enableColumnSorting' ) ) {
105+ const config = vscode . workspace . getConfiguration ( 'resx-editor' ) ;
106+ const enableColumnSorting = config . get < boolean > ( 'enableColumnSorting' , true ) ;
107+
108+ webviewPanel . webview . postMessage ( {
109+ type : 'config' ,
110+ enableColumnSorting : enableColumnSorting
111+ } ) ;
112+ }
113+ } ) ;
114+
95115 webviewPanel . onDidDispose ( ( ) => {
96116 changeDocumentSubscription . dispose ( ) ;
117+ changeConfigurationSubscription . dispose ( ) ;
97118 } ) ;
98119
99120 webviewPanel . webview . onDidReceiveMessage ( e => {
@@ -118,8 +139,18 @@ export class ResxProvider implements vscode.CustomTextEditorProvider {
118139
119140 }
120141 } ) ;
121-
122142 updateWebview ( ) ;
143+
144+ // Send initial configuration after a small delay to ensure webview is ready
145+ setTimeout ( ( ) => {
146+ const config = vscode . workspace . getConfiguration ( 'resx-editor' ) ;
147+ const enableColumnSorting = config . get < boolean > ( 'enableColumnSorting' , true ) ;
148+
149+ webviewPanel . webview . postMessage ( {
150+ type : 'config' ,
151+ enableColumnSorting : enableColumnSorting
152+ } ) ;
153+ } , 100 ) ;
123154 }
124155
125156 private async updateTextDocument ( document : vscode . TextDocument , json : any ) {
0 commit comments