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

Add a #replace! predicate that can update a node #2857

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tgross35
Copy link

@tgross35 tgross35 commented Jan 8, 2024

This PR is an attempt to add a #replace! @capture "regexp(.*)" "rep$1" predicate that can be used to filter content. This is useful for things like extracting injection languages from shebangs or heredocs, and will provide an official equivalent of the #gsub!` function supported by NeoVim.

However, I am not sure what the best way to do this is. It seems like this more or less requires instrumenting a Node in some way that utf8_text / utf_16 text know to return data from a buffer rather than the input. I am going to try adding something to Node to allow this, but would like to know if there are other suggestions.

@dundargoc dundargoc changed the title [WIP] Add a #replace! predicate that can update a node Add a #replace! predicate that can update a node Feb 8, 2024
@tgross35
Copy link
Author

tgross35 commented Mar 9, 2024

I probably should look at how #set! works as reference

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.

None yet

1 participant