scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.09k stars 330 forks source link

java/scala project semanticdb-java: bloop fails #6033

Open ecrabor8 opened 9 months ago

ecrabor8 commented 9 months ago

Type: Bug

sbt compile from within vscode with metals extension where there is java and scala code in one "package" (directory) that reference each other fails with error saying "semanticdb-javac: bloop" showing the first "package" line in the file and marking all lines in red. Nothing else.

Adding the sbt setting compileOrder := CompileOrder.JavaThenScala or the other way around leads to real failures and cannot be done given the references of the symbols to from java/scala files

Note the issue seems to be from semanticdb code in use with metals extension. Running sbt compile outside of vscode/metals is just fine.

Extension version: 1.27.0 VS Code version: Code 1.82.2 (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:59:47.790Z) OS version: Darwin x64 22.6.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 3, 3| |Memory (System)|16.00GB (2.73GB free)| |Process Argv|. --crash-reporter-id 2806022a-4b5a-47af-99e1-6a9859f8bdb2| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscorecescf:30445987 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 vscaac:30438847 vsclangdc:30486549 c4g48928:30535728 azure-dev_surveyone:30548225 0bi6i642:30933247 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 dsvsc019a:30933241 ```
tgodzik commented 9 months ago

Thanks for reporting! Does it work correctly if Java and Scala are in separate directories?

ecrabor8 commented 9 months ago

hi Tomasz, No it does not. I tried putting the 5 scala files i different directory from any of the java files and same result after restarting vscode. As i must have stated, the java and the scala share package name(s). I dont want to have to alter the package names of this legacy code here. (and so have not tried this.) Craig

On Fri, Jan 19, 2024 at 5:31 AM Tomasz Godzik @.***> wrote:

Thanks for reporting! Does it work correctly if Java and Scala are in separate directories?

— Reply to this email directly, view it on GitHub https://github.com/scalameta/metals/issues/6033#issuecomment-1900150900, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD2AFFKUMRJGTAFOUUHQZTYPJDQNAVCNFSM6AAAAABCBXDEMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBQGE2TAOJQGA . You are receiving this because you authored the thread.Message ID: @.***>

tgodzik commented 9 months ago

What kind of error do you get? Do you have a smaller example this fails on?

tgodzik commented 9 months ago

You could also set compileOrder := CompileOrder.Mixed and reimport to see if this helps

ecrabor8 commented 9 months ago

Hi Tomasz, within the "Problems" tab in vscode/metals i dont get anything more than error with "semanticdb-java bloop".

On Mon, Jan 22, 2024 at 5:07 AM Tomasz Godzik @.***> wrote:

What kind of error do you get?

— Reply to this email directly, view it on GitHub https://github.com/scalameta/metals/issues/6033#issuecomment-1903653160, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD2AFEYYLWQMY5XYTBNGBLYPY25TAVCNFSM6AAAAABCBXDEMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBTGY2TGMJWGA . You are receiving this because you authored the thread.Message ID: @.***>

kasiaMarek commented 8 months ago

Hi, I'm not really able to reproduce the issue just by having scala and java share package and reference each other. Do you have a small reproduction of the problem? Do you have anything of value in the metals logs?

ecrabor8 commented 8 months ago

hi, i will try to get it down to small example but it will need many hours of effort to get there. this is from a million line code base with two separate git repos. the involved area is very central to the code. also large build.sbts involved. will be awhile to get to this. craig

On Fri, Jan 26, 2024 at 6:29 AM Katarzyna Marek @.***> wrote:

Hi, I'm not really able to reproduce the issue just by having scala and java share package and reference each other. Do you have a small reproduction of the problem? Do you have anything of value in the metals logs?

— Reply to this email directly, view it on GitHub https://github.com/scalameta/metals/issues/6033#issuecomment-1911926637, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACD2AFGDTK75A3MJYE7XONTYQOHP5AVCNFSM6AAAAABCBXDEMGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJRHEZDMNRTG4 . You are receiving this because you authored the thread.Message ID: @.***>