Skip to content

Variable comment discarded when type annotated #970

@ypnos

Description

@ypnos

When I combine emmylua type annotation with a comment next to a variable, same way as is done with @param, the comment is suppressed.

local foo = 42 -- this works
local bar = 23 ---@type integer @ this does not work (!)

---@param bar integer @ this works
local function foo(bar) end

Expected behavior

The annotation of a variable works the same as a param annotation: Comment and type can be combined in a single line

Screenshots

Failure case:
image

Working cases:
image
image
image

Environment:

  • Plugin v2.6.6
  • VSCode v1.64.2
  • WSL/Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeat/LuaCats AnnotationsRelated to Lua Language Server Annotations (LuaCats)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions