@@ -18,7 +18,7 @@ let logger: LiquidJavaLogger;
1818let statusBarItem : vscode . StatusBarItem ;
1919let currentDiagnostics : LJDiagnostic [ ] ;
2020let webviewProvider : LiquidJavaWebviewProvider ;
21- let currentFilePath : string | undefined ;
21+ let currentFile : string | undefined ;
2222
2323/**
2424 * Activates the LiquidJava extension
@@ -35,7 +35,8 @@ export async function activate(context: vscode.ExtensionContext) {
3535
3636 const activeEditor = vscode . window . activeTextEditor ;
3737 if ( activeEditor && activeEditor . document . languageId === "java" ) {
38- currentFilePath = activeEditor . document . uri . fsPath ;
38+ currentFile = activeEditor . document . uri . fsPath ;
39+ webviewProvider ?. sendMessage ( { type : "file" , file : currentFile } ) ;
3940 }
4041 await applyItalicOverlay ( ) ;
4142
@@ -132,16 +133,17 @@ function initWebview(context: vscode.ExtensionContext) {
132133 webviewProvider . onDidReceiveMessage ( message => {
133134 console . log ( "received message" , message ) ;
134135 if ( message . type === "ready" ) {
135- webviewProvider . sendMessage ( { type : "diagnostics" , diagnostics : currentDiagnostics , file : currentFilePath } ) ;
136+ webviewProvider . sendMessage ( { type : "file" , file : currentFile } ) ;
137+ webviewProvider . sendMessage ( { type : "diagnostics" , diagnostics : currentDiagnostics } ) ;
136138 }
137139 } )
138140 ) ;
139141 // listen for active text editor changes
140142 context . subscriptions . push (
141143 vscode . window . onDidChangeActiveTextEditor ( editor => {
142144 if ( editor && editor . document . languageId === "java" ) {
143- currentFilePath = editor . document . uri . fsPath ;
144- webviewProvider ?. sendMessage ( { type : "diagnostics " , diagnostics : currentDiagnostics , file : currentFilePath } ) ;
145+ currentFile = editor . document . uri . fsPath ;
146+ webviewProvider ?. sendMessage ( { type : "file " , file : currentFile } ) ;
145147 }
146148 } )
147149 ) ;
@@ -330,6 +332,6 @@ function handleLJDiagnostics(diagnostics: LJDiagnostic[]) {
330332 } else {
331333 updateStatusBar ( "passed" ) ;
332334 }
333- webviewProvider ?. sendMessage ( { type : "diagnostics" , diagnostics, file : currentFilePath } ) ;
335+ webviewProvider ?. sendMessage ( { type : "diagnostics" , diagnostics } ) ;
334336 currentDiagnostics = diagnostics ;
335337}
0 commit comments