Closed jrvidal closed 2 months ago
This is intentional behavior. You have ctrl-a to select the entire file. Treating it as a syntactic unit doesn't really add anything meaningful.
That's fair, I suppose I can use the returned boolean as a hint to extend the selection manually myself.
However, I'll note that it doesn't just prevent the selection to cover the whole file. It also blocks top-level items from being selected e.g. in the chain ... -> Block -> FunctionDeclaration -> Script
, I'm stuck at Block
. And that's not something I can work around on my own as easily.
EDIT: oh, wait, selectParentSyntax()
always returns true
. Is that something that would make sense to change? Not sure if false
is supposed to mean "unable to run" or, instead, "no changes to be made".
Oh I see what you mean. That isn't intentional. Attached patches should improve it.
Thanks for the prompt response, those fixes will come in handy.
Describe the issue
It seems like
selectParentSyntax()
is unable to extend the selection all the way up to the syntax tree root (e.g. the wholeScript
in a JS file). I'm not sure this is intended, but I do find it surprising.For instance, in the demo editor in https://codemirror.net, if a click on
console
and hitCtrl+i
repeatedly, it gets stuck in the function block.Seems like the culprit is here, but I don't know what the
node.parent?.parent
check is supposed to prevent.Browser and platform
No response
Reproduction link
No response