Skip to content

Class member snippet completions always have semicolon #46833

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
gabritto opened this issue Nov 17, 2021 · 0 comments · Fixed by #46832
Closed

Class member snippet completions always have semicolon #46833

gabritto opened this issue Nov 17, 2021 · 0 comments · Fixed by #46832
Assignees
Labels
Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor

Comments

@gabritto
Copy link
Member

Bug Report

🔎 Search Terms

semicolon, class member snippets

🕗 Version & Regression Information

As of 4.5 when class member snippets for completions was enabled

💻 Code

Before completions:

interface Base {
    a: number
    b(a: string): string
    c(a: string): string
    c(a: number): number
}
class Sub implements Base {
    // Get completions here
}

After inserting every class member completion:

interface Base {
    a: number
    b(a: string): string
    c(a: string): string
    c(a: number): number
}
class Sub implements Base {
    a: number; // << semicolon
    b(a: string): string {
        
    }
    c(a: string): string; // << semicolon
    c(a: number): number; // << semicolon
    c(a: any): string | number {
        
    }
}

🙁 Actual behavior

When class member completions are offered for property declarations or method signatures (i.e. methods without bodies), they always have a trailing semicolon.

🙂 Expected behavior

No semicolons in the completion text if we determine there shouldn't be any, by means of either:

  • preferences says we should remove semicolons (e.g. SemicolonPreference in FormatCodeSettings is set to Remove), or
  • probablyUsesSemicolons() returns false
@gabritto gabritto self-assigned this Nov 17, 2021
@gabritto gabritto added Bug A bug in TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor labels Nov 17, 2021
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: Completion Lists The issue relates to showing completion lists in an editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant