You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File quick open should support relative paths #53279
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.
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.
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.
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:
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.
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.
Activity
roblourens commentedon Jun 29, 2018
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/barwill 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.JacksonKearl commentedon Jun 29, 2018
Do we look for paths relative to workspace root? It seems like we don't. For instance I can't open
./package.jsonin our repo.JacksonKearl commentedon Jun 29, 2018
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.roblourens commentedon Jun 29, 2018
I guess the code I was thinking of just does
path.joinwith 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: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.bpasero commentedon Jun 30, 2018
Same here
Yes, for sure nothing that should live in the search service.
JacksonKearl commentedon Jul 17, 2018
I think this is mostly addressed by #9418
joaomoreno commentedon Aug 2, 2019
From Gustav Paul (@gpaul):