Skip to content

Object literal indexing shows errors #2802

@brunnerh

Description

@brunnerh

Describe the bug

Happens when e.g. resolving a label inline from a variable inside the template.
The code runs as expected but the VS Code extension does not seem to like it.

Reproduction

<div>
	{{
		0: 'Nomination phase',
		1: 'Voting phase',
		2: 'Finished',
	}[1]}
</div>

<!-- My exact use case looks like this: -->
<div>
	{{
		[ContestPhases.Nomination]: 'Nomination phase',
		[ContestPhases.Voting]: 'Voting phase',
		[ContestPhases.Completed]: 'Completed',
	}[contest.phase]}
</div>

Workaround: Extract object to <script>.

Expected behaviour

No errors.

System Info

  • OS: Windows 10, 64 bit
  • IDE: VSCode (Extension version: 109.10.0)

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions