[英]Why add missing import open new tab with the same file in vscode?
[英]Is there a keybinding in vscode for add import to an existing import statement or how to add imports on the fly in vscode?
似乎VSCode市場上的當前擴展無法正確添加角度導入。 例如,當我使用Path IntelliSense擴展名添加OnInit時
export class AppComponent implements OnInit
它從進口
import { OnInit } from '@angular/core/core'
代替
import { OnInit } from '@angular/core'
正如它應該。 我嘗試瀏覽市場上的擴展程序,但找不到任何遠程可行的方法。 但是我注意到VSCode提供了添加到現有import語句中的功能,您可以在此處的屏幕截圖中看到該功能。
有什么方法可以使用快捷鍵綁定,而無需在出現時單擊黃色燈泡並手動選擇它? 和/或/或者您是否知道一個很好的擴展,可以像WebStorm一樣正確添加Angular導入? (我仍然選擇通過更輕巧,更快的VSCode使用WebStorm的幾個原因之一)。
當光標位於要導入的類型時,可以按⌘ + 。 (我猜在Windows上是Ctrl + 。 )。
使用TypeScript 2.2可以做到這一點。 在此之前,很多人都使用此擴展名: https : //marketplace.visualstudio.com/items?itemName=rbbit.typescript-hero
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.