Skip to content

Class member snippet completions always have semicolon聽#46833

Closed

Description

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: LS: 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