Skip to content
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

refactor(language-service): create attr for missing attr, bound tmpl #34743

Closed
wants to merge 1 commit into from

Conversation

@ayazhafiz
Copy link
Member

ayazhafiz commented Jan 11, 2020

Currently the language service constructs an AttrAst anytime it is
missing from a TemplateAst path. However, this should only be done
when the path does not contain an "attribute-like" AST, which can
includes bound properties or bound events.

This commit also refactors visitAttr to parse bindings only for
microsyntax expressions and does some other minor cleanup to make
linters happy.

This is some cleanup to help the language service eventually use
BoundDirectivePropertyAsts for providing completions for template
bindings rather than performing the manual parsing currently done.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Refactoring (no functional changes, no api changes)

Does this PR introduce a breaking change?

  • Yes
  • No
@ayazhafiz ayazhafiz requested a review from kyliau Jan 11, 2020
@ayazhafiz ayazhafiz requested a review from angular/tools-language-service as a code owner Jan 11, 2020
@ngbot ngbot bot modified the milestone: needsTriage Jan 11, 2020
@googlebot googlebot added the cla: yes label Jan 11, 2020
Currently the language service constructs an `AttrAst` anytime it is
missing from a `TemplateAst` path. However, this should only be done
when the path does not contain an "attribute-like" AST, which can
includes bound properties or bound events.

This commit also refactors `visitAttr` to parse bindings only for
microsyntax expressions and does some other minor cleanup to make
linters happy.

This is some cleanup to help the language service eventually use
`BoundDirectivePropertyAst`s for providing completions for template
bindings rather than performing the manual parsing currently done.
@ayazhafiz ayazhafiz force-pushed the ayazhafiz:r/simplify-attr-comp branch from 0f34e71 to 8afbf03 Jan 11, 2020
if (ast.name.startsWith('*')) {
// This a template binding given by micro syntax expression.

This comment has been minimized.

Copy link
@kyliau

kyliau Jan 13, 2020

Member

Eventually this should be migrated to the proper visitor. I'm actually working on this, will submit a follow up PR soon.

This comment has been minimized.

Copy link
@ayazhafiz

ayazhafiz Jan 13, 2020

Author Member

Awesome! I was planning to do that after this PR, glad to hear you are on it :)

@kyliau
kyliau approved these changes Jan 13, 2020
atscott added a commit that referenced this pull request Jan 13, 2020
…34743)

Currently the language service constructs an `AttrAst` anytime it is
missing from a `TemplateAst` path. However, this should only be done
when the path does not contain an "attribute-like" AST, which can
includes bound properties or bound events.

This commit also refactors `visitAttr` to parse bindings only for
microsyntax expressions and does some other minor cleanup to make
linters happy.

This is some cleanup to help the language service eventually use
`BoundDirectivePropertyAst`s for providing completions for template
bindings rather than performing the manual parsing currently done.

PR Close #34743
@atscott atscott closed this in 15b4173 Jan 13, 2020
@ayazhafiz ayazhafiz deleted the ayazhafiz:r/simplify-attr-comp branch Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.