LuaLS / LuaLS/lua-language-server
setfenv
Nobody has claimed this yet.
- 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?
Diagnostics/Syntax Checking
### Expected Behaviour
no error
### Actual Behaviour
```
Cannot assign `integer` to parameter `fun(...any):...integer|unknown`.
- `integer` cannot match `fun(...any):...integer|unknown`
- Type `integer` cannot match `fun(...any):...integer|unknown`
- Type `number` cannot match `fun(...any):...integer|unknown`Lua Diagnostics.(param-type-mismatch)
```
### Reproduction steps
Lua version 5.1
setfenv(, )
### Additional Notes
maybe change definition from
`---
---Sets the environment to be used by the given function.
---
---[View documents](http://www.lua.org/manual/5.1/manual.html#pdf-setfenv)
---
---@param f async fun(...):...|integer
---@param table table
---@return function
function setfenv(f, table) end`
to
`---
---Sets the environment to be used by the given function.
---
---[View documents](http://www.lua.org/manual/5.1/manual.html#pdf-setfenv)
---
---@param f integer|async fun(...):...
---@param table table
---@return function
function setfenv(f, table) end`
### Log File
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the setfenv definition shown in the issue and compare its first parameter annotation with Lua 5.1's accepted argument forms. Reproduce the example in the Lua language server and verify that setfenv(, ) no longer reports a parameter-type mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100