Skip to content

Comments

vscode: configure source.organizeImports, disable source.fixAll.ts#3964

Open
nstepien wants to merge 4 commits intomainfrom
organizeImports
Open

vscode: configure source.organizeImports, disable source.fixAll.ts#3964
nstepien wants to merge 4 commits intomainfrom
organizeImports

Conversation

@nstepien
Copy link
Collaborator

@nstepien nstepien commented Feb 20, 2026

It's basically impossible to find docs on vscode's settings online,
but organizeImports sorts imports (import lines + named imports) and removes unused imports.
I've enabled it so that we can sort named imports on save, until oxfmt handles it.

Caveats:

  • It also sorts exports, which may be undesirable.
  • It also moves import type {} from 'a'; above import {} from 'a';

Had to save all the files manually to see the impact.

WDYT? I don't mind reverting the import/export orders.
We could live without it.
As I understand it, source.organizeImports merges these two settings into one:

    "source.removeUnusedImports": "explicit",
    "source.sortImports": "explicit"

so we could keep source.removeUnusedImports only.

Also disabled source.fixAll.ts as it's very annoying when vscode removes unreachable code on save when debugging.

https://code.visualstudio.com/docs/typescript/typescript-refactoring#_organize-imports
https://code.visualstudio.com/docs/configure/settings
https://code.visualstudio.com/docs/reference/default-settings

We could also set "allowUnreachableCode": false, in tsconfig.base.json,
so that tsc reports unreachable code as an error.
The default is to report unreachable code in the editor, but not report it when running the tsc cli.
I wonder if it'd help agents if they prioritize TypeScript?

https://www.typescriptlang.org/tsconfig/#allowUnreachableCode

@nstepien nstepien self-assigned this Feb 20, 2026
@nstepien nstepien changed the title vscode: configure source.organizeImports vscode: configure source.organizeImports, disable source.fixAll.ts Feb 20, 2026
@nstepien nstepien marked this pull request as ready for review February 20, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant