language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

`typescript.removeUnusedImports` does not work when using `defineModel()`

Open MetRonnie opened this issue 1 month ago • 2 comments

Vue - Official extension or vue-tsc version

3.2.2

VSCode version

1.107.1

Vue version

3.5.24

TypeScript version

5.9.3

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 13th Gen Intel(R) Core(TM) i5-1345U
    Memory: 2.18 GB / 15.66 GB
  Binaries:
    Node: 22.21.1 
    Yarn: 4.11.0 
    npm: 10.9.4

package.json dependencies


Steps to reproduce

  1. Have a SFC file that uses <script setup> and the defineModel() macro.
  2. Run the command TypeScript: remove unused imports in VS Code

What is expected?

It should remove unused imports

What is actually happening?

Nothing happens

Link to minimal reproduction

No response

Any additional comments?

Support for removing unused imports added in https://github.com/vuejs/language-tools/pull/5444

MetRonnie avatar Jan 08 '26 17:01 MetRonnie

Cannot reproduce, please provide a minimal reproduction.

serkodev avatar Jan 08 '26 18:01 serkodev

I have realised this actually only happens if you use defineModel(), I've updated the OP

MetRonnie avatar Jan 08 '26 18:01 MetRonnie