Skip to content

literal strings 'async' is mis-parsed #3402

@Bilal2453

Description

@Bilal2453

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Linux

What is the issue affecting?

Annotations

Expected Behaviour

The following should work without errors:

---@class Unit
---@field mode "async" | "sync"

and:

---@type Unit
local test = {}

test.mode = (hint) --> "async" or "sync"

Actual Behaviour

The follow shows an error

---@class Unit
---@field mode "async" (error here: <type name> expected.) | "sync"

and:

---@type Unit
local test = {}

test.mode = (hint) --> "sync"

Reproduction steps

  1. Copy and paste the expected behavior codeblock.

Additional Notes

Only happens with async as far as I can see.

Image

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions