@@ -202,7 +202,8 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
202202 documentSelector : [
203203 { scheme : 'file' , language : 'java' } ,
204204 { scheme : 'jdt' , language : 'java' } ,
205- { scheme : 'untitled' , language : 'java' }
205+ { scheme : 'untitled' , language : 'java' } ,
206+ { scheme : 'vscode-notebook-cell' , language : 'java' }
206207 ] ,
207208 synchronize : {
208209 configurationSection : [ 'java' , 'editor.insertSpaces' , 'editor.tabSize' , "files.associations" ] ,
@@ -233,6 +234,11 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
233234 advancedUpgradeGradleSupport : true ,
234235 executeClientCommandSupport : true ,
235236 snippetEditSupport : true ,
237+ nonStandardJavaFormatting : {
238+ schemes : [ "vscode-notebook-cell" ] ,
239+ extensions : [ "jsh" , "jshell" , "ipynb" ] ,
240+ getContentCallback : Commands . GET_VISIBLE_EDITOR_CONTENT ,
241+ }
236242 } ,
237243 triggerFiles,
238244 } ,
@@ -511,6 +517,20 @@ export async function activate(context: ExtensionContext): Promise<ExtensionAPI>
511517
512518 context . subscriptions . push ( onConfigurationChange ( workspacePath , context ) ) ;
513519
520+ context . subscriptions . push ( commands . registerCommand ( Commands . GET_VISIBLE_EDITOR_CONTENT , ( uri : string ) => {
521+ for ( const editor of window . visibleTextEditors ) {
522+ if ( editor . document . uri . toString ( ) === uri ) {
523+ return editor . document . getText ( ) ;
524+ }
525+ }
526+ const editor = window . activeTextEditor ;
527+ if ( editor ) {
528+ return editor . document . getText ( ) ;
529+ } else {
530+ return null ;
531+ }
532+ } ) ) ;
533+
514534 registerRestartJavaLanguageServerCommand ( context ) ;
515535
516536 /**
0 commit comments