Skip to content

Switch case completion filtering doesn’t work inside string literal quotes #52614

@andrewbranch

Description

@andrewbranch

Bug Report

🔎 Search Terms

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about 13th century Scandinavian architecture

⏯ Playground Link

Playground link with relevant code

💻 Code

type Fruit = "apple" | "banana" | "dragonfruit" | "potato";

declare let fruit: Fruit;
function f() {
    switch (fruit) {
        case "apple": return;
        case "banana": return;
        case ""
    }
}

🙁 Actual behavior

If you trigger the completions on the last case without typing the quotes yet, "apple" and "banana" are filtered out.

image

But inside the quotes, all the string literals are suggested.

image

🙂 Expected behavior

Switch case filtering works inside or outside the quotes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: LS: Completion ListsThe issue relates to showing completion lists in an editorHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions