LuaLS / LuaLS/lua-language-server

能够生成文件本地的注释么?就像lua本身的local一样

Open
#854 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

image
如上图,我这个文件里并没有定义Enum,但是其他文件中有定义Enum,这样构成了冲突。

另外,想问下能不能,当我local xxx = require "xxx"了之后,就导入所有xxx文件里的结构。
举个例子
在a.lua里

---@alias Enum
---| 'Enum.ZERO' # = 0
---| 'Enum.ONE' # = 1
---| 'Enum.TWO' # = 2

在b.lua里

local aa = require "a"
---@type aa.Enum
local x

然后这时候如果我输入x = ,弹出来的提示是aa.Enum.ZERO | aa.Enum.ONE | aa.Enum.TWO

插件版本
image

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 request using the a.lua and b.lua examples in the issue, starting with the language server's handling of file-local annotations and require resolution. The payload names no source files or tests, so first locate the relevant implementation and existing coverage. Done means definitions no longer conflict across files and completion for aa.Enum offers the listed Enum values.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.