feat(language-service): completions support for template reference variables #34363
Conversation
Thank you for contributing! Your help is much appreciated :)
a28ec0e
to
d487b6c
|
@ivanwonder, you are correct. The TemplateAst parser does not parse attributes correctly. This is bad, because it means there's no 1-1 mapping from HtmlAst to TemplateAst. |
|
Thank you for your guidance. I will pick it up after you fix the problem. |
|
@kyliau I think I can help to resolve the problem of angular/packages/compiler/src/template_parser/template_parser.ts Lines 593 to 608 in 2dffe65 |
I think this was partially fixed in #34459, @kyliau can you confirm? I think you would have to do a little extra work to get
I think this would work, but we will have to get a review from the compiler team to make sure it is okay. My only worry is that this would break the typings of the ReferenceAst because the value of the created reference AST would be null (since there is no matching directive to reference), so this might cause some trouble if the reference is used later in the template (but if an error is reported, I don't know if this matters). |
|
yes, @ayazhafiz is right. I did the work in #34459 to partially address the problem of incomplete template AST. The ideal solution here is to visit AttrAst, create ReferenceAst, then visit it. |
|
@kyliau What are the other symbols, can you give me an example? When I input others, it will report the error no directive with "exportAs" |
|
I think it's better to add a new Just push the missing ReferenceAst to path if need, begin to visit it with ElementAst parameter in the new method. LikeIt's a little kind of weird to invoke the method visitReference in visitAttr, travel the path to get the right ElementAst and pass it to visitReference.
|
d487b6c
to
1d19b06
This is the new implementation, if need, I can change to the way as @kyliau said above. |
1d19b06
to
99bb678
99bb678
to
279d05c
Thanks for the feature
279d05c
to
03d552e
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
https://angular.io/guide/template-syntax#how-a-reference-variable-gets-its-value
get completions from option
exportAsofDirective.PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
The text was updated successfully, but these errors were encountered: