Visual Studio Code 中的打字稿是否有自动导入功能? [英] Is there auto-import functionality for typescript in Visual Studio Code?

查看:26
本文介绍了Visual Studio Code 中的打字稿是否有自动导入功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何快捷方式可以让我自动生成我的打字稿导入?就像在类型名称旁边按 ctrl+space 并将导入声明放在文件顶部一样.如果没有,那么填写模块引用路径的智能感知怎么样,这样我就不必手动完成了?我真的很想使用 vscode,但不得不为打字稿进行手动导入让我很沮丧.

解决方案

我相信名为TypeScript Importer"的插件完全符合您的意思:

有了它,您可以真正使用 Ctrl+Space 来选择您想要导入的内容.

您可以从 Ctrl+Shift+X 菜单或仅通过粘贴 ext install tsimporter 在用 Ctrl+P 打开的快速打开菜单中.

Is there any shortcut that will allow me to auto generate my typescript imports? Like hitting ctrl+space next to the type name and having the import declaration placed at the top of the file. If not, what about intellisense for filling out the module reference path so that I wont have to do it manually? I would really love to use vscode but having to do manual imports for typescript is killing me.

解决方案

I believe the plugin called "TypeScript Importer" does exactly what You mean: https://marketplace.visualstudio.com/items?itemName=pmneo.tsimporter .

Automatically searches for TypeScript definitions in workspace files and provides all known symbols as completion item to allow code completion.

With it You can truly use Ctrl+Space to choose what exactly You would like to be imported.

You can find and install it from Ctrl+Shift+X menu or just by pasting ext install tsimporter in Quick Open menu opened with Ctrl+P.

这篇关于Visual Studio Code 中的打字稿是否有自动导入功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆