Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Organize Imports shortcut not working after STS update

After installing the most recent update to STS 3.9.0, my Ctrl+Shift+O keyboard to Organize Imports is no longer working. The key shortcut exists in Preferences->General->Keys ("Keys" preferences) but is missing in the Source menu ("Source" menu).

like image 456
Matt Halstead Avatar asked Jul 13 '17 15:07

Matt Halstead


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.

How do I change keyboard shortcuts in STS?

The main preference page can be found under Window > Preferences > General > Keys (or faster: Press Ctrl+3, type Keys and press Enter). From here you can see all commands and assign/change their associated keyboard shortcuts.

How do I organize imports in Eclipse?

Automatically organise import statements whenever you save Here are the steps to organising imports whenever you save: Go to Window > Preferences > Java > Editor > Save Actions. Select Perform the selected actions on save (off by default). Ensure that Organize imports is selected (on by default).

What is Ctrl Shift O in Eclipse?

In Eclipse, you press CTRL + SHIFT + O “Organize Imports” to import packages automatically. For IntelliJ IDEA, if you press CTRL + ALT + O “Optimize Imports”, it just removes some unused imports, never imports any package.


2 Answers

This is a bug. You can workaround it by fixing the Eclipse shortcut keys preferences.

From the bug report:

here is how you can fix that issue:

Go to the Preferences -> General -> Keys press Filters... and de-select Filter uncategorized commands. Look for the command "Go To Symbol in File" and select that, press unbind and Apply and Close

like image 55
Kris Avatar answered Oct 13 '22 12:10

Kris


Another way to fix this that survives STS restarts is to go: Preferences -> General -> Keys and change the "When" value to 'Editing Java Source'.

This is how I have my settings and works for me

like image 21
Javier Z. Avatar answered Oct 13 '22 11:10

Javier Z.