LuaLS / LuaLS/lua-language-server

Busted addon doesn't set assert to luassert

Open
#3,176 1 comment 1 reaction 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

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Windows WSL

What is the issue affecting?

Libraries

Expected Behaviour

Using busted and luassert addons should set the type for the builtin assert object to be luassert

Actual Behaviour

assert type still the simple function.

Reproduction steps

server settings:

  "workspace": {
    "checkThirdParty": 'Disable',
    "library": [
      "${addons}/luassert/module/library/",
      "${addons}/busted/module/library/"
    ]
  }
Additional Notes

I managed to locally fix by changing the busted addon from

assert = require("luassert")
spy = require("luassert.spy")
stub = require("luassert.stub")
mock = require("luassert.mock")

to

---@type luassert
assert = require("luassert")

---@type luassert.spy
spy = require("luassert.spy")

---@type luassert.stub
stub = require("luassert.stub")

---@type luassert.mock
mock = require("luassert.mock")

For some reason, the luals is not setting the correct type trhough the assignment done by the busted addon.

Log File

No response

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

Start with the busted addon and compare its assert assignment with the luassert addon, using the provided NeoVim settings and reproduction steps. Done means the builtin assert is inferred as luassert when both addons are enabled, while spy, stub, and mock retain their expected types.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
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.