Skip to content

.theia/launch.json not recognized by debugger #315

Open
@tjpetz

Description

@tjpetz

Describe the problem

Selecting the green run button in the debugger view open a launch.json file with the version and configuration tags. If you add in the configuration (e.g. JLink) and save the file. The configuration is not saved. It does not appear in the drop list of configurations and if you hit the green run button again it opens a new blank except for {} launch.json file and a dialog warning asking if you want to overwrite the changes to .theia/launch.json.

To reproduce

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Click the debug icon in the "activity bar" on the left side of the Arduino IDE window.
    The "DEBUG" view will open in the left side panel.
    ❗ Do not click the "Start Debugging" button on the Arduino IDE toolbar.
  3. Click the play icon ("Start Debugging") or gear icon ("Open launch.json") in the "DEBUG" view.
    A "launch.json" editor tab will open in Arduino IDE.
  4. Hover the mouse pointer over the tab.
    After a couple seconds, a tooltip will appear that shows the path of the file, which is in the .theia subfolder of the sketch folder (the sketch folder will be in a temporary folder since it is a new sketch, but this is not relevant).
  5. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  6. Check the box next to Auto save.
    This is required because there is no way to manually trigger a save of changes to the launch.json file.
  7. Click the "OK" button.
    The "Preferences" dialog will close.
  8. Replace the contents of the launch.json file with the following:
    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "My Custom Launch Config",
          "type": "cortex-debug",
          "request": "launch",
          "executable": ""
        }
      ]
    }
    The exact content of the configuration doesn't matter for the purposes of this demonstration. It only needs to pass schema validation.
  9. Click the configuration menu in the "DEBUG" view.

🐛 The menu does not contain a "My Custom Launch Config" entry.

Expected behavior

If a launch configuration file is present in the sketch folder, use that file instead of a temporary file.

- OR -

Don't mislead the user by opening an irrelevant .theia/launch.json file in the IDE editor.

Arduino IDE version

Original report

2.0.0-beta.4

Last verified with

2.3.4

Operating system

  • macOS
  • Windows

Operating system version

  • macOS 11.2.3 (Big Sur)
  • macOS 15.3.1 (Sequoia)
  • Windows 11

Additional context

It would probably be better to change the folder name from .theia to something like .arduinoIDE. The average user is unaware that Arduino IDE is built on the Eclipse Theia Platform, and so the folder name .theia is likely to be confusing.

Additional reports

Related

Workaround

If you want to make persistent customizations to the default launch configuration, use the poorly documented debug_custom.json file.

If you want to make temporary customizations, initialize the debugger before opening launch.json:

  1. Click the "Start Debugging" button on the Arduino IDE toolbar.
    Arduino IDE will begin the process of initializing the debugger.
  2. Wait for the debugger to be initialized, as indicated by a change of color of the status bar at the bottom of the Arduino IDE window, and the appearance of the "Debug Console" view in the bottom panel.
    This can take several seconds to occur.
  3. Click the stop icon in the "DEBUG" view (a debug session is automatically started by clicking the "Start Debugging" button on the Arduino IDE toolbar).
  4. Click the ⚙ icon ("Open launch.json") in the "DEBUG" view.
    A "launch.json" editor tab will open in Arduino IDE. This is the launch configuration file that is actually used by the debugger (stored in a temporary folder separate from the sketch).
  5. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  6. Check the box next to Auto save.
    This is required because there is no way to manually trigger a save of changes to the launch.json file.
  7. Click the "OK" button.
    The "Preferences" dialog will close.
  8. Make the desired modifications to launch.json.
  9. If you added a new launch configuration, select it from the menu in the "DEBUG" view (it will be automatically added to the menu).
  10. Click the play icon ("Start Debugging") in the "DEBUG" view.
    A debug session will start, configured according to your modified launch configuration.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftopic: debuggerRelated to the integrated debuggertype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions