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

Parse ":line " in Quick Open #70726

Closed
axdiamond opened this issue Mar 19, 2019 · 4 comments
Closed

Parse ":line " in Quick Open #70726

axdiamond opened this issue Mar 19, 2019 · 4 comments
Assignees
Labels
*extension-candidate Issue identified as good extension implementation feature-request Request for new features or functionality search Search widget and operation issues

Comments

@axdiamond
Copy link

axdiamond commented Mar 19, 2019

Currently, typing a file name with colon and a line number into Quick Open will take you to that line in the file. This is great!
However, ASP Core currently logs exceptions like this

 System.Exception: Oopsie
 at Controllers.ContactController.Get(Guid id) in .\Controllers\ContactController.cs:line 44

And the Quick Open menu is unable to parse ":line 44" as a line number, so when I copy/paste the file name, the open file command is hidden.

I would like if the Quick Open menu was able to parse this as a line number, and take me to the expected location.

@axdiamond
Copy link
Author

axdiamond commented Mar 19, 2019

I've done some digging, and it seems that currently, the regex that drives this functionality

https://github.com/Microsoft/vscode/blob/02423d3f15f9f26b22d5784406d8c5fb283b95a3/src/vs/workbench/contrib/search/browser/openAnythingHandler.ts#L35

supports any of these test cases:

asd.cs:231
asd.cs:123:231
asd.cs:123,231
asd.cs:123#231
asd.cs(231:231)
asd.cs:(123#231)
asd.cs:123#231

I was able to add in line pretty simply, so I did it and opened a PR

#70727

@roblourens
Copy link
Member

Thanks for the PR! On one hand I don't want to add a ton of patterns that are sort of specific to one library or runtime but I think this makes sense and apparently we already handle this pattern in the terminal too. @Tyriar can you show me where the link detection for the terminal is because I think it would make sense to sync the cases that it supports with quickopen.

@roblourens roblourens added feature-request Request for new features or functionality search Search widget and operation issues labels Mar 20, 2019
@bpasero bpasero removed their assignment Mar 21, 2019
@Tyriar
Copy link
Member

Tyriar commented Mar 23, 2019

@roblourens I'd recommend against copying all the patterns the terminal supports as it's super complicated, I want remove regexes from the system and it supports formats which should only work in the terminal imo such as "(file path)", line 45

https://github.com/Microsoft/vscode/blob/d25ea61e0cdfef641b31deca1858af997ed8d5d4/src/vs/workbench/contrib/terminal/browser/terminalLinkHandler.ts#L36-L44

@roblourens
Copy link
Member

Ok. Thinking about it some more, I don't really think we should have that kind of fuzziness in quick open. We will start adding more patterns it will end up very complicated.

However, an extension could show an input and handle whatever patterns they want!

@roblourens roblourens added the *extension-candidate Issue identified as good extension implementation label Mar 23, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators May 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*extension-candidate Issue identified as good extension implementation feature-request Request for new features or functionality search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests

4 participants