microsoft / microsoft/TypeScript

Autocomple import ignore rootDirs

Open
#30,148 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Experience Enhancement Suggestion
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 the subjections ignore what is available in the rootDirs, only show the options available in the same folder of the editing file.

Example

File src/example/example.tsx

import { exampleImport } from './[autocomplete here]'
import { exampleImport2 } from '../[autocomplete here]'

Try to autocomplete after ./, ../, or any subfolder, the displayed options are only the options available in the src folder, but not the options available in the src_gen folder.

Note: No matter the folder's order in the rootDirs sections, the result is the same. The value of the baseUrl option is not important for reproduce this behaviour.

Maybe related to: https://github.com/Microsoft/TypeScript/issues/28550 and https://github.com/Microsoft/TypeScript/issues/30147

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the tsconfig.json example using rootDirs and reproduce autocomplete from src/example/example.tsx after ./, ../, and subfolder prefixes. Compare the suggestions from src and src_gen, then use the related issues #28550 and #30147 for context. Done means autocomplete includes the relevant options available through rootDirs.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.