(private context: vscode.ExtensionContext)
| 50 | private serverStartedEvent: ServerStartedPromise; |
| 51 | |
| 52 | constructor(private context: vscode.ExtensionContext) { |
| 53 | const config = vscode.workspace.getConfiguration('cortex-debug'); |
| 54 | this.startServerConsole(context, config.get(CortexDebugKeys.SERVER_LOG_FILE_NAME, '')); // Make this the first thing we do to be ready for the session |
| 55 | this.memoryProvider = new MemoryContentProvider(); |
| 56 | |
| 57 | let tmp = []; |
| 58 | try { |
| 59 | const dirPath = path.join(context.extensionPath, 'data', 'SVDMap.json'); |
| 60 | tmp = JSON.parse(fs.readFileSync(dirPath, 'utf8')); |
| 61 | } |
| 62 | catch (e) {} |
| 63 | |
| 64 | Reporting.activate(context); |
| 65 | |
| 66 | this.liveWatchProvider = new LiveWatchTreeProvider(this.context); |
| 67 | this.liveWatchTreeView = vscode.window.createTreeView('cortex-debug.liveWatch', { |
| 68 | treeDataProvider: this.liveWatchProvider |
| 69 | }); |
| 70 | |
| 71 | vscode.commands.executeCommand('setContext', `cortex-debug:${CortexDebugKeys.VARIABLE_DISPLAY_MODE}`, |
| 72 | config.get(CortexDebugKeys.VARIABLE_DISPLAY_MODE, true)); |
| 73 | |
| 74 | context.subscriptions.push( |
| 75 | vscode.workspace.registerTextDocumentContentProvider('examinememory', this.memoryProvider), |
| 76 | |
| 77 | vscode.commands.registerCommand('cortex-debug.varHexModeTurnOn', this.variablesNaturalMode.bind(this, false)), |
| 78 | vscode.commands.registerCommand('cortex-debug.varHexModeTurnOff', this.variablesNaturalMode.bind(this, true)), |
| 79 | vscode.commands.registerCommand('cortex-debug.toggleVariableHexFormat', this.toggleVariablesHexMode.bind(this)), |
| 80 | |
| 81 | vscode.commands.registerCommand('cortex-debug.examineMemory', this.examineMemory.bind(this)), |
| 82 | vscode.commands.registerCommand('cortex-debug.examineMemoryLegacy', this.examineMemoryLegacy.bind(this)), |
| 83 | |
| 84 | vscode.commands.registerCommand('cortex-debug.resetDevice', this.resetDevice.bind(this)), |
| 85 | vscode.commands.registerCommand('cortex-debug.pvtEnableDebug', this.pvtCycleDebugMode.bind(this)), |
| 86 | |
| 87 | vscode.commands.registerCommand('cortex-debug.liveWatch.addExpr', this.addLiveWatchExpr.bind(this)), |
| 88 | vscode.commands.registerCommand('cortex-debug.liveWatch.removeExpr', this.removeLiveWatchExpr.bind(this)), |
| 89 | vscode.commands.registerCommand('cortex-debug.liveWatch.editExpr', this.editLiveWatchExpr.bind(this)), |
| 90 | vscode.commands.registerCommand('cortex-debug.liveWatch.addToLiveWatch', this.addToLiveWatch.bind(this)), |
| 91 | vscode.commands.registerCommand('cortex-debug.liveWatch.moveUp', this.moveUpLiveWatchExpr.bind(this)), |
| 92 | vscode.commands.registerCommand('cortex-debug.liveWatch.moveDown', this.moveDownLiveWatchExpr.bind(this)), |
| 93 | |
| 94 | vscode.workspace.onDidChangeConfiguration(this.settingsChanged.bind(this)), |
| 95 | vscode.debug.onDidReceiveDebugSessionCustomEvent(this.receivedCustomEvent.bind(this)), |
| 96 | vscode.debug.onDidStartDebugSession(this.debugSessionStarted.bind(this)), |
| 97 | vscode.debug.onDidTerminateDebugSession(this.debugSessionTerminated.bind(this)), |
| 98 | vscode.window.onDidChangeActiveTextEditor(this.activeEditorChanged.bind(this)), |
| 99 | vscode.window.onDidCloseTerminal(this.terminalClosed.bind(this)), |
| 100 | vscode.workspace.onDidCloseTextDocument(this.textDocsClosed.bind(this)), |
| 101 | vscode.window.onDidChangeTextEditorSelection((e: vscode.TextEditorSelectionChangeEvent) => { |
| 102 | if (e && e.textEditor.document.fileName.endsWith('.cdmem')) { this.memoryProvider.handleSelection(e); } |
| 103 | }), |
| 104 | |
| 105 | vscode.debug.registerDebugConfigurationProvider('cortex-debug', new CortexDebugConfigurationProvider(context)), |
| 106 | |
| 107 | this.liveWatchTreeView, |
| 108 | this.liveWatchTreeView.onDidExpandElement((e) => { |
| 109 | this.liveWatchProvider.expandChildren(e.element); |
nothing calls this directly
no test coverage detected