Skip to content

feat(language-service): modularize error messages #35678

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

Closed
wants to merge 4 commits into from

Conversation

ayazhafiz
Copy link
Contributor

This commit performs a modularization of the Language Service's existing
diagnostic messages. Such a modularization has two primary advantages:

  • Centralization and decoupling of error messages from the code that
    generates them makes it easy to add/delete/edit diagnostic messages,
    and allows for independent iteration of diagnostic messages and
    diagnostic generation.
  • Prepares for additional features like annotating the locations where a
    diagnostic is generated and enabling the configuration of which
    diagnostics should be reported by the language service.

Although it would be preferable to place the diagnostics registry in an
independent JSON file, for ease of typing diagnostic types as an enum
variant of 'ts.DiagnosticCategory', the registry is stored as an object.

Part of #32663.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Feature
  • Refactoring (no functional changes, no api changes)

Does this PR introduce a breaking change?

  • Yes
  • No

@ayazhafiz ayazhafiz added feature Issue that requests a new feature refactoring Issue that involves refactoring or code-cleanup area: language-service Issues related to Angular's VS Code language service target: major This PR is targeted for the next major release labels Feb 26, 2020
@ayazhafiz ayazhafiz requested a review from kyliau February 26, 2020 05:51
@ngbot ngbot bot modified the milestone: needsTriage Feb 26, 2020
@pullapprove pullapprove bot requested a review from josephperrott February 26, 2020 05:51
@ayazhafiz
Copy link
Contributor Author

Going through this I realized that a lot of the diagnostic messages are not actually ever tested for their generation. I will add tests for all of them in a future commit.

@ayazhafiz ayazhafiz force-pushed the e/error-modularization branch from 25f6a0f to 012f533 Compare February 26, 2020 05:52
Copy link
Contributor

@kyliau kyliau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments, otherwise LGTM.

@ayazhafiz ayazhafiz requested a review from kyliau February 27, 2020 07:54
@ayazhafiz ayazhafiz force-pushed the e/error-modularization branch from a38a147 to 821b7b8 Compare February 28, 2020 03:00
@kyliau kyliau added target: patch This PR is targeted for the next patch release action: merge The PR is ready for merge by the caretaker and removed target: major This PR is targeted for the next major release labels Feb 28, 2020
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@atscott
Copy link
Contributor

atscott commented Feb 28, 2020

Hi @ayazhafiz, would you mind rebasing with master to resolve the merge conflict?

This commit performs a modularization of the Language Service's existing
diagnostic messages. Such a modularization has two primary advantages:

- Centralization and decoupling of error messages from the code that
  generates them makes it easy to add/delete/edit diagnostic messages,
  and allows for independent iteration of diagnostic messages and
  diagnostic generation.
- Prepares for additional features like annotating the locations where a
  diagnostic is generated and enabling the configuration of which
  diagnostics should be reported by the language service.

Although it would be preferable to place the diagnostics registry in an
independent JSON file, for ease of typing diagnostic types as an enum
variant of 'ts.DiagnosticCategory', the registry is stored as an object.

Part of angular#32663.
@ayazhafiz ayazhafiz force-pushed the e/error-modularization branch from 821b7b8 to 4ab5707 Compare February 29, 2020 06:45
@atscott
Copy link
Contributor

atscott commented Mar 2, 2020

Hey @ayazhafiz, there's now a lint error for the commits. Can you take a look?

INVALID COMMIT MSG: fixup! test(language-service): differentiate feature and internal infra tests
=> ERROR: Unable to find match for fixup commit among prior commits:
feat(language-service): modularize error messages

@ayazhafiz ayazhafiz force-pushed the e/error-modularization branch from 5617498 to e834ddb Compare March 3, 2020 03:27
@ayazhafiz
Copy link
Contributor Author

Hey @ayazhafiz, there's now a lint error for the commits. Can you take a look?

Should be fixed :)

atscott pushed a commit that referenced this pull request Mar 3, 2020
This commit performs a modularization of the Language Service's existing
diagnostic messages. Such a modularization has two primary advantages:

- Centralization and decoupling of error messages from the code that
  generates them makes it easy to add/delete/edit diagnostic messages,
  and allows for independent iteration of diagnostic messages and
  diagnostic generation.
- Prepares for additional features like annotating the locations where a
  diagnostic is generated and enabling the configuration of which
  diagnostics should be reported by the language service.

Although it would be preferable to place the diagnostics registry in an
independent JSON file, for ease of typing diagnostic types as an enum
variant of 'ts.DiagnosticCategory', the registry is stored as an object.

Part of #32663.

PR Close #35678
@atscott atscott closed this in 47a1811 Mar 3, 2020
@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 Apr 3, 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 refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants