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

Created on 17 Apr 2019  路  8Comments  路  Source: microsoft/vscode

  • 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

feature-request quick-pick search

Most helpful comment

I'd love to take a stab at this, if someone could point me in the right direction to get started.

All 8 comments

Adding @bpasero for feedback since quick open cannot be controlled by extensions. Not sure we'd want it to be non-deterministic

I'd like it to still be deterministic, but greatly increase the priority of ranking e.g. ./MyComponent/index.ts or MyComponent/index.js when typing "MyComponent" since generally that's actually the most important file in the project for the term "MyComponent".

Thanks for the consideration!

I think this would be super useful 馃憤

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

:slightly_smiling_face: 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!

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"

It's currently very clunky to use index files within directories - in a large project there are dozens (or more) of files named "index" and VS Code currently has very limited capability to distinguish between them.

Great to see this get the needed attention. I do think this is a very essential change in order to use JS/TS modules as they are intended to be used.

I'd love to take a stab at this, if someone could point me in the right direction to get started.

Was this page helpful?
0 / 5 - 0 ratings