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) {
37
37
if ( hasSemicolons !== previousConfiguration . get ( 'semicolons' ) ) {
38
38
try {
39
39
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 ( ) ;
52
41
} catch ( error ) {
53
42
vscode . window . showErrorMessage (
54
43
`Extension \`${ EXTENSION_ID } \` failed to write snippets to the file.`
@@ -66,3 +55,19 @@ function writeSnippets(snippets) {
66
55
67
56
fs . writeFileSync ( snippetsPath , JSON . stringify ( snippets ) ) ;
68
57
}
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