I am working on a typescript project (typescript3.x).
I recently noticed the Add all missing imports
when I click on the bulb which comes when I am using more than one types which are not yet imported as shown below:
Is there a shortcut for the same? Or should I request it as a feature?
Thanks in advance
You can define a keyboard shortcut for any task. From the Command Palette (Ctrl+Shift+P), select Preferences: Open Keyboard Shortcuts File, bind the desired shortcut to the workbench.
Ctrl+D selects the word at the cursor, or the next occurrence of the current selection. Tip: You can also add more cursors with Ctrl+Shift+L, which will add a selection at each occurrence of the current selected text.
Set the correct Python path in VSCode In order to fix Unresolved Import in VSCode, you have to set python. pythonPath key in the settings to the correct value. You can quickly open the settings. json editor by accessing File > Preferences or press Ctrl + , key combination.
The default shortcut is Alt + Shift + .
Is there a shortcut for the same?
Yes, coming in v1.46 (see v1.46 release notes: add missing imports source action):
Add all missing imports source action
VS Code has long supported a quick fix that adds all missing imports in a JavaScript or TypeScript file. This iteration, we introduced a new
Add all missing imports
source action lets you trigger this from anywhere in a file.This also allows you to set up a keybinding for
Add all missing imports
:{ "key": "ctrl+shift+i", "command": "editor.action.sourceAction", "args": { "kind": "source.addMissingImports", "apply": "first" } }
Or even enable
Add all missing imports
on save:"editor.codeActionsOnSave": [ "source.addMissingImports" ] or "editor.codeActionsOnSave": { "source.addMissingImports": true }
"editor.codeActionsOnSave": [
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With