question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

index.js/index.ts file should show at top of file picker when searching for the name of the directory

See original GitHub issue
  • VSCode Version: Version 1.34.0-insider (1.34.0-insider) 6d5feae57959287fb116467f4eb6c7079571b466
  • OS Version: MacOS 10.14.4

Expected: In TypeScript, index.js should show up at or near the top of the list, identically to if it was called ./MyComponent.ts. (Since index.ts is a shorthand for “whatever this directory is” - e.g. MyComponent/index.ts can be imported as just ./MyComponent).

Note that there is currently no clean and quick way to open such a file since typing “index” is highly general and may bring up a huge list, and the dev doesn’t know to type both the component name and index because it’s not clear by looking at the import line that the module is being imported from a file named “index.ts”.

Actual: File often appears well down the list of choices, including below items that are seldom if ever selected. Example typing “regi” and wanting to open “registerLoginRoutes/index.ts”:

image

Steps to Reproduce:

  1. Create an index.ts file within a directory
  2. Cmd+p to open file search box
  3. Start typing the name of the directory

Does this issue occur when all extensions are disabled?: Yes

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:54
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
vscodebot[bot]commented, Jan 27, 2020

🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

7reactions
liorJuicecommented, Jan 28, 2020

i will add, for those files, show the name of the folder first in the tab title instead of the file name.

example: “SomeFeature …/index.js” instead of “index.js …/SomeFeature”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should the index.ts be resolved by TypeScript as default ...
Automatic resolution of a directory to a file named index in that directory ... (module) name, this will treat index.ts as the folder...
Read more >
TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript project... Compiler Options. Top Level....
Read more >
Smarter way to organize “import” statements using “index.ts ...
Typescript module resolution picks up index.ts file from folder name if it is there and try to import packages. In this file, we...
Read more >
Delightful React File/Directory Structure - Josh W Comeau
How should we structure components and other files in our React apps? ... bundler will seek out an index file ( index.js ,...
Read more >
Dependency resolution - Parcel
Directory index files. #. In JavaScript, Typescript, and other JS-based languages, dependency specifiers may resolve to a directory rather than a file. If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found