Skip to content

Class member snippet completions always have semicolon #46833

@gabritto

Description

@gabritto

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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Completion ListsThe issue relates to showing completion lists in an editor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions