-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fennel forms query issues #83
Comments
Interesting. I wonder how this worked before.. Looking at the grammar it looks like the table elements are wrapped in a 'table_pair' node. See: (program ; [0, 0] - [3, 0]
(table ; [0, 0] - [2, 8]
item: (table_pair ; [0, 1] - [0, 7]
key: (string ; [0, 1] - [0, 5]
content: (string_content)) ; [0, 2] - [0, 5]
value: (number)) ; [0, 6] - [0, 7]
item: (table_pair ; [1, 1] - [1, 7]
key: (string ; [1, 1] - [1, 5]
content: (string_content)) ; [1, 2] - [1, 5]
value: (number)) ; [1, 6] - [1, 7]
item: (table_pair ; [2, 1] - [2, 7]
key: (string ; [2, 1] - [2, 5]
content: (string_content)) ; [2, 2] - [2, 5]
value: (number)))) ; [2, 6] - [2, 7] So if this worked on the previous paredit version it was purely by chance. I will need to think on how to solve this. I think this will almost certainly require introducing more capture groups. |
Ah, as per julienvincent/nvim-paredit-fennel#1 it looks like the fennel grammar changed earlier this year. So paredit pre-v1 would have been broken on the latest fennel grammar anyway. Did you per-chance also update your fennel grammar recently? |
Yeah, I have the latest edition of the fennel grammar. I tried to write my own custom nvim-paredit query according to the docs but wasn't able to get it. I wish the grammar was closer to how Clojure's grammar works. Ah well. |
Yea you wouldn't be able to with how paredit currently works. Paredit tries to find the root node relative to the closest form, starting from the node at the cursor.
In the above example the The paredit grammars are only used to identify the nodes considered forms and the rest is inferred. So we would need to extend paredit to allow capturing the distinct 'elements' of a form in a way that is independent of the structure of the grammar. This would mean supporting a query like:
And then perhaps falling back to the existing implementation if no |
It seems the fennel queries aren't quite correct, leading to odd behavior:
Given my cursor on the
:
of:bar
, if I pressW
, my cursor will move to:qux
, not2
. And if I pressB
, it'll move to:foo
, not1
.The text was updated successfully, but these errors were encountered: