-
Notifications
You must be signed in to change notification settings - Fork 97
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
ref #648 provide completion short hand and long hand notation with similar scope of legacy #668
Conversation
const regex = /\[id=(\w+)\]/g | ||
const matched = content.match(regex) | ||
if (matched) { | ||
return matched.map((result) => result.replace('[id=', '').replace(']', '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to use the (named) group? Since we are using (\w+)
we can use the group reference $1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems we need a more recent version of TypeScript https://javascript.info/regexp-groups#searching-for-all-matches-with-groups-matchall
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchAll
is available on Node 12. Are you sure it does not work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can safely update the target to es2020
.
I'm planning to make the switch: #506
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that we keep it in a separate Pull request. I'm not even sure how to change the target correctly neither what are the implications
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good 👍🏻
Thanks for your work! I found a few issues with the existing code so feel free to fix them in this pull request or we can create an issue and do a follow-up pull request. |
62bd83e
to
0fea3ca
Compare
longhand notation I.e. with [#myId] and [id=myId] part of asciidoctor#648 Signed-off-by: Aurélien Pupier <[email protected]>
0fea3ca
to
7ed4886
Compare
Provide completion after xref for ids defined with shorthand and
longhand notation
I.e. with [#myId] and [id=myId]
part of #648
based on #667