elbywan / crystalline

A Language Server Protocol implementation for Crystal. 🔮
MIT License
424 stars 21 forks source link

feat: Support multiple projects per workspace #25

Open refi64 opened 2 years ago

refi64 commented 2 years ago

This adds the ability to create a .crystalline.yml file in the workspace root containing a list of project folders. Entry points and requires will then all be resolved relative to the individual projects, rather than the root of the workspace.

I would appreciate some more testing! It seems to all work as expected, but I'm also an individual with a limited "project pool" to test on.

elbywan commented 2 years ago

@refi64 Thanks a bunch for this PR!

Sorry for the delay, I'll review and test in the following days.

n-pn commented 1 year ago

I think this is rather restricted. Even in a same project you will still have multiple targets for multi services. Better just provide a glob pattern for each opening file to map it to a particular entry point, instead of limiting it to some sub projects.

For example:


  - glob: [my_project_1/src/**/*.cr]
    main: my_project_1/src/my_project_1.cr
    cwd: my_project_1

  - glob: [src/**/*.cr]
    main: src/main_project.cr

for the current working file, just find the first matching glob pattern.

This is more verbose than the original proposal, but I think it offers more flexibility.

nobodywasishere commented 4 months ago

If it helps at all, how I ended up adding multi-root projects to the vscode extension is by running the dependencies tool on each of the targets in the shards.yml and selecting the first one that had my current file in the output.