Skip to content

Alias doesn't handle # character in stringย #3016

@hraytilakhealthcare

Description

@hraytilakhealthcare

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Linux

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

Enum members can contain # character

Actual Behaviour

The LSP diagnostic reports an error on using it

Reproduction steps

  1. Create an enum alias with members containing #
    Given the following alias
---| "/vfx#impact_fx_creator"
---| "/sfx"
---| "/player#player_upgrader"
---| "/cauli"
---| "/game_over_ui"
---| "/in_game_ui"

  1. Notice that the type check considers the right-hand of # as a comment even though it's in the string
---@type component_url
local d =  "/vfx#impact_fx_creator"
  1. See error
Diagnostics:
1. Cannot assign `string` to parameter `"/cauli"|"/game_over_ui"|"/in_game_ui"|"/player#"|"/sfx"...(+1)`.
   - `string` cannot match `"/cauli"|"/game_over_ui"|"/in_game_ui"|"/player#"|"/sfx"...(+1)`

Additional Notes

No response

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