I don't have enough insights to say anything about this.
Open Questions
\/
Detailed Design
Inside the code action, I would assume I can get the cursor position and then try to find the current AST node. If that node is this empty quotes of a property assignment, the code action should kick in. Or that is how I naively would approach the problem.
Does this make sense? If so, how would I get the AST nodes?
Help make it happen!
[ ] I am willing to submit a PR to implement this change.
[X] I am willing to submit a PR to implement this change, but would need some guidance.
[ ] I am not willing to submit a PR to implement this change.
Background & Motivation
When typing code in the JSX-like syntax, I often need to wrap a property assignment in
{
}
. Where autocomplete inserts"
"
after pressing=
.It would be great if we had a code action to change the empty quotes to empty curly braces.
Proposed Solution
Possible solutions
As was mentioned on Discord, this could be a code action in
provideCodeActions
in https://github.com/withastro/language-tools/blob/main/packages/language-server/src/plugins/astro.ts.Alternatives considered
\/
Risks, downsides, and/or tradeoffs
I don't have enough insights to say anything about this.
Open Questions
\/
Detailed Design
Inside the code action, I would assume I can get the cursor position and then try to find the current AST node. If that node is this empty quotes of a property assignment, the code action should kick in. Or that is how I naively would approach the problem.
Does this make sense? If so, how would I get the AST nodes?
Help make it happen!