Skip to content

Launch.json creation fails with german locale #4526

Closed

Description

Type: Debugger

Describe the bug

  • OS and Version: Windows_NT x64 10.0.18362
  • VS Code Version: 1.39.2
  • C/C++ Extension Version: 0.26.1
  • Other extensions you installed (and if the issue persists after disabling them): No other extensions are installed.

The extension cannot create the launch.json file with a debug configuration if the locale is set to German. Trying to create such a configuration results in the error message Die Datei "launch.json" kann nicht im Ordner ".vscode" erstellt werden (Unexpected token $ in JSON at position 113)., i.e. The file "launch.json" cannot be created in the directory ".vscode". The issue is only present if the launch.json file doesn't exist already. If the file exists, the configuration is added but the template is no valid JSON.

To Reproduce

  1. Set the locale to German
  2. Open a C++ project without a launch.json file
  3. Hit F5
  4. Select C++ (GDB/LLDB) or C++ (Windows)
  5. See error

Additional context
If the launch.json file already exists the creation of new configurations works. The generated code looks as follows:

{
    "name": "(Windows) Starten",
    "type": "cppvsdbg",
    "request": "launch",
    "program": "Programmnamen eingeben, z. B. "${workspaceFolder}/a.exe"",
    "args": [],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false
}

The program value is no valid JSON because the quote marks are not escaped.

There are likely other strings facing the same problem. For example if I generate a configuration for gdb the result contains

"setupCommands": [
    {
        "description": "Automatische Strukturierung und Einrückung für "gdb" aktivieren",
        "text": "-enable-pretty-printing",
        "ignoreFailures": true
    }
]

This also contains unescaped quote marks which cause problems.

The simplest fix would probably be to add the necessary escapes, e.g. replace "Programmnamen eingeben, z. B. \"{0}\"", with "Programmnamen eingeben, z. B. \\\"{0}\\\"", or removing the quotes entirely (as in all other languages I checked).

I'd be willing to contribute a fix but as far as I can tell, the localization files are generated. So if someone can point me to the source of the generation I could create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugfixedCheck the Milestone for the release in which the fix is or will be available.world readyAn issue relating string character encodings, localization translations, etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions