-
-
Notifications
You must be signed in to change notification settings - Fork 84
Support markdown scope for targeting code blocks #1992
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
Wouldn't |
It doesn't work for me no. |
Bringing over some comments from Slack:
|
In light of #1980, it might make sense to call code blocks "notebook cells". That'd be consistent with various literate programming formats. |
Ya I think that makes sense. |
huh that's an interesting idea. I guess one problem thing to think about is what happens if there a markdown cell in a notebook, that itself contains a code block. Arguably that could just be a nested scope, but might be surprising? Idk, generally speaking I'm in favour of fewer scopes so I think it's fine, just can't help but point out corner cases 😅 |
Has there been discussion of something like 'outside' or 'parent' modifier similar to 'inside' where you target the parent scope? I've never used jupyter so not sure, but say you were in a cell containing markdown containing a code block but the block was big enough you couldn't see any part of the parent jupyter cell but then wanted to target it, I believe atm you couldn't? I wonder if something like that would make this type of problem you mention slightly more natural to deal with. This type of modifier could help in other similar situations I suppose like if you are in a big python closure and have no hats from the containing function, but want to reference it? Similar how you can jump to a class from its method. That also raises the question in relation to your counter example: if you are in a nested language that triggers a new treesitter parser, does that show up cleanly in the node tree in a way that we could query? And even if it did, I'm not sure if/how cursorless deals with nested languages atm. |
I believe Cursorless currently doesn't support nested languages. Definitely a feature everyone wants, and potentially doable after everything is moved to tree-sitter queries… |
Almost certainly doable, and technically doesn't need to wait for everything to be moved to tree-sitter queries. But it will definitely be a big effort. Follow #409 to track the effort
That's tracked in #124 |
This is me breaking out some functionality that was part of PR #1911 since that PR has lots of work to be done and it may still benefit other languages that get in sooner. I've applied the suggested changes from pokey in that PR's code review. I've also added a placeholder map for lua which uses `[[ ]]` for multiline support as noted in PR #1962, however I realized as I went to add it that it's not as simple as the way I did it for nix because I can't just reuse the existing `singleQuote` entry since lua actually uses single quotes. So this may actually be a bit harder, and reminds me of [this discussion](#1992 (comment)). So before I go randomly hacking stuff I'm curious what you think the best approach here is. These are the comments I had left in the Nix PR about these changes: * I called returning delimiterToText as getSimpleDelimiterMap to kind of mirror complexDelimiterMap. * I'm not sure is if you still want a delimiterMap.ts standalone file, and then a getSimpleDelimiterMap.ts only for that function. Now delimiterToText isn't referenced anywhere else, so seemed maybe okay to keep them together. * I also thought about adding getComplexDelimiterMap(), but atm because complexDelimiterMap only ever uses the keys from the delimiterToText it won't change even if the language has different values, so seemed unnecessary. These are all things I could guess at your preferences, but may as well ask instead. * I also noticed leftToRightMap in that file isn't actually used anywhere so can be deleted I think, but also not sure about doing that as part of a totally unrelated code change, to keep commits clean. ## Checklist - [x] 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) - [x] I have not broken the cheatsheet --------- Co-authored-by: fidgetingbits <[email protected]> Co-authored-by: Pokey Rule <[email protected]>
- Fixes #1992 ## Checklist - [x] 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
It would be useful to have a scope to target markdown blocks of code inside ``` pairs. I regularly find myself wanting to chuck them, change inside them, or move out of them, and it's often in a scenario where there's no visible ` characters to use instance with.
The text was updated successfully, but these errors were encountered: