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

Multiple context definition files #41

Closed
bluecitylights opened this issue Jun 13, 2023 · 5 comments
Closed

Multiple context definition files #41

bluecitylights opened this issue Jun 13, 2023 · 5 comments

Comments

@bluecitylights
Copy link

When I am in Vs code and split my big context file into multiple files, and delete default definition yml (one context each), everything keeps working. And the tool tips are based on the contents of all the definition files.

When you restart Vs code it complains that definitions file can not be found.

@chrissimon-au
Copy link
Contributor

Contextive currently only supports a single definitions file - the file location is defined in the contextive.path setting. The reason it kept working when you made the original split is that the definitions are kept in memory and sync'd when the file changes. When it's deleted, the definitions are still in memory.

I'm open to adding support for multiple files (it would be relevant for #39 as well), but can you give a few more details on how you would like/expect it to work?

A few questions to help hone in on the right solution:

  1. What is your current repository structure - are all your contexts in the same repository? how are they laid out?
  2. Where would you like to store the separate definitions files - separate files in the /.contextive folder, or in a folder belonging to the relevant context, or something else?
  3. Maybe the same as Q2, but where did you put the separate files when you split them as described in the original issue description? i.e. how did you expect it would work?
  4. Roughly how many contexts do you have?

Thanks!

@bluecitylights
Copy link
Author

bluecitylights commented Jun 13, 2023

I imagined that it was unexpected behaviour, since the defintions.yml is indeed specified using that context.path. So, I was actually surprised that it kept working.

  1. I have multiple repositories. some context are spread over multiple repositories as well.
  2. see Q3.
  3. I put them in .contextive folder where the original definitions.yml is located. Actually I wasn't expected it to work, given the fact that there was this context.path. I was just putting them in separate file to move them later to the repository for the context they were about. However, since it kept working I was considering if it would be somehow possible to centralize all my definition files and be able to reference them from other, maybe like Support sharing definitions between repos with different languages/package managers #37 .
    I think it can be useful to use the definitions from the yml is multiple places, beyond the context with the code that is building the context.
  4. I have around 15 contexts.

@chrissimon-au
Copy link
Contributor

chrissimon-au commented Jun 15, 2023

Hi @bluecitylights thanks for your thoughts on this. I agree that #37 is critical for when the context is distributed across multiple repos.

I think there are three separate scenarios to consider:

  1. Single definitions file where the associated code is in multiple repositories, so each repository somehow needs a copy of, or access to, that definitions file (Support sharing definitions between repos with different languages/package managers #37)
  2. Multiple definitions files in the same repo - although you can have multiple contexts in a single file, it might be better for teams to own their own 'files' even in a monorepo. This is related to, but not exactly the same as Support multi-root workspaces in vscode with different definitions files in each root #39, as they may not be using multi-root.
  3. A repo that doesn't have any definitions files itself, but has code that would benefit from definitions contained in multiple definitions files from multiple sources (similar to option 1 above, but you can reference multiple source definitions files)

Since we already have #39 and #37, I will create two new issues - one for scenario 2 and one for scenario 3 above, and close this issue, if that's ok with you?

If there are other scenarios you think we should handle, please do let me know! Thanks :)

@bluecitylights
Copy link
Author

This summary makes perfect sense to me.

@chrissimon-au
Copy link
Contributor

Great. Have itemised these matters into 4 separate issues, and marked them with the repo-layout label.

From my interpretation of your situation above, item #37 is probably the highest priority for you - if you have further thoughts on how you'd like that to work, could you please add them there? 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

2 participants