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

Emit line numbers when parsing the package file fails #317

Closed
ghost opened this issue May 7, 2014 · 2 comments
Closed

Emit line numbers when parsing the package file fails #317

ghost opened this issue May 7, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented May 7, 2014

Forgetting a comma seems to be very common when writing the package file.

There's a version(JsonLineNumbers) in parseJson that emits line numbers, although it currently doesn't compile due to an outdated import - import vibecompat.core.log; instead of import dub.internal.vibecompat.core.log;.

Additionally enabling that switch should probably print the next line rather than the previous one, e.g. for this:

{
    "name": "dtk"

    "targetName": "dtk",
}

It prints line 0, but I would prefer line 3 or line 4. 4 is more accurate, but it prints 3 if I write scope(failure) logError("Error in line: %d", line ? *line : 0);

And the diagnostic itself could be nicer, before:

Error in line: 4
Error executing command run: Failed to load package at C:\dev\projects\test_dub: Expected '}' or ',' - got '"'.

Desired:

Error executing command run: Failed to load package at C:\dev\projects\test_dub:
C:\dev\projects\test_dub\dub.json(4): Error: Expected '}' or ',' - got '"'.

This will enable jump-to-file in editors to work and will highlight the offending line properly.

@p0nce
Copy link
Contributor

p0nce commented Jul 21, 2014

So this can be closed ? Works fine.

@ghost
Copy link
Author

ghost commented Oct 7, 2014

Thanks!

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

No branches or pull requests

1 participant