LuaLS / LuaLS/lua-language-server

@alias comments aren't visible

Open
#1,627 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

Description

### 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, Hover

### Expected Behaviour

a comment to an alias type should be shown as regular comment to a parameter would be shown (at least if there is no comment to the @param annotation itself). The hover message should read:

```
function f(arg: string)
@param arg — comment from alias

Unused functions.Lua Diagnostics.(unused-function)
Unused local `f`.Lua Diagnostics.(unused-local)
```

### Actual Behaviour

the comment to the alias type isn't shown. the hover message is:

```
function f(arg: string)
Unused functions.Lua Diagnostics.(unused-function)
Unused local `f`.Lua Diagnostics.(unused-local)
```

### Reproduction steps

1. cat << EOF > file.lua
---@alias t_arg string comment from alias
---@param arg t_arg
local function f(arg)
end
EOF
2. code file.lua
3. hover over the function name and read message

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in file.lua using the shown @alias and @param annotations, then inspect the hover entry point for function documentation. Done means hovering over f includes the alias comment as @param arg while retaining the existing diagnostics and respecting any explicit @param comment.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.