scalameta / nvim-metals

A Metals plugin for Neovim
https://scalameta.org/metals/
Apache License 2.0
471 stars 75 forks source link

nvim-metals not working for nested subprojects in gradle #685

Closed q-joshualeong closed 3 months ago

q-joshualeong commented 3 months ago

Describe the bug

Hi guys, ive set up an example gradle project with nested subprojects at this repo here. https://github.com/q-joshualeong/example-scala-metals

On the main branch, I have a nested subproject setup whereby metals dont seem to recognise that the subproject within a subproject belongs to the same gradle workspace and prompts to import the project again. This is despite bloop generating the correct json files for all nested subprojects

Here is what my bloop folder looks like.

 .bloop
├──  bloop.settings.json
├──  common-model
│   └──  build
│       ├──  bloop-bsp-clients-classes
│       ├──  bloop-internal-classes
│       │   └──  classes-bloop-cli-NR9Dgkq_Q8KrWb0yOQFhKw==-JL6sdt3RSAqNm6oeXDAKGg==
│       │       ├──  com
│       │       │   └──  example
│       │       │       └──  common
│       │       │           └──  model
│       │       │               ├──  'Hobby$.class'
│       │       │               └──  Hobby.class
│       │       └──  META-INF
│       │           └──  semanticdb
│       │               └──  data-source-common
│       │                   └──  common-model
│       │                       └── 󱧼 src
│       │                           └──  main
│       │                               └──  scala
│       │                                   └──  com
│       │                                       └──  example
│       │                                           └──  common
│       │                                               └──  model
│       │                                                   └──  Hobby.scala.semanticdb
│       └──  common-model-analysis.bin
├──  common-model.json
├──  data-source-common
│   └──  build
│       └──  bloop-bsp-clients-classes
├──  data-source-common.json
├──  data-source-person
│   └──  build
│       └──  bloop-bsp-clients-classes
├──  data-source-person.json
├──  example-scala-metals
│   └──  build
│       └──  bloop-bsp-clients-classes
├──  example-scala-metals.json
├──  person-model
│   └──  build
│       ├──  bloop-bsp-clients-classes
│       ├──  bloop-internal-classes
│       │   └──  classes-bloop-cli-NR9Dgkq_Q8KrWb0yOQFhKw==-8LioJ-1YR4ywKd6B2hKYCA==
│       │       ├──  com
│       │       │   └──  example
│       │       │       └──  person
│       │       │           └──  model
│       │       │               ├──  'Person$.class'
│       │       │               └──  Person.class
│       │       └──  META-INF
│       │           └──  semanticdb
│       │               └──  data-source-person
│       │                   └──  person-model
│       │                       └── 󱧼 src
│       │                           └──  main
│       │                               └──  scala
│       │                                   └──  com
│       │                                       └──  example
│       │                                           └──  person
│       │                                               └──  model
│       │                                                   └──  ImportedPerson.scala.semanticdb
│       └──  person-model-analysis.bin
└──  person-model.json

When I use metals in VScode, the bloop folder genreated looks similar and metals work there. So i dont think its an issue with bloop or metals.

On the feature/non-nested-structure branch, it just works as expected.

Gradle version: 7.5 Scala version: 2.12.17

Thanks so much!

Expected behavior

nvim-metals should work for nested subprojects in gradle too.

Operating system

macOS

Version of Metals

1.3.5

Commit of nvim-metals

1b87e6bfa417

q-joshualeong commented 3 months ago

Closing as similar issue to #671