Repository: TypeScript
Issue: Modifying package.json dependencies causes LS to load files it shouldn't have
Labels: Bug,Help Wanted

I've been following a [basic example on CDK for terraform][1] to add it to an existing project. I'm seeing some strange behaviour with VSCode and suggested imports that I can't get my head around. I was hoping someone could explain if I'm missing something obvious.

I've created a stripped down repo that reproduces the issue.
https://github.com/alexedwardjones/cdktf-import-issue

**All imports have to be added manually**

If I type `AwsProvider` I would expect to get an import suggestion for the below which isn't happening. 
```
import { AwsProvider } from "@cdktf/provider-aws/lib/provider";
```
If I manually add the import for `AwsProvider` it works correctly, however this continues for every import from the `@cdktf/provider-aws` dependency. For example, in order to add an `Instance` I would have to manually add the import.

```
import { AwsProvider } from "@cdktf/provider-aws/lib/provider"; // Manually added
import { Instance } from "@cdktf/provider-aws/lib/instance"; // Manually added

export default class ServiceStack extends TerraformStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    const awsProvider = new provider.AwsProvider(this, "aws", {
      region: "us-east-1",
    });

    const instance = new Instance(this, 'ec2-instance', {
      ami: 'ami-0c55b159cbfafe1f0',
    });
```
**Suggested imports for the `/lib/<NAMESPACE>` start working after but only after importing a namespace from the root of the dependency**

If I add an import of a namespace such as `provider` or `instance` from the root of the dependency such as `provider` then the `/lib` import suggestions will start working correctly for all of the remaining imports.

```
import { provider } from "@cdktf/provider-aws";
import { Instance } from "@cdktf/provider-aws/lib/instance"; // Automatically suggested

export default class ServiceStack extends TerraformStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    const awsProvider = new provider.AwsProvider(this, "aws", {
      region: "us-east-1",
    });

    const instance = new Instance(this, 'ec2-instance', {
      ami: 'ami-0c55b159cbfafe1f0',
    });
```

... or ...

```
import { instance } from "@cdktf/provider-aws";
import { AwsProvider } from "@cdktf/provider-aws/lib/provider"; // Automatically suggested

export default class ServiceStack extends TerraformStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    const awsProvider = new AwsProvider(this, "aws", {
      region: "us-east-1",
    });

    const instance = new instance.Instance(this, 'ec2-instance', {
      ami: 'ami-0c55b159cbfafe1f0',
    });
```

I don't think I should have to import `provider` or `instance` to have the import of `AwsProvider` or `Instance` from `/lib/<NAMESPACE>` start working.

**Suggested imports start working if I remove dependencies from my `package.json`**

There are more dependencies in the project than just the cdk tf packages. I've noticed that if I remove some dependency entries from my `package.json` then the suggested imports start working as expected.

Note that this doesn't involve running any `npm install/uninstall` but simply removing lines from the `dependencies` object and saving the `package.json` file causes the imports to start working correctly. There's no specific dependency I remove that causes it to start working again.

  [1]: https://developer.hashicorp.com/terraform/tutorials/cdktf/cdktf-build#define-your-cdk-for-terraform-application