microsoft / microsoft/TypeScript

Autocomple import ignore rootDirs

Offen
#30,148 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Experience Enhancement Suggestion
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem tsconfig.json-Beispiel unter Verwendung von rootDirs und reproduziere die Autovervollständigung aus src/example/example.tsx nach ./, ../ und Präfixen von Unterordnern. Vergleiche die Vorschläge aus src und src_gen und nutze anschließend die verwandten Issues #28550 und #30147 als Kontext. Erledigt bedeutet, dass die Autovervollständigung die relevanten über rootDirs verfügbaren Optionen enthält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
developer-experience
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.