franneck94 / Vscode-C-Cpp-Runner

🚀 Compile, run and debug single or multiple C/C++ files with ease. 🚀
MIT License
53 stars 14 forks source link

launch.json "type" keeps getting overwritten #146

Closed MushroomGecko closed 8 months ago

MushroomGecko commented 8 months ago

Hi! I am on Arch Linux using VSCodium and I am unable to use the Microsoft C/C++ package so I can't use the "cppdbg" debugger type. I am, however, able to use the "lldb" debugger type. However, whenever I change "type" from "cppdbg" to "lldb" and I relaunch VSCodium, the "type" section in launch.json is reset back to the default "cppdbg". I am unable to find anything in the settings to change this in C/C++ Runner like you can with the C and C++ compilers and other options associated with C/C++ Runner.

I ask that C/C++ Runner no longer overwrites this file, or instead there is a configuration box added in the C/C++ Runner settings to be able to choose the debugger type so I can use "lldb" and not have it reset back to "cppdbg" upon restart.

Thank you so much for your time!

franneck94 commented 8 months ago

Have you also selected a clang compiler and not a gcc one?

MushroomGecko commented 8 months ago

Yes, I selected a clang compiler. When I went into the C/C++ Runner settings, I set my C path to clang, my C++ path to clang++, and my debugger path to lldb and set all of them to apply to all profiles. My settings.json file now looks like

{
    "C_Cpp_Runner.cCompilerPath": "clang",
    "C_Cpp_Runner.cppCompilerPath": "clang++",
    "C_Cpp_Runner.debuggerPath": "lldb",
    "workbench.settings.applyToAllProfiles": [
        "C_Cpp_Runner.debuggerPath",
        "C_Cpp_Runner.cCompilerPath",
        "C_Cpp_Runner.cppCompilerPath"
    ]

}

However, my launch.json keeps resetting to this upon restart

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "C/C++ Runner: Debug Session",
      "type": "cppdbg",
      "request": "launch",
      "args": [],
      "stopAtEntry": false,
      "externalConsole": false,
      "cwd": "/home/devon/VSCodium Projects/CMSC646Tokenizer",
      "program": "/home/devon/VSCodium Projects/CMSC646Tokenizer/build/Debug/outDebug",
      "MIMode": "gdb",
      "miDebuggerPath": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

This is fine for the most part, but "type":"cppdgd" is where the issue lies because it's saying the debug type is not supported, so I have to manually set it to "type":"lldb" which only persists until restart or until the launch.json file is refreshed somehow.

I am not seeing anywhere in the settings to change the "type" in a way that persists. I am also new to VSCode so I apologize if I am missing something. Thank you for your time!

Edit: formatting

MushroomGecko commented 8 months ago

Ok so I discovered that in the Settings for C/C++ Runner there is a separate User and Workspace tab. I set my User tab to be all clang and lldb, but when I try to change anything in the Workspace tab to be clang or lldb it resets when I click off of the text box. It seems, though, that even if I can change the settings in my User tab, it appears the Workspace tab takes precedence.

franneck94 commented 8 months ago

Yes the workspace always takes precedence.

franneck94 commented 8 months ago

I have to say the extension for vscodium is not on the latest code.

MushroomGecko commented 8 months ago

If there was a recent bug fix that fixes my issues, that would make sense. VSCodium is on version 9.2.2 with C/C++ Runner

franneck94 commented 8 months ago

I will update the vscodium release to the latest

franneck94 commented 8 months ago

Please try again with the newest version. If it still not work, but it works in regular vscode please let me now ;(

MushroomGecko commented 8 months ago

Seems to work as intended! Thank you! I also have an issue where when I press the play button for debug or regular run, it doesn't run the most up to date version of the code. Now, I'm not sure if that's a VSCode thing, but I usually have to press the compile button first, wait a few seconds, then I can click the debug or run option. Which is odd cause when I click the play button, it shows that it is building and then runs a previous version. I'm coming from Codeblocks so I'm used to the play button to run the program compiling the current code and running the latest version of the code. Not sure if it's different over here in VSCode land.

franneck94 commented 8 months ago

I usually have to press the compile button first, wait a few seconds, then I can click the debug or run option.

That is the intended behaviour