Skip to content

Automatic Type Acquisition based on filename matching pulls in too many irrelevant typings #40123

Closed
@minestarks

Description

@minestarks

Consider a simple JavaScript project with files like the following

/flight.js
/platform.js
/myfile.js

The names flight and platform seem innocuous enough, but their mere presence causes Automatic Type Acquisition to pull in @types/flight and @types/platform. Because these words are so common, I would argue it's highly unlikely that the user actually needs the typings for these libraries - much more likely that the files are just regular files in the user's project. I think ATA's behavior is a little too eager, and causes unnecessary files and symbols to be added to the project context. There's also no visual indication that this is actually happening (but you can confirm it by checking TS Server logs).

This behavior happens in VS Code if you have the files open in the editor. But it occurs in VS if you have them present in your project at all.

I propose one or more of the following solutions:

  • Disable this filename-matching behavior entirely
  • Trim back the allow-list considerably to only include obvious libraries like jquery.
  • Give a visual indicator to the user that ATA is doing this, and give them a way to disable it

@DanielRosenwasser

Metadata

Metadata

Assignees

Labels

Domain: JavaScriptThe issue relates to JavaScript specificallyFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions