Skip to content

Table key source #82

@vaartis

Description

@vaartis

Is your feature request related to a problem? Please describe.

Currently, table values all have sources attached to them (line and column), which is very useful. However, there seems to be no way of getting the source of the table key (the name = part).

Describe the solution you'd like

I'm not sure what the best interface for this would be, as this information would probably need to be accessible from the table itself and not from the node that is received with operator[] and such, since they don't store that they're in a table. Probably some method on toml::table like key_source(std::string) -> std::optional<toml::source_region> could suffice.

Additional context

Basically, since no libraries support preserving the structure of the file, i'm rolling my own solution that only replaces parts of the file by accesing the source of the node. It would be very useful to be able to also get the source of the key, so I could replace them easily without reformatting the whole table or doing it in roundabound ways.

Metadata

Metadata

Assignees

Labels

featureNew feature or enhancement requestimplemented in v3Fixes + features which were implemented in v3 release.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions