scalameta / metals-feature-requests

Issue tracker for Metals feature requests
37 stars 4 forks source link

Support multiple output target paths from BSP #331

Open aishfenton opened 1 year ago

aishfenton commented 1 year ago

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

For build tools that support large monorepos (such as Bazel, Blaze, Pants, Buck, etc) it's typical to have multiple output paths, per build target. Classes, and semanticdb files, are partitioned into different chunks (for different subdirectories), and stored in different places across the filesystem.

Currently Metals is assuming that a single output path is used per BuildTarget (in ScalacOptionsItem.classDirectory). This means that these tools have to resort to ad-hoc solutions, such as copying (or linking) these targets into a single directory.

Describe the solution you'd like

Instead of using a single target output path, support a List[Uri] output locations instead. Either ScalacOptionsItem could be be modified to support this. Or the meaning of OutputPathsRequest could be revisited.

Describe alternatives you've considered

The alternative is to copy (or soft link) the various output paths into a single directory for Metals.

This has a few downsides:

Additional context

No response

Search terms

Bazel, classDirectory

aishfenton commented 1 year ago

Opened an issue on the BSP spec, as it'd need to be addressed there too.

lefou commented 1 year ago

This limitation affects also the Mill BSP implementation. Mill is generating semanticDB into a different location than the compiled class-files and needs to work around this issue by copying all files into a third directory.