-
-
Notifications
You must be signed in to change notification settings - Fork 84
"take round" also takes leading $ #1812
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
Comments
That is intentional. We consider the |
Defined here cursorless/packages/cursorless-engine/src/processTargets/modifiers/surroundingPair/delimiterMaps.ts Line 23 in 3242176
To be honest I've never been one hundred percent sure about that decision. |
The idea is to include the full delimiter token, similar to the way we handle f-strings and triple quotes in Python. But if @AndreasArvidsson @josharian and @jmegner all want to push for this one I'll cave |
....I now better appreciate the benefits of including the dollar sign, but I fear it's just going to cause more surprise and mistakes than benefit. Let me play with it more now that I know it is deliberate. |
After discussion with @pokey we came to the following conclusion
|
The fallback logic for determining whether to use text-based surrounding pairs or parse-tree-based was broken for text fragment extractors based on next-gen scope handlers (ie using the new `@textFragment` tag in a query file). This breakage meant that in a string like `"""hello"""` in Python, the surrounding pair finder fell back to text-based, which resulted in it thinking `"hello"` was a string, rather than `"""hello"""`, as would happen if it fell back to parse-tree-based This PR fixes the issue by unifying the fallback logic between legacy and next-gen text fragment extractors, so that they don't fall out of sync again See also #1812 (comment); arguably that will make this PR irrelevant, but until then, it's better to have string not be broken when we migrate a language to use `@textFragment` Note that the tests in this PR don't actually test the code yet, because Python is still using legacy text fragment extractors. The tests will start biting when this PR is merged into main and then merged into #1862 - This PR is required by #1862 ## Checklist - [ ] I have added [tests](https://www.cursorless.org/docs/contributing/test-case-recorder/) - [ ] I have updated the [docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and [cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet) - [ ] I have not broken the cheatsheet --------- Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
Note that one drawback of this approach is that if you have something like
Saying However, we have the same problem with |
Yes if you just want to match on the |
I don't think that lines up with what you propose in your bullet points above. See where it says "the string scope type should be implemented per language ... with a fall back to matching pairs" |
I see no contradicition in that? The string scope is defined per language and a string in a programming language is (mostly) well defined. Matching quotes inside a string you would have to use matching pairs for. |
I think the problem I propose in #1812 (comment) can be solved by a oneOf matcher combining matching pairs and syntactic string. Then it would just be nested as we'd like. We can do this once matching pairs are migrated to next-gen |
"take round air" on
$($a)
selects$($a)
, but it should select($a)
.The text was updated successfully, but these errors were encountered: