Skip to content

Unused local variable ignore pattern #619

@smackesey

Description

@smackesey

This is a feature request. Whenever one writes functions against implementing some interface (e.g. that will be called by external code), it's common to have parameters that may not be used:

local myFunction(arg1, arg2)
  print('This function doesn't actually use the args passed to it.)
end

A lot of the time it's useful to keep these args listed for documentation/standardization purposes. A common cross-language convention is to prefix known unused variables with a leading underscore:

local myFunction(_arg1, _arg2)
  print("This function doesn't actually use the args passed to it.")
end

Right now (so far as I can tell), there is no way to turn off the unused variable warnings for just variables with a leading underscore-- you either turn off all unused variable warnings, or none. I think it would be good to provide a "Lua.diagnostics.unusedVariableIgnorePattern" or similar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions