From 5ead5b1d5f85cec6d3e8330ef7a37c44108bbe8a Mon Sep 17 00:00:00 2001 From: Bob Brown Date: Wed, 6 Apr 2022 11:03:46 -0700 Subject: [PATCH] Add IntelliSense support for `debugConfig.console` (#2479) --- .gitignore | 1 + CHANGELOG.md | 1 + package.json | 20 ++++++++++++++++++-- package.nls.json | 5 +++++ src/debugger.ts | 17 +++++++++++++---- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 793feb61..501f85a2 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ package-lock.json test.txt *.backup *.db* +*.log *.vsix **/.vscode/CMakeTools **/nls.*.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d91e1a7..93047cf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Improvements: - Fix build Error: EMFILE: too many open files. [#2288](https://github.com/microsoft/vscode-cmake-tools/issues/2288) [@FrogTheFrog](https://github.com/FrogTheFrog) - Add commands to get preset names. [PR #2433](https://github.com/microsoft/vscode-cmake-tools/pull/2433) +- Add IntelliSense support for `debugConfig.console`. [#2428](https://github.com/microsoft/vscode-cmake-tools/issues/2428) - Add c++23 support. [#2475](https://github.com/microsoft/vscode-cmake-tools/issues/2475) [@sweemer](https://github.com/sweemer) Bug Fixes: diff --git a/package.json b/package.json index 962f546e..c8befb02 100644 --- a/package.json +++ b/package.json @@ -1223,8 +1223,24 @@ "description": "%cmake-tools.configuration.cmake.debugConfig.additionalSOLibSearchPath.description%" }, "externalConsole": { - "type": "boolean", - "description": "%cmake-tools.configuration.cmake.debugConfig.externalConsole.description%" + "type": "boolean", + "description": "%cmake-tools.configuration.cmake.debugConfig.externalConsole.description%" + }, + "console": { + "type": "string", + "enum": [ + "internalConsole", + "integratedTerminal", + "externalTerminal", + "newExternalWindow" + ], + "enumDescriptions": [ + "%cmake-tools.configuration.cmake.debugConfig.console.internalConsole.description%", + "%cmake-tools.configuration.cmake.debugConfig.console.integratedTerminal.description%", + "%cmake-tools.configuration.cmake.debugConfig.console.externalTerminal.description%", + "%cmake-tools.configuration.cmake.debugConfig.console.newExternalWindow.description%" + ], + "description": "%cmake-tools.configuration.cmake.debugConfig.console.description%" }, "logging": { "type": "object", diff --git a/package.nls.json b/package.nls.json index 01c611a8..9d7088e4 100644 --- a/package.nls.json +++ b/package.nls.json @@ -84,6 +84,11 @@ "cmake-tools.configuration.cmake.debugConfig.symbolSearchPath.description": "Visual Studio debugger symbol search paths.", "cmake-tools.configuration.cmake.debugConfig.additionalSOLibSearchPath.description": "Paths for GDB or LLDB to search for .so files.", "cmake-tools.configuration.cmake.debugConfig.externalConsole.description": "Launch an external console for the program.", + "cmake-tools.configuration.cmake.debugConfig.console.description": "Where to launch the debug target. Defaults to 'internalConsole' if not defined.", + "cmake-tools.configuration.cmake.debugConfig.console.internalConsole.description": "Output to the VS Code Debug Console. This doesn't support reading console input (ex:'std::cin' or 'scanf').", + "cmake-tools.configuration.cmake.debugConfig.console.integratedTerminal.description": "VS Code's integrated terminal.", + "cmake-tools.configuration.cmake.debugConfig.console.externalTerminal.description": "Console applications will be launched in an external terminal window. The window will be reused in relaunch scenarios and will not automatically disappear when the application exits.", + "cmake-tools.configuration.cmake.debugConfig.console.newExternalWindow.description": "Console applications will be launched in their own external console window which will end when the application stops. Non-console applications will run without a terminal, and stdout/stderr will be ignored.", "cmake-tools.configuration.cmake.debugConfig.logging.description": "Tell what types of messages should be logged to the console.", "cmake-tools.configuration.cmake.debugConfig.visualizerFile.description": ".natvis file to be used when debugging.", "cmake-tools.configuration.cmake.debugConfig.args.description": "Arguments to pass to program command line.", diff --git a/src/debugger.ts b/src/debugger.ts index 0cb3674c..554367f3 100644 --- a/src/debugger.ts +++ b/src/debugger.ts @@ -32,6 +32,7 @@ export interface CppDebugConfiguration { symbolSearchPath?: string; additionalSOLibSearchPath?: string; externalConsole?: boolean; + console?: ConsoleTypes; logging?: DebuggerLogging; visualizerFile?: string; args?: string[]; @@ -62,6 +63,18 @@ export interface SetupCommand { ignoreFailures?: boolean; } +export enum MIModes { + lldb = 'lldb', + gdb = 'gdb', +} + +export enum ConsoleTypes { + internalConsole = 'internalConsole', + integratedTerminal = 'integratedTerminal', + externalTerminal = 'externalTerminal', + newExternalWindow = 'newExternalWindow' +} + async function createGDBDebugConfiguration(debuggerPath: string, target: ExecutableTarget): Promise { if (!await checkDebugger(debuggerPath)) { debuggerPath = 'gdb'; @@ -149,10 +162,6 @@ function searchForCompilerPathInCache(cache: CMakeCache): string | null { return null; } -export enum MIModes { - lldb = 'lldb', - gdb = 'gdb', -} export async function getDebugConfigurationFromCache(cache: CMakeCache, target: ExecutableTarget, platform: string, modeOverride?: MIModes, debuggerPathOverride?: string): Promise {