GithubHelp home page GithubHelp logo

Comments (5)

chrissimon-au avatar chrissimon-au commented on May 29, 2024

Thanks for the suggestion! Yes, there are a few changes needed to support multi-root, but it shouldn't be too difficult to add support.

To confirm, since this is a monorepo, would you expect to have a single contextive definitions file in the monorepo?

Longer term I believe we should support both a single contextive definitions file across the whole monorepo/multi-root workspace, but also support separate contextive definitions files per root in the workspace, but it would be helpful to know which to prioritise. At first glance it appears that a single definitions file across the whole monorepo should be simpler/faster to implement.

from contextive.

sschneider-ihre-pvs avatar sschneider-ihre-pvs commented on May 29, 2024

sure, a single file is enough. I am also not sure where the path to the file should be looked up since in a multi root worksspace you may have totally different folder. In my case I have the base project and each app, but that could be some special case.

from contextive.

sschneider-ihre-pvs avatar sschneider-ihre-pvs commented on May 29, 2024

Usually, a single monorepo belongs to the same domain. So it often represents just different bounded contexts of the same domain.

from contextive.

chrissimon-au avatar chrissimon-au commented on May 29, 2024

I am also not sure where the path to the file should be looked up since in a multi root worksspace you may have totally different folder.

Yes, this is the central challenge. There is some guidance here - https://github.com/microsoft/vscode/wiki/Adopting-Multi-Root-Workspace-APIs#language-settings. It provides some hints for our scenario, but is more related to when each root in the workspace may have a different definitions file, using 'resource-scoped' settings.

For the single-file scenario in the monorepo, I think it would make more sense to define the setting in the .code-workspace file itself. The value should be relative to the location of that .code-workspace file. In the vscode extension, we can leverage the workspaces.workspaceFile VsCode API to find the location of that .code-workspace file and resolve the definitions file location relative to it. Then utilise 'middleware' approach outlined in the guidance linked above to resolve the absolute path to the definitions file in the client and ensure the server only receives the absolute path to that file, no matter which workspace you are working in.

This would also be compatible with a future mode where we do support separate definitions files per root, as those separate roots can each have their own .vscode/settings.json file defining the location of the definitions file for that root, and we can use resource-scoped settings to isolate the values, which would be resolved against the root path of the relevant workspace, following the pattern outlined in that guidance link above. The reason we won't support that immediately is that it will also need the language server component to be further updated to support loading multiple definition files at the same time and looking up the correct definitions file depending on the file currently being worked on.

from contextive.

chrissimon-au avatar chrissimon-au commented on May 29, 2024

Hi @sschneider-ihre-pvs, this is now working in v1.7.0 - give it a try and let me know if it suits. There is a description of how to ensure the configuration is correct here: https://github.com/dev-cycles/contextive/blob/main/src/vscode/contextive/README.md#multiple-bounded-contexts-multi-root-shared-definitions-file

If you'd like it to do anything differently, please create a new issue for that change.

Thanks again for the suggestion, I hope it's helpful!

from contextive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.