Description
π Search Terms
"auto-import", "order", "import", "organize imports"
π Version & Regression Information
- This is the behavior in every version I tried.
β― Playground Link
No response
π» Code
In a simple npm package with just TypeScript 5.6.3 installed, create a TypeScript file with the following content:
import { foo } from "@foo";
import { bar } from "@bar";
import { a } from "workspace-a";
import { b } from "workspace-b";
console.log(foo + bar + a + b)
Now at the end of the file type is
and select the completion isAccessor
that brings the import from TypeScript.
π Actual behavior
The import from the completion is added below import { b } from "workspace-b";
, but notice how the import gets moved to the middle if one runs the "Organize imports" command in VS Code.
π Expected behavior
For completions and code actions that add an import to use the same ordering logic that the "Organize imports" command uses. After all this seems to be advertised by #52115 ("These rules will also apply to auto-imports and import fixes, which will use the user's collation preferences to determine if a list of import or export specifiers is already sorted before selecting an insertion point").
Additional information about the issue
No response