Skip to content

File quick open should support relative paths #53279

Closed

Description

It would be nice if a user could use Ctrl-p to open something like ../index.html. As it stands a user can only search for file names, not locations, so if a project has many of the same named files (index.html, project.json, etc.) it can be hard to open the right one.

Activity

  1. added
    search
    on Jun 28, 2018
  2. roblourens commented on Jun 29, 2018

    @roblourens
    Member

    Would this be relative to the current file? I like that ctrl+p works globally so it's predictable and I don't have to think about where I am currently. e.g. foo/bar will do a global search, not just look for foo under the current directory. We do look for relative path matches relative to the folder root so this would overload that. But maybe relative path matches relative to the current file could be prioritized.

  3. added
    feature-request
    on Jun 29, 2018
  4. JacksonKearl commented on Jun 29, 2018

    @JacksonKearl
    ContributorAuthor

    Do we look for paths relative to workspace root? It seems like we don't. For instance I can't open ./package.json in our repo.

  5. JacksonKearl commented on Jun 29, 2018

    @JacksonKearl
    ContributorAuthor

    I think we should keep current behaviour except for strings that start with ./ or ../. Right now, these queries don't help much (./ in our repo gives results from all of our dot directories, and ../ gives no results). We could make ./ and ../ be relative to current file, and maybe make / relative to either filesystem root or workspace root.

  6. roblourens commented on Jun 29, 2018

    @roblourens
    Member

    I guess the code I was thinking of just does path.join with the folder and the query (so ./ isn't respected) and if it's a match, then it skips the excludes. I think it's not working though.

    / already works for searching with absolute paths:

    image

    I don't know if I'm sold on ./ and ../, it doesn't fit my mental quickopen model, but I can see how it would be useful. Benjamin Pasero (@bpasero)? I would imagine this would be another feature on the quickopen frontend that a search provider doesn't know about.

  7. bpasero commented on Jun 30, 2018

    @bpasero
    Contributor

    I don't know if I'm sold on ./ and ../, it doesn't fit my mental quickopen model

    Same here

    I would imagine this would be another feature on the quickopen frontend that a search provider doesn't know about

    Yes, for sure nothing that should live in the search service.

  8. JacksonKearl commented on Jul 17, 2018

    @JacksonKearl
    ContributorAuthor

    I think this is mostly addressed by #9418

  9. locked and limited conversation to collaborators on Aug 31, 2018
  10. joaomoreno commented on Aug 2, 2019

    @joaomoreno
    Contributor

    From Gustav Paul (@gpaul):

    I had the same issue as in #53279 and wrote a little extension to fix it: quickOpenRelative.

    See https://marketplace.visualstudio.com/items?itemName=gpaul.quickOpenRelative

    The extension provides a single command quickOpenRelative.quickOpenRelative that opens the quick launch panel with the current directory path filled in, which is equivalent to trying to open a file in the current directory. I've bound my default ctrl+p to this command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature-requestquick-picksearch

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions