perf: consolidate three getState() calls into single await in resolveWebviewView

This commit is contained in:
Roo Code 2026-02-09 01:20:04 +00:00
parent 12cddc9697
commit 53fffd8e12

View file

@ -747,35 +747,29 @@ export class ClineProvider
// Initialize out-of-scope variables that need to receive persistent
// global state values.
this.getState().then(
({
terminalShellIntegrationTimeout = Terminal.defaultShellIntegrationTimeout,
terminalShellIntegrationDisabled = false,
terminalCommandDelay = 0,
terminalZshClearEolMark = true,
terminalZshOhMy = false,
terminalZshP10k = false,
terminalPowershellCounter = false,
terminalZdotdir = false,
}) => {
Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout)
Terminal.setShellIntegrationDisabled(terminalShellIntegrationDisabled)
Terminal.setCommandDelay(terminalCommandDelay)
Terminal.setTerminalZshClearEolMark(terminalZshClearEolMark)
Terminal.setTerminalZshOhMy(terminalZshOhMy)
Terminal.setTerminalZshP10k(terminalZshP10k)
Terminal.setPowershellCounter(terminalPowershellCounter)
Terminal.setTerminalZdotdir(terminalZdotdir)
},
)
const {
terminalShellIntegrationTimeout = Terminal.defaultShellIntegrationTimeout,
terminalShellIntegrationDisabled = false,
terminalCommandDelay = 0,
terminalZshClearEolMark = true,
terminalZshOhMy = false,
terminalZshP10k = false,
terminalPowershellCounter = false,
terminalZdotdir = false,
ttsEnabled,
ttsSpeed,
} = await this.getState()
this.getState().then(({ ttsEnabled }) => {
setTtsEnabled(ttsEnabled ?? false)
})
this.getState().then(({ ttsSpeed }) => {
setTtsSpeed(ttsSpeed ?? 1)
})
Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout)
Terminal.setShellIntegrationDisabled(terminalShellIntegrationDisabled)
Terminal.setCommandDelay(terminalCommandDelay)
Terminal.setTerminalZshClearEolMark(terminalZshClearEolMark)
Terminal.setTerminalZshOhMy(terminalZshOhMy)
Terminal.setTerminalZshP10k(terminalZshP10k)
Terminal.setPowershellCounter(terminalPowershellCounter)
Terminal.setTerminalZdotdir(terminalZdotdir)
setTtsEnabled(ttsEnabled ?? false)
setTtsSpeed(ttsSpeed ?? 1)
// Set up webview options with proper resource roots
const resourceRoots = [this.contextProxy.extensionUri]