Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"CTRL + SHIFT + o" for organize import not working in STS [duplicate]

I have to remove unused imports in my project. Previously i was using eclipse but now i work on STS.

In STS "CTRL + SHIFT + o" is not working to remove unused imports.

like image 929
Devram Kandhare Avatar asked Aug 02 '17 09:08

Devram Kandhare


People also ask

How do I organize imports in STS?

Instead of resolving each unresolved references, you can press CTRL+SHIFT+O that is a short cut for organize imports in Spring STS or any eclipse based tool. If you are working on Mac like me then the shortcut is COMMAND+SHIFT+O.

What is Ctrl Shift O in eclipse?

Ctrl + D. Deletes current line in the editor. Command + Shift + O. Ctrl + Shift + O. Organize imports in the current java file.

How do you organize imports in Java?

Go to Window > Preferences > Java > Code Style > Organize Imports. Change the value of Number of imports need for .

How do I remove unused imports in eclipse?

Eclipse provide a shortcut CTRL + SHIFT + O, this shortcut command will remove all those unused imports from your code file.


1 Answers

This is a bug of the Spring IDE, I've had it myself in the past.

  1. Go to Window -> Preferences -> General -> Keys
  2. Order by Binding
  3. Search for / Scroll to the Ctrl + Shift + O bindings
  4. Unbind all commands with the binding Ctrl + Shift + O except the command Organize Imports
  5. Set When to Editing Java Source
  6. Apply, OK, and you should be good to go

General -> Keys

like image 122
Impulse The Fox Avatar answered Sep 28 '22 01:09

Impulse The Fox