microsoft / microsoft/TypeScript
Autocomple import parent dir wrong when rootDirs is defined
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.3.3333
If you configure in the tsconfig.json a rootDirs section like
{
"compilerOptions": {
"baseUrl": "src",
"rootDirs": [
"src",
"src_gen"
]
}
}
When you try autocomplete an import from the parent folder (..) in a subfolder the subjections are wrong, on linux (where I tested) it add all the valid completitions as well the content of the system root (/) foolder.
Example
File src/example/example.tsx
import { exampleImport } from '../[autocomplete here]'
Try to autocomplete after ../ the displayed options are wrong, it add a lot of extra invalid options.
Note: It only happens when you are listing the ../ autocomplete options, if you already selected a subfolder inside ../ (e.g. ../shared/) it works properly.
Maybe related to: https://github.com/Microsoft/TypeScript/issues/28550 and https://github.com/Microsoft/TypeScript/issues/30148
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the supplied tsconfig.json and src/example/example.tsx, then inspect the TypeScript autocomplete path for imports beginning with ../ when rootDirs is set. Done means parent-directory suggestions contain only valid project entries and do not include system-root contents, while completion after selecting a subfolder continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100