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

Provide line information where a value is defined #14

Closed
stcarrez opened this issue Mar 10, 2024 · 1 comment · Fixed by #15
Closed

Provide line information where a value is defined #14

stcarrez opened this issue Mar 10, 2024 · 1 comment · Fixed by #15
Assignees

Comments

@stcarrez
Copy link

This is an improvement suggestion.
It would be nice to know the Source_Location where a TOML_Value is defined in the file.

This is useful when the TOML file is correct but you want to report some configuration error specific to your tool (such as an invalid value, ...).

Example with Alire, if we write an invalid tag somewhere, we get the error:

error: Cannot continue without a workspace:
error:    Loading release from manifest: alire.toml:
error:    Failed to load alire.toml:
error:    Loading release from manifest: alire.toml:
error:    invalid property: 'plop'. Can be: actions, authors, auto-gpr-with, build-profiles, build-switches, configuration, description, environment, executables, gpr-externals, gpr-set-externals, hint, licenses, long-description, maintainers, maintainers-logins, name, notes, project-files, tags, version, website.

I don't think we need the path name since there is no ambiguity on the file name.

@pmderodat
Copy link
Owner

Hello,

I was originally reluctant to include source location information in TOML_Value since that kind of information isn’t really part of the values themselves: it’s ignored during serialization, comparisons/equality, … and will necessarily be absent for all values that are not created by a parser (for instance for a value created by the Create_Table function).

But at the same time as you noted, this feature would be really useful for most uses of ada-toml, it would be really convenient to track it in TOML_Value and I don’t see other realistic designs… so I’ll give it a try. :-)

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

Successfully merging a pull request may close this issue.

2 participants