MCPcopy Create free account
hub / github.com/Marus/cortex-debug / settingsChanged

Method settingsChanged

src/frontend/extension.ts:194–238  ·  view source on GitHub ↗
(e: vscode.ConfigurationChangeEvent)

Source from the content-addressed store, hash-verified

192 }
193
194 private settingsChanged(e: vscode.ConfigurationChangeEvent) {
195 if (e.affectsConfiguration(`cortex-debug.${CortexDebugKeys.VARIABLE_DISPLAY_MODE}`)) {
196 const config = vscode.workspace.getConfiguration('cortex-debug');
197 const isHex = config.get(CortexDebugKeys.VARIABLE_DISPLAY_MODE, true) ? false : true;
198 let foundStopped = false;
199 for (const s of CDebugSession.CurrentSessions) {
200 try {
201 // Session may not have actually started according to VSCode but we know of it
202 if (this.isDebugging(s.session)) {
203 s.session.customRequest('set-var-format', { hex: isHex }).then(() => {
204 if (s.status === 'stopped') {
205 this.liveWatchProvider?.refresh(s.session);
206 }
207 });
208 if (s.status === 'stopped') {
209 foundStopped = true;
210 }
211 }
212 }
213 catch (e) {
214 }
215 }
216 if (!foundStopped) {
217 const fmt = isHex ? 'hex' : 'dec';
218 const msg = `Cortex-Debug: Variables window format "${fmt}" will take effect next time the session pauses`;
219 vscode.window.showInformationMessage(msg);
220 }
221 }
222 if (e.affectsConfiguration(`cortex-debug.${CortexDebugKeys.SERVER_LOG_FILE_NAME}`)) {
223 const config = vscode.workspace.getConfiguration('cortex-debug');
224 const fName = config.get(CortexDebugKeys.SERVER_LOG_FILE_NAME, '');
225 this.gdbServerConsole.createLogFile(fName);
226 }
227 if (e.affectsConfiguration(`cortex-debug.${CortexDebugKeys.DEV_DEBUG_MODE}`)) {
228 const config = vscode.workspace.getConfiguration('cortex-debug');
229 const dbgMode = config.get(CortexDebugKeys.DEV_DEBUG_MODE, ADAPTER_DEBUG_MODE.NONE);
230 for (const s of CDebugSession.CurrentSessions) {
231 try {
232 s.session.customRequest('set-debug-mode', { mode: dbgMode });
233 }
234 catch (e) {
235 }
236 }
237 }
238 }
239
240 private getSVDFile(device: string): string {
241 const entry = this.SVDDirectory.find((de) => de.expression.test(device));

Callers

nothing calls this directly

Calls 4

isDebuggingMethod · 0.95
createLogFileMethod · 0.80
customRequestMethod · 0.65
refreshMethod · 0.45

Tested by

no test coverage detected