feat: hover over operators and override operators#536
Conversation
deribaucourt
left a comment
There was a problem hiding this comment.
Very useful for newcomers!
I love to see some vim screenshots as well 😄
Small comments on the tests.
| const ASSIGNMENT_OPERATORS = new Set(['=', '?=', '??=', ':=', '+=', '=+', '.=', '=.']) | ||
| const OVERRIDE_OPERATORS = new Set(['append', 'prepend', 'remove']) | ||
| if (bitbakeNode !== null) { | ||
| const isAssignmentOperator = ASSIGNMENT_OPERATORS.has(bitbakeNode.type) && bitbakeNode.parent?.type === 'variable_assignment' |
There was a problem hiding this comment.
You could do the type checks before the ASSIGNMENT_OPERATORS lookup, which will resolve mush faster in the general case.
There was a problem hiding this comment.
Sounds good, I switched the order, let me know if thats what you meant
| ) | ||
| }) | ||
|
|
||
| it('should show hover documentation for assignment operators', async () => { |
There was a problem hiding this comment.
It is very thorough to have all the operators tested, but will also be harder to maintain. For instance, if the paragraphs in the Yocto doc change.
Could you keep just essential examples for each hover case? No need to exhaust all operators.
There was a problem hiding this comment.
I left only the first of each plus the test for append when its not used as an operator
| MYVAR =+ "prepended" | ||
| MYVAR .= "appendednospace" | ||
| MYVAR =. "prependednospace" | ||
| MYVAR:append = " append" |
There was a problem hiding this comment.
I think it would be interesting to add a test case here checking that the " append" string part does not display the :append tooltip.
There was a problem hiding this comment.
Sounds great! I added a test for append when it is not an operator
Add hover documentation verbatim for all operators and override style operators '=', '?=', '??=', ':=', '+=', '=+', '.=', '=.', ':append', ':prepend', and ':remove'. Assisted-by: OpenCode:big-pickle
|
Thanks for taking the time to review it! Hopefully, it all looks good now! |
Add hover documentation verbatim for all operators and override style operators '=', '?=', '??=', ':=', '+=', '=+', '.=', '=.', ':append', ':prepend', and ':remove'.
I didn't see an AI policy for this repo so I just used the AI policy of the Linux kernel
Assisted-by: OpenCode:big-pickle