cursorless
cursorless copied to clipboard
Fix strings in bash
In bash, we don't properly support strings. For example:
commit_message="$(git log -1 --pretty=format:"%s" HEAD)"
This is actually two nested strings: "$(git log -1 --pretty=format:"%s" HEAD)" and "%s". Instead we treat it as two strings in sequence: "$(git log -1 --pretty=format:" and " HEAD)". We should figure out how to make this work, probably using the parse tree, and/or some flavour of https://github.com/cursorless-dev/cursorless/issues/1812#issuecomment-1691493746
@AndreasArvidsson fyi this doesn't work either on today's main or on https://github.com/cursorless-dev/cursorless/pull/2457
This is one of those things we probably need to use the parse tree
(program
(variable_assignment
name: (variable_name)
"="
value: (string
"""
(command_substitution
"$("
(command
name: (command_name
(word)
)
argument: (word)
argument: (number)
argument: (concatenation
(word)
(string
"""
(string_content)
"""
)
)
argument: (word)
)
")"
)
"""
)
)
)
I think we could just use parse tree to tell us if it's opening or closing?
Text fragment thing will get in the way a bit tho I fear as well treat the string as a fragment