-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Auto-importDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.9.0-dev.20200420
Search Terms:
- fix all
- code action
- quick fix
Code
With @types/node installed, open a file:
join();
homedir()- Now trigger quick fixes and select
add all missing imports
Bug:
The two imports are added on the same line:
import { join } from "path";import { homedir } from "os";
join();
homedir()Here's the edit that TS Server returns in this case
[Trace - 23:52:04.985] <semantic> Response received: getCombinedCodeFix (72). Request took 13 ms. Success: true
Result: {
"changes": [
{
"fileName": "/Users/matb/projects/san/test.ts",
"textChanges": [
{
"start": {
"line": 1,
"offset": 1
},
"end": {
"line": 1,
"offset": 1
},
"newText": "import { join } from \"path\";"
},
{
"start": {
"line": 1,
"offset": 1
},
"end": {
"line": 1,
"offset": 1
},
"newText": "import { homedir } from \"os\";\n"
}
]
}
]
}
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Auto-importDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issueA PR has been opened for this issue