ST-OpenUri icon indicating copy to clipboard operation
ST-OpenUri copied to clipboard

Match and complete partial URIs

Open alecmev opened this issue 1 year ago • 1 comments

Our code has ticket references in TODO comments which look like so:

// TODO: [ABC-123] Foo

I want to be able to match ABC-123, highlight it as if it were a URI, and direct people to https://example.com/ABC-123. One more optional case to consider is more specific matching with multiple sub-matches, e.g.:

// TODO: [hello, world] Foo

I want to match both hello and world based on the fact that they're surrounded by TODO: [ ... ]. The regular expression for that would look something like TODO:\s\[(\w+)(,\s\w+)*\]. Ideally, this plugin would treat each group as a separate URI.

There's an old plugin that attempts to handle this, RegExLink, but it's broken in several ways, and its ergonomics are much worse than of OpenUri. Is this in the scope of this plugin?

P.S. Thanks for making this!

alecmev avatar Jul 31 '23 22:07 alecmev