Skip to content

Please document json file format #230

Closed
@JanKok

Description

@JanKok

I have had several difficulties due to lack of documentation about the launch.json and tasks.json files. In the latest case, I had trouble passing a file path to my target program. See microsoft/vscode#4057
I think what is needed is:

  1. Some documentation for each json file. This documentation should be referenced wherever launch.json and tasks.json are mentioned in the user docs. Also, where these json docs mention the "args": parameter, they should reference item Processing code open source? #2 below. This json documentation doesn't necessarily have to be new web pages. I think it might be adequate to document the format in the files themselves, similar to what is done with Default Settings and settings.json.
  2. A detailed explanation of how the "args": parameter is parsed and the args passed to the target. I would suggest several parts to this:
    2.1 Several examples to help get the user on his way. Show the user how to pass:
  • File paths that include backslashes, slashes, blanks, wildcards (*, ?,...), environment variables (%WINDOWS%, $PATH, ${file}) and other special characters.
  • Zero-length strings, for example sometimes you want to start a program that can talk to X windows but tell it not to talk to X windows, using the call xprogram -d ''
  • Literal strings, for example, how to pass ${file} to the target program as the string dollar-sign, open-brace, f, i, ...? This may actually be useful, for example when passing args to the gdb start command, because the start command interprets its args like a shell, so you might want to pass something like $PATH or $MY_ENV_VAR literally to some program.
  • Other special characters, such as newline chars (maybe not so useful) or non-ASCII character strings.

2.2 An explanation of the process whereby args get from the json file to the target program, so that the user can understand and figure out how to handle difficult cases not covered by the examples. My understanding is: VSCode parses the json file using certain rules about backslash, double quote, etc., then passes the array of strings to the appropriate extension, which typically passes the args unchanged (or concatenated with spaces) to the target program, which in some cases (such as gdb) may do additional processing on the args.
2.3 Give a simple program in several languages for checking out how args are passed. For example, in PowerShell, this one-line program seems to print the args, one per line:
Write-Output "args:", $args
However, I'm not a PowerShell expert, so that may not be exactly right. PowerShell has a habit of evaluating arguments in unexpected ways. That's why it would be good to have some examples from reliable, expert sources.
3. Extension writers should be advised to reference these documents and also to provide any additional details that may be needed in their own documentation. For example, gdb extensions should mention the additional evaluation step that gdb does with the start args.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions