@@ -107,8 +107,6 @@ export function showInputDialog(
107
107
return null ;
108
108
}
109
109
110
- console . log ( idx ) ;
111
-
112
110
if ( validateForm ( result ) === false ) {
113
111
showInputDialog (
114
112
codeSnippetWidget ,
@@ -119,10 +117,6 @@ export function showInputDialog(
119
117
body
120
118
) ;
121
119
} else {
122
- // if (idx === -1) {
123
- // idx = codeSnippetWidget.codeSnippetWidgetModel.snippets.length;
124
- // }
125
-
126
120
const tags = result . value . slice ( 3 ) ;
127
121
const newSnippet : ICodeSnippet = {
128
122
name : result . value [ 0 ] . replace ( ' ' , '' ) ,
@@ -165,32 +159,10 @@ function createNewSnippet(
165
159
}
166
160
} ) ;
167
161
168
- console . log ( 'add' ) ;
169
- console . log ( codeSnippetManager . snippets ) ;
170
- // const request = contentsService.save(
171
- // 'snippets/' + newSnippet.name + '.json',
172
- // {
173
- // type: 'file',
174
- // format: 'text',
175
- // content: JSON.stringify(newSnippet)
176
- // }
177
- // );
178
-
179
162
codeSnippetWidget . renderCodeSnippetsSignal . emit ( codeSnippetManager . snippets ) ;
180
163
showMessage ( {
181
164
body : new MessageHandler ( ) ,
182
165
} ) ;
183
- // request.then(_ => {
184
- // // add the new snippet to the snippet model
185
- // // codeSnippet.codeSnippetWidgetModel.addSnippet(newSnippet, newSnippet.id);
186
- // // codeSnippet.codeSnippetWidgetModel.updateSnippetContents();
187
- // // const newSnippets = codeSnippet.codeSnippetWidgetModel.snippets;
188
- // // codeSnippet.codeSnippets = newSnippets;
189
- // // codeSnippet.renderCodeSnippetsSignal.emit(newSnippets);
190
- // // showMessage({
191
- // // body: new MessageHandler()
192
- // // });
193
- // });
194
166
}
195
167
196
168
/**
@@ -203,7 +175,7 @@ export async function saveOverWriteFile(
203
175
) : Promise < boolean > {
204
176
const newName = newSnippet . name ;
205
177
206
- await shouldOverwrite ( newName ) . then ( ( res ) => {
178
+ return await shouldOverwrite ( newName ) . then ( ( res ) => {
207
179
if ( res ) {
208
180
newSnippet . id = oldSnippet . id ;
209
181
@@ -222,7 +194,6 @@ export async function saveOverWriteFile(
222
194
return true ;
223
195
}
224
196
} ) ;
225
- return false ;
226
197
}
227
198
228
199
/**
@@ -235,7 +206,7 @@ async function shouldOverwrite(newName: string): Promise<boolean> {
235
206
buttons : [ Dialog . cancelButton ( ) , Dialog . warnButton ( { label : 'Overwrite' } ) ] ,
236
207
} ;
237
208
return showDialog ( options ) . then ( ( result ) => {
238
- return Promise . resolve ( result . button . accept ) ;
209
+ return result . button . accept ;
239
210
} ) ;
240
211
}
241
212
0 commit comments