microsoft / vscode-spring-boot-dashboard

Spring Boot Dashboard for VS Code
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-spring-boot-dashboard
Other
56 stars 31 forks source link

Dashboard. Beans and endpoints duplicates #324

Closed Sorreldd closed 6 months ago

Sorreldd commented 1 year ago

image

I don't know what information will be useful. Win 10, vscode 1.79.2, maven 3.9.3, jdk 17(build 17+35-LTS-2724), spring boot parent 2.7.13 with spring-cloud-dependecies 2021.0.7 and openfeign this is NOT pre release version

martinlippert commented 7 months ago

Can you provide a sample project that can help us to reproduce this issue? I guess the underlying issue should be fixed in https://github.com/spring-projects/sts4/, but a sample project to see this issue in action would greatly help to identify the root cause.

Sorreldd commented 7 months ago

Can you provide a sample project that can help us to reproduce this issue? I guess the underlying issue should be fixed in https://github.com/spring-projects/sts4/, but a sample project to see this issue in action would greatly help to identify the root cause.

Hello, you can use this example project and i have more information how to reproduce this. vscode-bug-324.zip

  1. When you rename package, for example, rename package com.example.license in license-core to com.example.license2 and click in gradle plugin(Gradle for Java) "Reload All Gradle Projects". This will result in duplication of controller methods and beans. image

  2. Update spring-boot plugin in build.gradle from "id 'org.springframework.boot' version '3.2.2' apply false" to 3.2.4 and click "Reload All Gradle Projects". This will result in duplication of the subproject image

P.S. Re-opening vscode helps with duplicates

martinlippert commented 7 months ago

Thanks for attaching the sample project and the steps how to reproduce the issue. Unfortunately, using the sample project and following your steps, I can't reproduce this on my end.

I have two additional thoughts that could provide more insights here, would be great if you could run through those two things.

1) once the beans and mappings appear duplicated on the dashboard views, what happens if you press Cmd-T (Go to Symbols in Workspace...). Do the request mapping symbols appear duplicated there as well?

2) can you add this to your settings.json:

"spring-boot.ls.logfile": "<some-path>/vscode-log.txt"

and replace <some-path> with a path that makes sense on your machine? That would be awesome. Next time you run VSCode, it will dump the log output of the spring boot language server to that file. Once that works, can you clean up the file, then run the steps to reproduce the issue, and than attach the log output here? That would be awesome.

Maybe this reveals more insights about why those symbols appear duplicated.

martinlippert commented 6 months ago

@Sorreldd Any news from your side with regards to the thoughts I put in the previous comment?

Sorreldd commented 6 months ago

Sorry for the long answer. This is log file, I divided it and commented each step. vscode-log.txt Also my settings.json. Just in case settings.json

martinlippert commented 6 months ago

Thanks a lot for the additional details, that helps a lot. I can reproduce this within VSCode now, easy to reproduce by just renaming a random Java source file in VSCode that contains symbols. After the rename operation, the old symbol sticks around. Things get worse if you rename whole packages, then the old symbols stick around and new symbols are sometimes not even created (especially if the files from the package or not opened in editors).

Will continue to work on this as part of https://github.com/spring-projects/sts4/issues/1231, since this is caused by the underlying Spring Tools that are used by the dashboard to get those beans and request mapping items: https://github.com/spring-projects/sts4/issues/1231

Closing this one here as a duplicate of the one mentioned above. Please follow that one to keep track and maybe respond to further questions.

martinlippert commented 6 months ago

Some initial results from debugging this: https://github.com/spring-projects/sts4/issues/1231#issuecomment-2061040677.

@Sorreldd, can you disable the Project Manager for Java extension from your workspace to see if that makes a difference? Would be interesting to know.

Sorreldd commented 6 months ago

Project Manager for Java - disabled And I didn't see any changes vscode-log.txt

martinlippert commented 6 months ago

Thanks for checking and the feedback, looks like more stuff is going wrong here...

martinlippert commented 6 months ago

@Sorreldd, the issue in the Spring Boot Tools extension should be fixed as well now. If you switch both extensions (Project Manager for Java + Spring Boot Tools) to the latest pre-release, renaming packages should work now without duplicating symbols or keeping old symbols around.