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

Does OmegaConf keep information about the ordered map of the raw configuration? #1173

Open
noklam opened this issue Apr 19, 2024 · 1 comment

Comments

@noklam
Copy link

noklam commented Apr 19, 2024

Pseudocode:

from omegaconf import OmegaConf

conf = OmegaConf.load("xxxx.yml")
conf.lc

>>> line: 10, col: 5

For example, this is supported with yaml https://yaml.readthedocs.io/en/latest/detail/. Obviously it won't work for the Python API. I wonder how could this be supported or could I extend OmegaConf myself. Does OmegaConf preserve the tree during resolution? It would be super useful for me as I am trying to build some sort of LSP IDE feature on top of it so navigation/go to definition would be easier.

I know for DictConfig there is a _parent attribute, is there a way that I can extend the config resolution method so that these metadata can be kept.

@odelalleau
Copy link
Collaborator

I think you could extend the DictConfig and ListConfig constructors so that when you create the config in

def _create_impl( # noqa F811
you can pass this information when available, which could then be stored in the metadata (you'd also have to add this to the ContainerMetadata class).

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

2 participants