-
-
Notifications
You must be signed in to change notification settings - Fork 395
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
selectParentSyntax does not select whole file #1436
Comments
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 EDIT: oh, wait, |
FIX: Fix an issue causing `selectParentSyntax` to not select syntax that is a direct child of the top node. Closes codemirror/dev#1436
FIX: Make `selectParentSyntax` return false when it doesn't change the selection. Issue codemirror/dev#1436
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
The text was updated successfully, but these errors were encountered: