microsoft / microsoft/TypeScript
Path based Code navigation to /index.js seems broken
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
- VSCode Version: 1.42.1
- OS Version: Mac OS
Steps to Reproduce:
Code navigation seems broken when you import by path and the file is actually in an index.js file.
There are a couple of scenarios relevant to developing in react-native
- import from another package in a monorepo
import SomeComponent from 'common-lib/Router, when the file ispackages/common-lib/src/Router/index.js - import in the same package
import SomeComponent from 'modules/Router, when the file issrc/modules/Router/index.js import SomeComponent from 'modules/Router, when the file is not actually index.jssrc/modules/Router/index.ios.jsandsrc/modules/Router/index.android.js
In general, what works is loading a file name by name (not an index.js file)
What doesn't work is loading a file by path that is actually an index.js, index.native.js, index.ios.js, index.android.js etc file
My code structure is
root
packages
mobile
server
src
server
shared
common-lib
There is some history here that is not ideal. But ok.
packages/server jsconfig.json
{
"compilerOptions": {
"target": "es2017",
"allowSyntheticDefaultImports": false,
"baseUrl": ".",
"paths": {
"common-lib/*": ["../common-lib/*"],
"mobile/*": ["../mobile/*"],
"modules/*": ["./src/shared/modules/*"],
"components/*": ["./src/shared/components/*"],
"router/*": ["./src/shared/router/*"],
"server/*": ["./src/server*"],
"App": ["./src/App"]
}
},
"exclude": ["node_modules", "../../node_modules", "build"]
}
Does this issue occur when all extensions are disabled?: Yes
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die drei Importfälle mit der bereitgestellten packages/server jsconfig.json nachzustellen, einschließlich index.js und plattformspezifischer Indexdateien. Verfolge die Code-Navigation für pfadbasierte Imports und vergleiche sie mit Imports benannter Dateien; abgeschlossen ist die Aufgabe, wenn die Navigation in jedem aufgeführten Szenario das aufgelöste Modul erreicht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- developer-experience, devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100