Regression bug: Typescript: Remove Unused Imports broken

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Requesting ‘Typescript: Remove Unused Imports’ from the Command Palette does not remove unused imports, despite the typescript server correctly reporting them as reportsUnnecessary.

This is a regression in Cursor. This used to work, and it still works for the same repository in VS Code.

The typescript server (6.0.3) correctly identifies the import as unnecessary when you inspect the tsserver.log. See below for suggestion","reportsUnnecessary":true

Info 96   [21:27:06.277] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":"/workspaces/imports-broken/src/main.ts","diagnostics":[]}}
Info 97   [21:27:06.277] event:
    {"seq":0,"type":"event","event":"semanticDiag","body":{"file":"/workspaces/imports-broken/src/main.ts","diagnostics":[]}}
Info 98   [21:27:06.277] event:
    {"seq":0,"type":"event","event":"suggestionDiag","body":{"file":"/workspaces/imports-broken/src/main.ts","diagnostics":[{"start":{"line":1,"offset":1},"end":{"line":1,"offset":42},"text":"'createHash' is declared but its value is never read.","code":6133,"category":"suggestion","reportsUnnecessary":true}]}}
Info 99   [21:27:06.277] event:
    {"seq":0,"type":"event","event":"requestCompleted","body":{"request_seq":6,"performanceData":{"diagnosticsDuration":[{"syntaxDiag":0.011620000004768372,"semanticDiag":0.012939000000187661,"suggestionDiag":0.1231060000063735,"file":"/workspaces/imports-broken/src/main.ts"}]}}}

I’ve included my own full tsserver.log and version info in the reproduction github repository I’ve created below.

Steps to Reproduce

  • Create a typescript file with an unused import, such as:

    import { createHash } from "node:crypto";
    // no other code, just the import above
    
  • Ctrl+Shift+P (windows/linux) or the mac equivalent to open the command palette

  • Select: > Typescript: Remove Unused Imports

For a hermetic environment reproducing this bug minimally using a devcontainer, please clone:

^— My tsserver.log is duplicated in there for reference. The relevant log activity when requesting Remove Unused Imports occurs starting at Info 88 within the log.

Expected Behavior

Unused typescript imports should be removed.

Operating System

Linux

Version Information

Note that I am using Remote over SSH + devcontainers. The host running typescript is Linux x86_64. The version below is for the Windows environment that is driving the remote SSH+devcontainer.

Version: 3.15.6 (user setup)
VS Code Extension API: 1.128.0
Commit: a1f686545fd0ce8917bbd2449f733551a9bce420
Date: 2026-08-06T01:41:03.876Z
Layout: IDE
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.291
OS: Windows_NT x64 10.0.26200

Additional Information

This bug occurs regardless of whether a devcontainer is used. This occurs regardless of whether the typescript is the 6.0.3 embedded within Cursor, or whether I use the same 6.0.3 from my own node_modules.

Another user reported a more generic bug recently, but I’m creating this one with a clear, concise description for reproduction and logs. Another user reports that the bug did /not/ exist in Cursor v3.14.7 - but that they later saw the bug starting in v3.14.27. Source comment: forum. cursor. com/t/javascript-remove-unused-imports-organize-imports-no-op/167696/10

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the detailed report. The minimal repro, tsserver.log, and version info make it much easier to debug.

This is a known issue we’re tracking. Starting around 3.14.x, manually triggered code actions like Remove Unused Imports, Organize Imports, and Source Action stopped working across different languages, even though the language server itself is healthy and reports diagnostics correctly. Your tsserver.log confirms that. So it’s not something in your setup, and it’s not related to SSH or devcontainers.

Good news: we found the cause, a fix is ready, and it’ll ship in one of the next releases. I can’t share an exact version or date yet, but I’ll reply here once the update is out.

Thank you for the update @deanrie

For everyone else, there is a workaround. Edit your user or project settings.json to include:

    "editor.codeActionsOnSave": {
        "source.organizeImports": "explicit",
        "source.removeUnusedImports": "explicit"
    }

The key to this bug is that it only refuses to organize, sort, and remove unused imports when you manually request it via keyboard shortcuts or command palette. However, if you trigger this request on save, then it still works.

If you Ctrl+S or otherwise trigger a save, it will clean up your imports automatically with the settings above. Files need not have any modifications: Even a save request on an unedited file will trigger a sort/cleanup.