Skip to content

Commit

Permalink
feat: reloadWithoutPrompting config (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdanbrown authored Dec 17, 2024
1 parent 6aa4f86 commit a5da38a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Please make sure the VSCode is totally replaced while upgrading.
| Key | Description | Type | Default |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------- | ---------- |
| `custom-ui-style.preferRestart` | Prefer to restart vscode after update instead of reload window only (ALWAYS true when VSCode version >= 1.95.0) | `boolean` | `false` |
| `custom-ui-style.reloadWithoutPrompting` | Reload/restart immediately, instead of having to click 'Reload Window' in the notification | `boolean` | `false` |
| `custom-ui-style.watch` | Watch configuration changes and reload window automatically | `boolean` | `true` |
| `custom-ui-style.electron` | Electron BrowserWindow options | `object` | `{}` |
| `custom-ui-style.font.monospace` | Global monospace font family that apply in both editor and webview, fallback to editor's font family | `string` | `` |
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
"description": "Prefer to restart vscode after update instead of reload window only (ALWAYS true when VSCode version >= 1.95.0)",
"default": false
},
"custom-ui-style.reloadWithoutPrompting": {
"scope": "resource",
"type": "boolean",
"description": "Reload/restart immediately, instead of having to click 'Reload Window' in the notification",
"default": false
},
"custom-ui-style.watch": {
"scope": "resource",
"type": "boolean",
Expand Down
10 changes: 8 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@ export async function runAndRestart(message: string, fullRestart: boolean, actio
success = false
}
if (success) {
const item = await showMessage(message, 'Reload Window', 'Cancel')
if (item === 'Reload Window') {
let shouldProceed = false
if (config.reloadWithoutPrompting) {
shouldProceed = true
} else {
const item = await showMessage(message, 'Reload Window', 'Cancel')
shouldProceed = item === 'Reload Window'
}
if (shouldProceed) {
if (fullRestart) {
try {
await restartApp()
Expand Down

0 comments on commit a5da38a

Please sign in to comment.