Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lukewlms opened this issue Apr 17, 2019 · 14 comments
Assignees
Labels
feature-request Request for new features or functionality quick-open Quick-open issues (search, commands) search Search widget and operation issues
Milestone

Comments

@lukewlms
Copy link

lukewlms commented Apr 17, 2019

  • VSCode Version: Version 1.34.0-insider (1.34.0-insider) 6d5feae
  • 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

@vscodebot vscodebot bot added the typescript Typescript support issues label Apr 17, 2019
@mjbvz mjbvz assigned bpasero and mjbvz and unassigned mjbvz Apr 17, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Apr 17, 2019

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

@bpasero bpasero added feature-request Request for new features or functionality quick-pick Quick-pick widget issues search Search widget and operation issues and removed typescript Typescript support issues labels Apr 18, 2019
@lukewlms
Copy link
Author

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!

@iamfozzy
Copy link

I think this would be super useful 👍

@bpasero bpasero added this to the Backlog milestone Oct 24, 2019
@bpasero bpasero modified the milestones: Backlog, Backlog Candidates Nov 3, 2019
@vscodebot
Copy link

vscodebot bot commented Jan 15, 2020

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!

@vscodebot
Copy link

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!

@vscodebot vscodebot bot modified the milestones: Backlog Candidates, Backlog Jan 27, 2020
@lior-frezi
Copy link

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"

@lukewlms
Copy link
Author

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.

@stevenhao
Copy link

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

@rolandas-valantinas
Copy link

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"

Ended up here looking for this particular approach - would be very helpful in Node applications

@creatyvtype
Copy link

@stevenhao any update on this? This would be super useful.

@stevenhao
Copy link

Unfortunately no updates from me.

@bpasero bpasero added quick-open Quick-open issues (search, commands) and removed quick-pick Quick-pick widget issues labels Apr 7, 2021
@shayyzhakov
Copy link

Still no update on this one? waiting for it for so long!

@lukewlms
Copy link
Author

This remains a constant sticking point when simply trying to use modern JS as designed - when searching e.g. 'SomeM', SomeModule/index.js tends to be heavily DE-prioritized by VS Code instead of more logically putting it, generally, straight at the top of the file list. VS Code will put some pretty far-fetched matches before index.js/index.ts.

It appears to have no understanding at all of this common and recommended JS pattern 😔

@benmccann
Copy link
Contributor

It would be nice to implement this in a generic fashion that's not specific to index.js perhaps by exposing an API that plugins can use to add to a list of index files. E.g. SvelteKit index pages are named +page.svelte and it'd be nice to handle those similarly to index.js (https://kit.svelte.dev/docs/routing#page-page-svelte). If I try to open up the +page.svelte file in the docs directory, it's a pretty rough experience today because it gets a lot of matches like "d...oc...s" ahead of matches for the full string "docs" and ahead of +page.svelte files

Screenshot from 2023-06-22 10-16-10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality quick-open Quick-open issues (search, commands) search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests