You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Clear cached settings definitions on discovery failure
Previously, if settings discovery failed for a script (e.g., timeout,
non-zero exit code, invalid JSON output, script not handling discovery mode),
any previously cached settings definitions for that script would persist
in the plugin's settings UI and cache.
This commit modifies `updateScriptSettingsCache` in `src/python_executor.ts`
to correctly handle discovery failures:
- If `discoverScriptSettings` returns `null` (indicating failure), any
existing cached definitions for that script are now removed.
- Associated settings values (`scriptSettingsValues`) are also cleared
for scripts where discovery fails after having been previously successful.
This ensures that the settings UI accurately reflects only the scripts
that currently provide valid settings definitions, preventing stale data
from persisting after a script is modified or becomes incompatible with
the discovery process.
if(!plugin.pythonExecutable){plugin.logError("Cannot update script settings cache: Python executable not found.");return;}
131
-
if(!scriptsFolder||!fs.existsSync(scriptsFolder)){plugin.logWarn("Cannot update script settings cache: Scripts folder path is invalid or not found.");return;}
134
+
if(!plugin.pythonExecutable){
135
+
plugin.logError(
136
+
"Cannot update script settings cache: Python executable not found.",
if(JSON.stringify(definitions)!==JSON.stringify(plugin.settings.scriptSettingsDefinitions[relativePath])){changesMade=true;plugin.logDebug(`Definitions updated for ${relativePath}`);}
181
+
// Attempt to discover settings by running the script with --get-settings-json
`Settings discovery failed for script: ${relativePath}.`,
192
+
);
147
193
}else{
148
-
if(plugin.settings.scriptSettingsDefinitions.hasOwnProperty(relativePath)){newDefinitions[relativePath]=plugin.settings.scriptSettingsDefinitions[relativePath];plugin.logWarn(`Failed to discover settings for ${relativePath}, keeping cached version.`);}
149
-
elseplugin.logWarn(`Failed to discover settings for ${relativePath}, no cached version available.`);
194
+
// Discovery succeeded (definitions can be an empty array if no settings are defined)
195
+
newDefinitions[relativePath]=definitions;
196
+
// Check if the discovered definitions differ from the cached ones
0 commit comments