Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Support for "@suppress" or "@diagnostic disable-next-line" #118

Open
cosmicdan opened this issue Jan 31, 2022 · 0 comments

Comments

@cosmicdan
Copy link

cosmicdan commented Jan 31, 2022

Hi,

Not a bug but a feature request.

I am using your great extension for developing scripts in the Core game platform, so apologies if this isn't valid Lua, but it works fine in my case:

CosmicLib.lua:

---@class CosmicLib : Script
local CosmicLib = {}

---@return void
function CosmicLib:helloWorld()
    print("Hello, world!")
end

function _G.GetCosmicLib()
    return CosmicLib
end

SomeOtherScript:

---@type CosmicLib
local CosmicLib = _G.GetCosmicLib() -- <<<<<< ERROR

CosmicLib:helloWorld()

The line marked with <<<<<< ERROR results in "Match function signature" being triggered in inspections, however it works perfectly fine under Core's Lua runtime.

Rather than fix this specific quirk (again, I don't know if this is "normal" Lua), it would be great if we had a ---@suppress annotation. Or, to match https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations#diagnostic - ---@diagnostic disable-next-line could be wise. The result being to simply skip all inspections for the next statement.

So ideally I could do just add the new line in SomeOtherScript:

---@type CosmicLib
---@diagnostic disable-next-line
local CosmicLib = _G.GetCosmicLib() -- <<<<<< no longer an IDEA inspection trigger

CosmicLib:helloWorld()

For now I just set this inspection as "Server Problem" in my IDEA since I use that Severity personally for this purpose (minor tooling issues). But I will have to check this severity manually for legit errors too.

Thank you for your review!

@cosmicdan cosmicdan changed the title Feature request: Support for @supress or @diagnostic Feature request: Support for "@suppress" or "@diagnostic disable" Jan 31, 2022
@cosmicdan cosmicdan changed the title Feature request: Support for "@suppress" or "@diagnostic disable" Feature request: Support for "@suppress" or "@diagnostic disable-next-line" Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant