You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support markdown scope for targeting code blocks #1992
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.
I do a lot of work in a templating language with no cursorless support. There are lots of paired {{ and }}. I wonder whether more general text-based support for multiple paired delimiters would be helpful. That’d also handle Python’s “”” … “””.
ya I suppose I should try a regex scope in the meantime. haven't used one before so an excuse to dabble I guess.
some general text-based support seems like it coild be good. more examples: nix language uses double ticks ''foo'' for multi-line strings, lua uses [[foo]].
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.
if you are in a nested language that triggers a new treesitter parser
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…
if you are in a nested language that triggers a new treesitter parser
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
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.
same here
I would like it to select the whole code snippet starting from the three backticks starting at row 3306 up to the last three backticks ending at row 3309
Activity
auscompgeek commentedon Nov 3, 2023
Wouldn't
change inside skiswork in this scenario?fidgetingbits commentedon Nov 3, 2023
It doesn't work for me no.
josharian commentedon Nov 3, 2023
Bringing over some comments from Slack:
auscompgeek commentedon Nov 6, 2023
In light of #1980, it might make sense to call code blocks "notebook cells". That'd be consistent with various literate programming formats.
fidgetingbits commentedon Nov 7, 2023
Ya I think that makes sense.
pokey commentedon Nov 7, 2023
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 😅
fidgetingbits commentedon Nov 8, 2023
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.
auscompgeek commentedon Nov 8, 2023
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…
pokey commentedon Nov 8, 2023
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
saidelike commentedon Jun 12, 2024
same here

I would like it to select the whole code snippet starting from the three backticks starting at row 3306 up to the last three backticks ending at row 3309
Add language overrides for delimiter maps (#2012)
Support markdown code blocks as `"cell"` (#2410)