llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.61k stars 11.35k forks source link

[lldb-dap] Make `env` and `sourceMap ` dictionaries #95137

Open JDevlieghere opened 2 months ago

JDevlieghere commented 2 months ago

The documentation specifies that the env configuration setting is a dictionary, but as seen in the examples, it really is an array consisting of key=value.

{
  "env": [ "FOO=1", "BAR" ],
}

It would be much more intuitive to make this an actual JSON dictionary. Similarly, sourceMap, although documented correctly as a [string[2]], could benefit from this as well.

{
  "env": {
    "foo": "1",
    "bar": ""
  },
  "sourceMap": {
    "/path/to/foo": "/path/to/bar",
    "/path/to/baz": "/path/to/quux"
  }
}

Not only is that a lot more readable, it's also easier to comment out certain environment variables or path remappings in launch.json.

llvmbot commented 2 months ago

@llvm/issue-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

[The documentation](https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/README.md) specifies that the `env` configuration setting is a dictionary, but as seen in the examples, it really is an array consisting of `key=value`. ``` { "env": [ "FOO=1", "BAR" ], } ``` It would be much more intuitive to make this an actual JSON dictionary. Similarly, `sourceMap`, although documented correctly as a `[string[2]]`, could benefit from this as well. ``` { "env": { "foo": "1", "bar": "" }, "sourceMap": { "/path/to/foo": "/path/to/bar", "/path/to/baz": "/path/to/quux" } } ``` Not only is that a lot more readable, it's also easier to comment out certain environment variables or path remappings in `launch.json`.