LuaLS / LuaLS/lua-language-server

Support enums within tables

Open
#1,412 1 comment 0 reactions 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

This may have to be a follow-up of https://github.com/sumneko/lua-language-server/issues/1411 but I have created this as a separate issue for separate feedback & tracking purposes

It would be nice if we could have enum function argument suggestions based on where the enumerator is defined. Currently, if you have an enum nested within some tables, it will only suggest the enum values as such:

image

This is fine if using the values defined directly is not an issue. However, if the enum values are runtime values (as mentioned in issue https://github.com/sumneko/lua-language-server/issues/1411) then we'd like to have some sort of initial auto-complete as such:

image

I am not sure how expensive computationally it may be to do this, if that is an issue then perhaps there exists a cheap workaround that could be used for documenting purposes.

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

Read issue #1411 alongside this issue to understand the runtime-value limitation and the requested follow-up context. Use the nested-table enum examples and screenshots as the behavioral reference. Done means function-argument completion can suggest enum values based on where the enumerator is defined, including enums nested within tables.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.