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

fix(language-service): suggest, not error, on missing context members #35036

Closed
wants to merge 2 commits into from

Conversation

ayazhafiz
Copy link
Member

@ayazhafiz ayazhafiz commented Jan 29, 2020

The language service reports an error when a directive's template
context is missing a member that is being used in a template (e.g. if
$implicit is being used with a template context typed as any).
While this diagnostic message is valuable, typing template contexts
loosely as any or object is very widespread in community packages,
and often still compiles correctly, so reporting the diagnostic as an
error may be misleading to users.

This commit changes the diagnostic to be a warning, and adds additional
information about how the user can eliminate the warning entirely -- by
refining the template context type.

A screenshot demonstrating the change with VSCode's LSP is attached to
the PR for this commit.

Screen Shot 2020-01-29 at 10 17 15 AM

Closes angular/vscode-ng-language-service#572

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature

Does this PR introduce a breaking change?

  • Yes
  • No

@ayazhafiz ayazhafiz added type: bug/fix feature Issue that requests a new feature area: language-service Issues related to Angular's VS Code language service target: patch This PR is targeted for the next patch release labels Jan 29, 2020
@ayazhafiz ayazhafiz requested a review from kyliau January 29, 2020 18:24
@ngbot ngbot bot modified the milestone: needsTriage Jan 29, 2020
The language service reports an error when a directive's template
context is missing a member that is being used in a template (e.g. if
`$implicit` is being used with a template context typed as `any`).
While this diagnostic message is valuable, typing template contexts
loosely as `any` or `object` is very widespread in community packages,
and often still compiles correctly, so reporting the diagnostic as an
error may be misleading to users.

This commit changes the diagnostic to be a warning, and adds additional
information about how the user can eliminate the warning entirely -- by
refining the template context type.

Closes angular/vscode-ng-language-service#572
@ayazhafiz
Copy link
Member Author

@kyliau updated screen:

Screen Shot 2020-01-29 at 11 23 21 AM

@ayazhafiz ayazhafiz requested a review from kyliau January 29, 2020 19:24
@ayazhafiz ayazhafiz changed the title fix(language-service): warn, not error, on missing context members fix(language-service): suggest, not error, on missing context members Jan 29, 2020
@kyliau kyliau added the action: merge The PR is ready for merge by the caretaker label Jan 29, 2020
AndrewKushnir pushed a commit that referenced this pull request Jan 29, 2020
…35036)

The language service reports an error when a directive's template
context is missing a member that is being used in a template (e.g. if
`$implicit` is being used with a template context typed as `any`).
While this diagnostic message is valuable, typing template contexts
loosely as `any` or `object` is very widespread in community packages,
and often still compiles correctly, so reporting the diagnostic as an
error may be misleading to users.

This commit changes the diagnostic to be a warning, and adds additional
information about how the user can eliminate the warning entirely -- by
refining the template context type.

Closes angular/vscode-ng-language-service#572

PR Close #35036
sonukapoor pushed a commit to sonukapoor/angular that referenced this pull request Feb 13, 2020
…ngular#35036)

The language service reports an error when a directive's template
context is missing a member that is being used in a template (e.g. if
`$implicit` is being used with a template context typed as `any`).
While this diagnostic message is valuable, typing template contexts
loosely as `any` or `object` is very widespread in community packages,
and often still compiles correctly, so reporting the diagnostic as an
error may be misleading to users.

This commit changes the diagnostic to be a warning, and adds additional
information about how the user can eliminate the warning entirely -- by
refining the template context type.

Closes angular/vscode-ng-language-service#572

PR Close angular#35036
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: language-service Issues related to Angular's VS Code language service cla: yes feature Issue that requests a new feature target: patch This PR is targeted for the next patch release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The template context does not define a member called 'item'
3 participants