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

Fix link autocompletion with tags #885

Merged
merged 2 commits into from
Dec 23, 2021
Merged

Fix link autocompletion with tags #885

merged 2 commits into from
Dec 23, 2021

Conversation

memeplex
Copy link
Contributor

@memeplex memeplex commented Dec 22, 2021

Fix #884

Alternative PR: #886

@memeplex
Copy link
Contributor Author

memeplex commented Dec 22, 2021

@riccardoferretti what do you think of simplifying the regular expressions a bit, like this:

export const WIKILINK_REGEX = /\[\[[^[\]]*$/;
export const SECTION_REGEX = /\[\[([^[\]]*#)[^[\]]*$/;

Instead of the negative lookahead I'm requesting a prefix that starts with [[ and extends to the cursor position without any [ or ] in between.

Moreover, an alternative fix could be to exclude the # case in the regex itself:

export const WIKILINK_REGEX = /\[\[[^[\]#]*$/;

I think I prefer this one.

Copy link
Collaborator

@riccardoferretti riccardoferretti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean. Can we add a test case for it?

@memeplex
Copy link
Contributor Author

Can we add a test case for it?

I've added some ones.

@riccardoferretti riccardoferretti merged commit cfb946a into foambubble:master Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete stops working when there's a # symbol in the same line
2 participants