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

Use related error spans for "implement abstract class" errors #32848

Closed
mjbvz opened this issue Aug 13, 2019 · 5 comments · Fixed by #42546 or #48030
Closed

Use related error spans for "implement abstract class" errors #32848

mjbvz opened this issue Aug 13, 2019 · 5 comments · Fixed by #42546 or #48030
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Domain: Quick Fixes Editor-provided fixes, often called code actions. Experience Enhancement Noncontroversial enhancements Good First Issue Well scoped, documented and has the green light
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Aug 13, 2019

From microsoft/vscode#78048

TypeScript Version: 3.6.0-dev.20190810

Search Terms:

  • abstract class
  • related error spans
  • diagnostics

Problem
For the TypeScript:

abstract class A {
	abstract b(): void;
	abstract c(): void;
}

class B extends A { }

The typescript server currently generates two errors on B, one for b not being implemented and one for c not being implemented.

Having two errors causes VS Code to show a fix all... quick fix even though the single implement abstract class quick fix will resolve both errors. See microsoft/vscode#78048

Proposal
Instead of generating two errors in this case, generate a single, generic diagnostic that states something like: B does not implement all abstract members of A and on that diagnostic return related spans that state specifically which members are not implemented (b and c).

Related Issues:

/cc @DanielRosenwasser

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Aug 14, 2019
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 14, 2019
@RyanCavanaugh RyanCavanaugh added the Domain: Quick Fixes Editor-provided fixes, often called code actions. label Aug 14, 2019
@DanielRosenwasser DanielRosenwasser added Domain: Error Messages The issue relates to error messaging Experience Enhancement Noncontroversial enhancements Good First Issue Well scoped, documented and has the green light labels Nov 3, 2019
@crc442
Copy link

crc442 commented Nov 11, 2019

@DanielRosenwasser can I take a crack at it?

@DanielRosenwasser
Copy link
Member

Go for it! Start at the checker to consolidate the error messages, and then work within src/services/codefixes.

@karthikkp
Copy link
Contributor

@crc442 Still working on this?

@FlyingPumba
Copy link
Contributor

Hi everyone, I just submitted a PR for this issue.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 25, 2022

Thanks @FlyingPumba!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Domain: Quick Fixes Editor-provided fixes, often called code actions. Experience Enhancement Noncontroversial enhancements Good First Issue Well scoped, documented and has the green light
Projects
None yet
7 participants