question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wildcard support for organize imports

See original GitHub issue

I’d like to have an option to use wildcards instead of expanding all after calling organizeImports.

I was thinking about some configuration like this, in which you can enable/disable and specify how many imports in the same namespace are required to join them by wildcard:

{
  "initializationOptions": {
    "settings": {
      "java": {
        "completion": {
          "useWildcard": true,
          "wildcardTrigger": 3
        }
      }
    }
  }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
fbriconcommented, Sep 15, 2021

You mean this? https://github.com/eclipse/eclipse.jdt.ls/blob/0b3651f030e2e68e43019268f35880a07aa7a8c5/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java#L345-L367

That’d translate to

{
  "initializationOptions": {
    "settings": {
      "java": {
        "sources": {
          "organizeImports":{
             "starThreshold": 2,
             "staticStarThreshold": 2
           }
        }
      }
    }
  }
}
0reactions
rgrunbercommented, Sep 15, 2021

Doing a quick search for neovim, it looks like nvim-jdtls references our wiki while, coc-java lists the settings directly. Maybe we could look at placing the settings there as well in the event that a client happens to just refer back to the language server itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auto import | IntelliJ IDEA Documentation - JetBrains
Disable wildcard imports to always import single classes · In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Editor | Code Style | Java ......
Read more >
organize imports with the asterisk (*) wildcard character · Issue ...
It would be great to organize imports from same package with a single asterisk (*), which makes the import section a little shorter....
Read more >
IntelliJ: Never use wildcard imports - Stack Overflow
Update: in IDEA 13 "Use single class import" does not prevent wildcard imports. The solution is to go to Preferences ( ⌘ +...
Read more >
How to disable wildcard imports in IntelliJ IDEA - Marc Nuri
How to disable wildcard imports in IDEA? ; Settings dialog ( Ctrl+Alt+S ) and navigate to the ; Editor | ; Code Style...
Read more >
Is it bad to use wildcard imports in Java? | by Dilan Tharaka
Wildcard imports tell java compiler to search for class names in the given package. Hence, using wild card imports, the compile-time performance may...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found