You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I wonder that there is no way to quickly add static import (+ refactor all occurances).
It is really actual while writing tests or using spring 5 functional routing for example.
If you want to enable static import for spring 5 members, you need modify the user settings and append your favorite package into java.completion.favoriteStaticMembers.
For example:
Reacted by Aaron Foltz, G. Allegretta, sperez-belikesoftware, "hol"mo"fy", Marian Marcoci, IBR41Furkan, Rafael Torres Coelho Soares (aka Tuelho), Manoj Baishya, João Vitor, John Chesser and 7 more
@fbricon thanks for the update! any chance we could have this feature in Show Code Actions dropdown like it is in IntelliJ, perhaps a toggle to move the feature function to there for those who want it?
So for me this was never enabled by default and I had to Edit in settings.json in the settings UI (java.completion.favoriteStaticMembers) for it to add the default static imports to my settings.json.
Very weird behaviour, but at least it works now. Seems to me like this is not set on install (neither in default / user settings.json).
Activity
cedric05 commentedon Feb 21, 2019
static import itself throwing error, in my case
testforstephen commentedon Mar 15, 2019
@jnesspro By default, the Java extension will only recommend static import for the members below.
If you want to enable static import for spring 5 members, you need modify the user settings and append your favorite package into
java.completion.favoriteStaticMembers.For example:
testforstephen commentedon Mar 15, 2019
@cedric05 Can you execute VS Code command
Java: Open Java Language Server log file, and share us the log?cedric05 commentedon Mar 15, 2019
@testforstephen sorry for filing wrong. its working.
fbricon commentedon Mar 26, 2019
You asked for it, @testforstephen delivered:
notmattlythgoe commentedon May 21, 2019
@fbricon How are you bringing up the menu?
fbricon commentedon May 21, 2019
Click on static method,
Ctrl+.(Cmd+.on mac) or click on lightbulb or right-click -> Code Actionbvedant commentedon May 4, 2022
@fbricon thanks for the update! any chance we could have this feature in Show Code Actions dropdown like it is in IntelliJ, perhaps a toggle to move the feature function to there for those who want it?
appleseedexm commentedon Feb 22, 2023
So for me this was never enabled by default and I had to
Edit in settings.jsonin the settings UI (java.completion.favoriteStaticMembers) for it to add the default static imports to mysettings.json.Very weird behaviour, but at least it works now. Seems to me like this is not set on install (neither in default / user
settings.json).