Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Initialize VS Code project..." generates invalid json with only one hxml #47

Closed
Gama11 opened this issue Sep 6, 2016 · 6 comments
Closed

Comments

@Gama11
Copy link
Member

Gama11 commented Sep 6, 2016

If there's only one build.hxml, the command generates this:

{
    // These are configurations used for haxe completion.
    //
    // Each configuration is an array of arguments that will be passed to the Haxe completion server,
    // they should only contain arguments and/or hxml files that are needed for completion,
    // such as -cp, -lib, target output settings and defines.
    "haxe.displayConfigurations": [
        ["build.hxml"], // if a hxml file is safe to use, we can just pass it as argument
        // you can add more than one configuration and switch between them
        //["build-cpp.hxml"]
    ]
}

Notice the trailing comma after ["build.hxml"]. This leads to a "Value expected" error when viewing the file in VSCode.

If there are two .hxml files, the generated json is valid:

{
    // These are configurations used for haxe completion.
    //
    // Each configuration is an array of arguments that will be passed to the Haxe completion server,
    // they should only contain arguments and/or hxml files that are needed for completion,
    // such as -cp, -lib, target output settings and defines.
    "haxe.displayConfigurations": [
        ["build.hxml"], // if a hxml file is safe to use, we can just pass it as argument
        // you can add more than one configuration and switch between them
        ["build.1.hxml"]
    ]
}
@Simn
Copy link
Member

Simn commented Sep 6, 2016

I think that happens only if the file name is exactly build.hxml.

@Gama11
Copy link
Member Author

Gama11 commented Sep 6, 2016

I don't think so, I just tried with test.hxml, same thing.

@nadako
Copy link
Member

nadako commented Sep 6, 2016

But it's a valid JSON for vscode...

@nadako
Copy link
Member

nadako commented Sep 6, 2016

But yeah, maybe we should be smarter than that and use that cjson library to generate a proper commented json.

@Gama11
Copy link
Member Author

Gama11 commented Sep 6, 2016

It is? For me it displays this error:

@nadako
Copy link
Member

nadako commented Sep 9, 2016

Yeah, but it still works :) Anyway, I kind of want vscode to provide API for working with these JSONs. There's a parser library, but it doesn't handle writing and doing that ourselves doesn't sound right to me...

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

No branches or pull requests

3 participants