Add nodes that mark the content of string literals #155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds additional nodes within string literals and command literals that marks the actual contents of the string itself. This is useful for writing queries that need to do something just with the contents, rather than the entire literal including the quotes, e.g. language injections in Neovim.
Previously you would have to do some
#offset!
calls within the queries that perform the language injections. Now you can just match against thestring_content
andraw_string_content
nodes directly and avoid having to compute offsets manually.Some TODOs:
string_content
andraw_string_content
. I couldn't come up with a nice way to unify the node types. Open to suggestions there.tree-sitter generate
to this PR, or is that done separately before a tag is done?