gpt4 book ai didi

typescript - vscode typescript : 'Add all missing imports' shortcut

转载 作者:搜寻专家 更新时间:2023-10-30 20:41:04 25 4
gpt4 key购买 nike

我正在开发一个 typescript 项目 (typescript3.x)。

我最近注意到 Add all missing imports 当我使用多个尚未导入的类型时单击灯泡时出现,如下所示:

是否有相同的快捷方式?还是我应该将其作为一项功能来请求?

提前致谢

最佳答案

Is there a shortcut for the same?

是的,将在 v1.46 中推出(请参阅 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 importsin a JavaScript or TypeScript file. This iteration, we introduced anew Add all missing imports source action lets you trigger this fromanywhere 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"
]

关于typescript - vscode typescript : 'Add all missing imports' shortcut,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52926371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com