-
Notifications
You must be signed in to change notification settings - Fork 100
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
Feat: RegEx in keywords #152
base: master
Are you sure you want to change the base?
Conversation
+ Added keyword option: useRegex. Updated init to use the new setting. * Rearranged functionality in updateDecorations to allow for multiple matches for a single decoration type
* Ditched the double for loop in favor of regex groups (the code can still be cleaned up further, though) * Added some supporting functionality for handling regex groups and making sure we only get one group per keyword * Renamed settings variable :-) * Removed unused parameter from one of the util functions
* Merged some code that did basically the same thing * Rearranged the setting so it now is an object named "regex" which the pattern to use as its child. Makes the logic of the code easier to handle, imho :)
+ Added tests for util functions: - excapeRegExp - escapeRegExpGroups * Modified test launch settings to not include any other extensions.
* Updated readme with example of the regex setting * Improved the legacy version of escapeRegExpGroups and gave it its own exported function
Ooh that would be super helpful 👏 Use case |
Would love the feature! Please merge and release! |
Since this repo(wayou/vscode-todo-highlight) has not been updated since 2018, im not gonna wait for him to merge this amazing feature, il just swap to your version instead ;) |
@WybeBosch what version are you switching to? |
Someone created a Fix so you could use regex, and they put in a Pull request with the Original Author. But the original author has not updated the extension since 2018, so its safe to say he will never implement the Fix made by this other user. However, you can just Download the extension with the Fix by the other user, by grabbing the contents of this repo while being inside this Pull request. Go to this link, and it should download a zip file. Replace the original extension files with the contents of this zip file and voila! |
@WybeBosch cool thanks for instructions 🙏 |
@vonEdfa many thanks for your improvements. I got them working for me, as @WybeBosch directed, but very few are going to find this. So I thought I'd try and learn how to do a full release, building on your work -- unless you've already done that? The original documentation has confused me about the JSON settings in places, but I'm not fluent in JavaScript, and so can't tell from the source what the documentation should say. As you understand the code, could you please advise me?
"todohighlight.keywords": [
"DEBUG:",
"REVIEW:",
{
"text": "NOTE",
"color": "white", are the settings for Thanks in advance. |
so @jgclark should clear issues in this repo? 💯 |
I would if I could @jeffery9. But I have no rights in this repo, and it seems the maintainer has abandoned it. However, the good news is that I've now forked this extension into a new repo at https://github.com/jgclark/vscode-todo-highlight, and made available on the Marketplace. It includes better documentation, more examples, update for remote development, addition of regex per highlight etc. |
Hey @jgclark sorry I've been slow replying! My memory is definitely not up to snuff with this repo anymore (but javascipt is my main language) but it sounds like you got it working without my input? |
@vonEdfa nice to hear from you. I hope the new release of extension works well for you. I'm sure there might be some improvements you can continue to make, as you seem to know JS well, and I don't. |
Added the functionality to use a proper RegEx pattern for each keyword instead of simply relying on the text field.
In detail:
Additional changes: