File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -37,18 +37,7 @@ function listener(previousConfiguration) {
3737 if ( hasSemicolons !== previousConfiguration . get ( 'semicolons' ) ) {
3838 try {
3939 writeSnippets ( snippets ( hasSemicolons ) ) ;
40-
41- const action = 'Reload' ;
42- vscode . window
43- . showInformationMessage (
44- `Reload window in order for change in extension \`${ EXTENSION_ID } \` configuration to take effect.` ,
45- action
46- )
47- . then ( selectedAction => {
48- if ( selectedAction === action ) {
49- vscode . commands . executeCommand ( 'workbench.action.reloadWindow' ) ;
50- }
51- } ) ;
40+ promptToReloadWindow ( ) ;
5241 } catch ( error ) {
5342 vscode . window . showErrorMessage (
5443 `Extension \`${ EXTENSION_ID } \` failed to write snippets to the file.`
@@ -66,3 +55,19 @@ function writeSnippets(snippets) {
6655
6756 fs . writeFileSync ( snippetsPath , JSON . stringify ( snippets ) ) ;
6857}
58+
59+ /** Prompts user to reload editor window in order for configuration change to take effect. */
60+ function promptToReloadWindow ( ) {
61+ const action = 'Reload' ;
62+
63+ vscode . window
64+ . showInformationMessage (
65+ `Reload window in order for change in extension \`${ EXTENSION_ID } \` configuration to take effect.` ,
66+ action
67+ )
68+ . then ( selectedAction => {
69+ if ( selectedAction === action ) {
70+ vscode . commands . executeCommand ( 'workbench.action.reloadWindow' ) ;
71+ }
72+ } ) ;
73+ }
You can’t perform that action at this time.
0 commit comments