soates / Auto-Import

vscode extension that will automatically finds, parses and provides code actions for all available imports. Only currently works with files in your folder and TypeScript.
MIT License
164 stars 62 forks source link

commented out imports make AI think imports exist #80

Open NoRefill opened 6 years ago

NoRefill commented 6 years ago

I am using 1.5.3 version of AutoImport in VSC 1.19.3 on Linux. I type in a line of code to see AutoImport in action and it correctly adds the appropriate imports:

import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { NgForm } from '@angular/forms';
...
@ViewChild('f') slForm: NgForm;

I then comment out the import lines and delete the line of code. Type the line of code again and no new imports are created:

// import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
// import { NgForm } from '@angular/forms';
...
@ViewChild('f') slForm: NgForm;

I'm just guessing, but it seems like the code that examines the top of the file for imports does not check to see if import lines are commented out, but probably should. The expected outcome was for new imports to be added.