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

Jump to line+column in terminal links (format <path> l:c) #140780

Closed
strarsis opened this issue Jan 15, 2022 · 3 comments · Fixed by #153957
Closed

Jump to line+column in terminal links (format <path> l:c) #140780

strarsis opened this issue Jan 15, 2022 · 3 comments · Fixed by #153957
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders terminal-links verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@strarsis
Copy link

strarsis commented Jan 15, 2022

It is possible with VSCode to follow a path printed in the terminal.

When that path also contains the line and column number in the format <path> l:c (l ≙ line number; c ≙ column number),
VSCode currently doesn't interpret it completely and therefore doesn't also jump to the line/column in the opened file.

Example:

resources/styles/blocks/cover/rhombus.scss 49:46

This path format indicates the path to the file but also the line (49) and column (46) number.

Ctrl + clicking this path currently in VSCode will open the file but not jump to the line or the column.

As this format is used by many linters and compilers (e.g. SASS), it would be a very useful and time-saving feature.

@Tyriar Tyriar added feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities labels Jan 18, 2022
@Tyriar Tyriar added this to the Backlog milestone Jan 18, 2022
@Tyriar Tyriar self-assigned this Jan 18, 2022
@Tyriar
Copy link
Member

Tyriar commented Jan 18, 2022

Code link:

/** As xterm reads from DOM, space in that case is nonbreaking char ASCII code - 160,
replacing space with nonBreakningSpace or space ASCII code - 32. */
export const lineAndColumnClause = [
'((\\S*)[\'"], line ((\\d+)( column (\\d+))?))', // "(file path)", line 45 [see #40468]
'((\\S*)[\'"],((\\d+)(:(\\d+))?))', // "(file path)",45 [see #78205]
'((\\S*) on line ((\\d+)(, column (\\d+))?))', // (file path) on line 8, column 13
'((\\S*):line ((\\d+)(, column (\\d+))?))', // (file path):line 8, column 13
'(([^\\s\\(\\)]*)(\\s?[\\(\\[](\\d+)(,\\s?(\\d+))?)[\\)\\]])', // (file path)(45), (file path) (45), (file path)(45,18), (file path) (45,18), (file path)(45, 18), (file path) (45, 18), also with []
'(([^:\\s\\(\\)<>\'\"\\[\\]]*)(:(\\d+))?(:(\\d+))?)' // (file path):336, (file path):336:9
].join('|').replace(/ /g, `[${'\u00A0'} ]`);

I think here we'd want to require the exact (num)(colon)(num) to prevent problems with (link) (number) (text)

@meganrogge meganrogge removed their assignment Mar 28, 2022
@tjx666
Copy link
Contributor

tjx666 commented May 30, 2022

nice feature for many front end build tools.

@ssigwart
Copy link
Contributor

ssigwart commented Jul 2, 2022

I added PR #153957 for this.

@Tyriar Tyriar modified the milestones: Backlog, July 2022 Jul 5, 2022
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 6, 2022
@Tyriar Tyriar added the verification-needed Verification of issue is requested label Jul 21, 2022
@lramos15 lramos15 added the verified Verification succeeded label Jul 27, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities insiders-released Patch has been released in VS Code Insiders terminal-links verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants