Skip to content

Bug: Insert Missing Cases For Type Union #6549

@nguyenyou

Description

@nguyenyou

Describe the bug

I used pattern matching for a string literal type union and encountered a very interesting bug, the generated code by VSCode after I hit "insert missing cases" is:

type Color = "primary" | "secondary" | "danger" | "warning"

def getColor(color: Color) = color match
  case "primary" => "bg-red-200"
  case [32m"secondary"[0m => ???
  case [32m"danger"[0m => ???
  case [32m"warning"[0m => ???
Screen_Recording_2024-06-27_at_17.16.54.mov

cc @kasiaMarek

Expected behavior

No weird characters are generated along with the actually singleton string.

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

1.3.2+15-8bebd63c-SNAPSHOT

Extra context or search terms

No response

Metadata

Metadata

Assignees

Labels

Scala 3Generic ticket relating to Scala 3bugSomething that is making a piece of functionality unusablecode actionRelated to LSP code actionsfixed-upstreamTag a ticket with this when a fix upstream has been completed and we can now address the ticket

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions