1818import {
1919 JupyterFrontEnd ,
2020 JupyterFrontEndPlugin ,
21- ILayoutRestorer
21+ ILayoutRestorer ,
2222} from '@jupyterlab/application' ;
2323import { ICommandPalette , WidgetTracker } from '@jupyterlab/apputils' ;
2424import { ISettingRegistry , Settings } from '@jupyterlab/settingregistry' ;
@@ -36,7 +36,7 @@ import { CodeSnippetInputDialog } from './CodeSnippetInputDialog';
3636import { CodeSnippetWidget } from './CodeSnippetWidget' ;
3737import {
3838 CodeSnippetEditor ,
39- ICodeSnippetEditorMetadata
39+ ICodeSnippetEditorMetadata ,
4040} from './CodeSnippetEditor' ;
4141import { CodeSnippetService } from './CodeSnippetService' ;
4242import { NotebookPanel } from '@jupyterlab/notebook' ;
@@ -50,15 +50,15 @@ const CODE_SNIPPET_SETTING_ID = 'jupyterlab-code-snippets:snippets';
5050 */
5151const editorIcon = new LabIcon ( {
5252 name : 'custom-ui-components:codeSnippetEditorIcon' ,
53- svgstr : editorIconSVGstr
53+ svgstr : editorIconSVGstr ,
5454} ) ;
5555
5656/**
5757 * Snippet Icon
5858 */
5959const codeSnippetIcon = new LabIcon ( {
6060 name : 'custom-ui-components:codeSnippetIcon' ,
61- svgstr : codeSnippetIconSVGstr
61+ svgstr : codeSnippetIconSVGstr ,
6262} ) ;
6363
6464/**
@@ -68,7 +68,7 @@ const code_snippet_extension: JupyterFrontEndPlugin<void> = {
6868 id : CODE_SNIPPET_EXTENSION_ID ,
6969 autoStart : true ,
7070 requires : [ ICommandPalette , ILayoutRestorer , IEditorServices ] ,
71- activate : activateCodeSnippet
71+ activate : activateCodeSnippet ,
7272} ;
7373
7474function activateCodeSnippet (
@@ -138,7 +138,7 @@ function activateCodeSnippet(
138138
139139 if ( ! codeSnippetEditor . isAttached ) {
140140 app . shell . add ( codeSnippetEditor , 'main' , {
141- mode : 'tab-after'
141+ mode : 'tab-after' ,
142142 } ) ;
143143 }
144144
@@ -151,22 +151,22 @@ function activateCodeSnippet(
151151 execute : ( ) => {
152152 const editor = tracker . currentWidget ;
153153 editor . updateSnippet ( ) ;
154- }
154+ } ,
155155 } ) ;
156156
157157 // Add keybinding to save
158158 app . commands . addKeyBinding ( {
159159 command : editorSaveCommand ,
160160 args : { } ,
161161 keys : [ 'Accel S' ] ,
162- selector : '.jp-codeSnippet-editor'
162+ selector : '.jp-codeSnippet-editor' ,
163163 } ) ;
164164
165165 const editorCommand = 'jp-codeSnippet-editor:open' ;
166166 app . commands . addCommand ( editorCommand , {
167167 execute : ( args : any ) => {
168168 openCodeSnippetEditor ( args ) ;
169- }
169+ } ,
170170 } ) ;
171171
172172 //Add an application command
@@ -224,55 +224,55 @@ function activateCodeSnippet(
224224 codeSnippetWidget . codeSnippetManager . snippets . length
225225 ) ;
226226 }
227- }
227+ } ,
228228 } ) ;
229229
230230 // Put the saveCommand above in context menu
231231 app . contextMenu . addItem ( {
232232 type : 'separator' ,
233233 selector : '.jp-Notebook' ,
234- rank : 13
234+ rank : 13 ,
235235 } ) ;
236236
237237 app . contextMenu . addItem ( {
238238 command : saveCommand ,
239239 selector : '.jp-Notebook' ,
240- rank : 14
240+ rank : 14 ,
241241 } ) ;
242242
243243 app . contextMenu . addItem ( {
244244 type : 'separator' ,
245245 selector : '.jp-Notebook' ,
246- rank : 15
246+ rank : 15 ,
247247 } ) ;
248248
249249 // Put the saveCommand in non-notebook file context menu
250250 app . contextMenu . addItem ( {
251251 type : 'separator' ,
252252 selector : '.jp-FileEditor' ,
253- rank : 7
253+ rank : 7 ,
254254 } ) ;
255255
256256 app . contextMenu . addItem ( {
257257 command : saveCommand ,
258258 selector : '.jp-FileEditor' ,
259- rank : 8
259+ rank : 8 ,
260260 } ) ;
261261
262262 app . contextMenu . addItem ( {
263263 type : 'separator' ,
264264 selector : '.jp-FileEditor' ,
265- rank : 9
265+ rank : 9 ,
266266 } ) ;
267267
268268 // Track and restore the widget state
269269 const tracker = new WidgetTracker < CodeSnippetEditor > ( {
270- namespace : 'codeSnippetEditor'
270+ namespace : 'codeSnippetEditor' ,
271271 } ) ;
272272
273273 restorer . restore ( tracker , {
274274 command : editorCommand ,
275- args : widget => {
275+ args : ( widget ) => {
276276 const editorMetadata = widget . codeSnippetEditorMetadata ;
277277 return {
278278 name : editorMetadata . name ,
@@ -282,12 +282,12 @@ function activateCodeSnippet(
282282 id : editorMetadata . id ,
283283 selectedTags : editorMetadata . selectedTags ,
284284 allTags : editorMetadata . allTags ,
285- fromScratch : editorMetadata . fromScratch
285+ fromScratch : editorMetadata . fromScratch ,
286286 } ;
287287 } ,
288- name : widget => {
288+ name : ( widget ) => {
289289 return widget . id ;
290- }
290+ } ,
291291 } ) ;
292292}
293293
@@ -302,8 +302,8 @@ const codeSnippetExtensionSetting: JupyterFrontEndPlugin<void> = {
302302 CodeSnippetService . init ( settings as Settings , app ) ;
303303 console . log ( 'JupyterLab extension code-snippets setting is activated!' ) ;
304304 } )
305- . catch ( e => console . log ( e ) ) ;
306- }
305+ . catch ( ( e ) => console . log ( e ) ) ;
306+ } ,
307307} ;
308308
309309function getSelectedText ( ) : string {
0 commit comments