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

Resource bundles causing highlighting problems #348

Open
SeaJaredCode opened this issue May 8, 2018 · 1 comment
Open

Resource bundles causing highlighting problems #348

SeaJaredCode opened this issue May 8, 2018 · 1 comment

Comments

@SeaJaredCode
Copy link

I'm seeing the same behavior described in #328, but the cause is not because of multiple projects for the same files as it was deemed there. It seems to be something specifically around the resources target type.

For instance, if I have a folder structure like:

configs/application.conf
tests/test.scala
BUILD
source.scala

My project works fine with the following targets:

scala_library(
    name='lib',
    sources=globs('*.scala'),
)

junit_tests(
    name='tests',
    dependencies=[
        ':lib',
        '3rdparty/jvm/org/scalatest',
    ],
    sources=globs('test/*.scala'),
)

But if I add the following target it breaks as previous described:

resources(
    name='configs',
    sources=globs('configs/*'),
)

I can work around by making the configs target use their own BUILD file/project. This does seem to be an actual issue because (in this case) all files exist in exactly one target. The junit_tests are included to show it something about resource bundles because it uses the same relative structure and does not have the same issue. The highlighting issue in this example will be in source.scala.

screen shot 2018-05-08 at 11 32 06 am

You can see the result of the confusion in loading b/c the project window shows that the root of the project is claimed to be "test_configs resources root", where it should be "test_lib source root". It's like it doesn't notice that the configs target is limited to a subdirectory.

Note about repro: A refresh will "fix" the issue after removing the resources section, but a refresh will not always repro after adding it. A full restart of IntelliJ is often required to consistently repro. There is some constellation that can get it to repro without restarting, but it is not clear to me what it is.

@SeaJaredCode
Copy link
Author

I think I understand what the issue is now.

I'm assuming it's because the path to the resources in the resulting jar will be rooted at the project root. I'm assuming this is a source of some ambiguity in the purpose of the project root.

For my use case this is undesirable and the requirement to create the build file within the resources folder remains even without intellij. Though it's no longer my use case, I'm not sure that it's an invalid one, but I'll defer to the maintainers to see if there is any improvement desired.

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

1 participant