Skip to content

Global tables (like DVScrollBar, GM and BaseClass) aren't exposed globally #50

@TankNut

Description

@TankNut

I'm not sure what exactly is going on here but the glua definitions for panels are doing some weird things resulting in functions going missing.

Snippet from sumneko.lua\addonManager\addons\garrysmod\module\library\dvscrollbar.lua updated fresh from the addon manager:

---@meta

---[CLIENT AND MENU] Sets the scroll level in pixels.
---
---[(View on wiki)](https://wiki.facepunch.com/gmod/DVScrollBar:SetScroll)
---@param scroll number The new scroll value.
function DVScrollBar:SetScroll(scroll) end

---[CLIENT AND MENU] Returns the amount of scroll level from the top in pixels
---
---[(View on wiki)](https://wiki.facepunch.com/gmod/DVScrollBar:GetScroll)
---@return number # The amount of scroll level from the top
function DVScrollBar:GetScroll() end

---@class DVScrollBar : Panel
local DVScrollBar = {}

Those two functions are placed above the class annotation and are throwing undefined-field diagnostic errors as a result.

As a separate but related issue, global tables like DVScrollBar, GM and BaseClass are defined as locals in the snippet files, requiring people to manually add them to diagnostics.globals which seems unnecessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions