Skip to content

Improve REPL link highlight regexp#15406

Merged
isidorn merged 1 commit intomicrosoft:masterfrom
felixfbecker:repl-links-fix
Nov 14, 2016
Merged

Improve REPL link highlight regexp#15406
isidorn merged 1 commit intomicrosoft:masterfrom
felixfbecker:repl-links-fix

Conversation

@felixfbecker
Copy link
Contributor

@felixfbecker felixfbecker commented Nov 12, 2016

Fixes the issues I discovered after #15174 was merged.

#15174 added the ability to match relative paths by making the "root" path component optional. Unfortunately, since paths can contain spaces, that meant there was no leading "terminator" for the path anymore, so all whitespace and "at" before a relative path matched too:

bug

This is resolved by requiring terminators at the start and end, which are line start/end, at , brackets or quotes.

The capture group that previously captured the "root" path component is not captured anymore (it was not used) and can now either be a unix root slash, a window drive letter component OR the beginning of a relative path, which cannot contain spaces.

Known issues:

Cannot match a relative path where the first component contains a space, like this:

     at what ever\test.js:20

Seems impossible to me without using look-around assertions.

Relative paths still cannot be opened, need to be resolved to absolute, don't know how.

https://regex101.com/r/xkAp3A/1

* Require terminators at start/end
* Don't allow spaces in first path component of relative path
* Don't capture root path component
@mention-bot
Copy link

@felixfbecker, thanks for your PR! By analyzing the history of the files in this pull request, we identified @egamma, @bpasero and @isidorn to be potential reviewers.

@isidorn isidorn added this to the November 2016 milestone Nov 14, 2016
@isidorn isidorn merged commit 7a2a0b9 into microsoft:master Nov 14, 2016
@isidorn
Copy link
Collaborator

isidorn commented Nov 14, 2016

Looks good, same as previous PR let's merge this in and we see how it behaves on insider.
Thanks 🍻

As for how to get the aboslute path I believe Ben replied to you here #15174

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants