LuaLS / LuaLS/lua-language-server

Alias comments only show for strings and numbers

Open
#2,284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

(Split from: https://github.com/LuaLS/lua-language-server/issues/2279)

Aliases have a feature where they can be multiline and you can write comments for different available values. However, this only works for string and numbers. For example in this code:

---@class TestClass

---@enum TestEnum
TestEnum = {
	TEST1 = 1,
	TEST2 = 2,
	TEST3 = 3,
}

---@alias TestAlias
---| 'TEST1' # TEST1 comment
---| 'TEST2' # TEST2 comment
---| 'TEST3' # TEST3 comment
---| TestClass # TestClass comment
---| TestEnum # TestEnum comment
---| TestEnum.TEST1 # TestEnum.TEST1 comment
---| 1 # TestNumber Comment

---@param test TestAlias
local function test(test)
end

test()

I get this
Screenshot_1

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 report in LuaLS with the alias example from the issue, then trace how alias comments are collected and displayed for string and numeric values. Check the same behavior for TestClass, TestEnum, and TestEnum.TEST1; done means comments appear for those alias values as they do for strings and numbers.

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.