Releases: Benjamin-Dobell/IntelliJ-Luanalysis
Releases · Benjamin-Dobell/IntelliJ-Luanalysis
v1.4.0
Install from within your IDE's preferences or from the Jetbrains Marketplace.
- Requires IntelliJ IDEA 211 (2022.1)
- Support for declaring optional function parameters. Supported in both short-form and long-form:
fun(optionalParam?: number): void
---@param optionalParam? number
- Improved displayed name for types, in particular anonymous tables. You'll now see something like
{ a: 1 }
, rather than justtable
. - Generic functions are now assignable to other generic functions.
- General performance improvements, particularly when checking variance compatibility of deeply nested shapes.
- Ensure global classes (i.e. built-ins) can be extended.
- "Multiple statements in one line" wrapping setting. Implemented by Jochem Pouwels.
- Improved completion by including literal named fields.
- Improved support for lambda classes with static methods.
- Fixed incorrect overload matching when arguments were provided as multiple results from a function call.
- Fixed incorrect type deductions in the presence of aliased generics.
- Fixed unused local/param warnings incorrectly being reported in
.def.lua
files. - Fixed generic parameter resolution through aliases and shapes.
- Fixed type of anonymous table members derived from generic params.
- Fixed aliased shape equality.
- Fixed generic concreteness handling within function bodies (including recursive calls).
- Fixed issue with tuples params passed to a callable type causing a stack overflow.
- Fixed "}" sometimes being generated instead of "end". Implemented by Jochem Pouwels.
- Fixed incorrect declaration type inference in the presence of
@not
. - Fixed generic resolution within type annotations on return statements.
- Fixed debug.traceback() type definitions. Implemented by Sebastian Gładki.
v1.3.0
Install from within your IDE's preferences or from the Jetbrains Marketplace.
- Requires IntelliJ IDEA 211 (2021.1)
- Breaking: The standard library
DebugInfo
class (returned fromdebug.getinfo
) is now known asstd__DebugInfo
and is a shape rather than a class. Fields presence and types have also been corrected. - New "Illegal alias in emmy doc" inspection. Reports illegal/circular alias definitions.
- Fixed incorrect coercion of vararg types to unit types.
- Fixed generic alias equality.
- Fixed Lua 5.1-5.4 os.exit type definition.
- Fixed Lua <= 5.1 os.exit documentation.
- Fixed string:gmatch type definition.
- Fixed file:read type definition.
- Fixed some issues with types displaying incorrectly in tooltips (missing parentheses).
- Improved docs for string functions involving patterns in order to explain why captures are typed
string | number
. - You can now sponsor the ongoing development of Luanalysis and appear in the project's README on Github. Github are 1-to-1 matching any donations up to $5000 (total) made before February 2022.
v1.2.3
- @class/@shape can now inherit from aliased types.
- Made doc tables behave more like shapes.
As a result also improved doc table tuple support. Main outstanding differences:- Doc tables cannot inherit from shapes.
- Doc tables cannot be callable types.
- Added support for doc strings trailing @alias definitions, displayed in IDE mouse-over popup.
- Added support for multiple @alias appearing in the same doc comment i.e. blank lines are no longer required between @alias.
- Improved indexing performance.
- Improved inference performance (IDE responsiveness), particularly in the presense of deeply nested scopes.
- Improved illegal inheritance inspection.
- Improved handling of table fields whose index type is unable to be inferred during indexing.
- Corrected/refined os.date() stdlib definition.
- Worked around JBR/Kotlin initializer deadlock..
- Fixed generic inference when param is returned in multiple results.
- Fixed incorrect "Illegal override" of fun with multiple results.
- Fixed @vararg not accepting complex types (fun etc.)
- Fixed occasional incorrect "Generic parameters cannot be shadowed".
- Fixed variance detection of fields being assigned to a generic shape where the index of the source field is covariant of the
index of the target field, and the target field's type contains a generic parameter. - Fixed auto-completion of aliases and unions.
- Fixed incorrect type-checking of arguments passed to
fun
(without a parameter list). - Fixed inference of closures containing nested closures (containing return statements).
- Fixed lexing of aliases with constrained generics.
1.2.2
- New "Illegal Overrides" inspection. Reports illegal member overrides when declaring a field/method on an inherited type.
If you're overriding a method with an incompatible type (e.g. subclassinit
function with different parameters) then you should annotate the parentinit
(and child) as@private
. - Improved support for progressively adding type annotations to an existing Lua codebase. Essentially, local variables (without a declaration site assignment) and function parameters are now assumed to be of type
any
. - Mouse-over documentation now supports indexed fields e.g. docs are now displayed when hovering over the
[1]
inarr[1]
. - Inspections now traverse expressions (function calls, binary operators etc.) so you'll see more specific errors within table literals in more circumstances.
- Many stdlib improvements/fixes (setmetatable, load* functions, getfenv, tostring, pcall, xpcall, assert & collectgarbage).
- Migrated stdlib to the .def.lua extension. If you're writing API types (i.e. files that are never executed) it's suggested you adopt this file extension too.
- Formalised type widening behaviour for overridden fields.
- Best effort type inference for the return type of invalid function calls i.e. more chance of just seeing errors at the call site, rather than all through-out a function.
- Special case handling for resolution of the
self
type when writing classes as closures i.e. expressions that look likesetmetatable(someTable, {__call=function() end})
. In such casesself
type will be resolved based on the return type of__call
. - Various type inference and variance detection performance improvements.
- Improved handling of return types that are a union of multiple results. Rather than being flattened into a multiple result list where each component is a union during type checking, the initial structure is preserved.
- Ensured method override auto-completion works in more circumstances.
- Ensured primitives are never covariant of shapes.
- Made an attempt to ensure the plugin is considered "dynamic" by IDEA.
- Fixed clashes between anonymous types declared at the same offer in files with the same name (in different directories or virtual file systems).
- Fixed several complex type rendering issues (missing brackets etc.) in the UI.
- Fixed a boolean operator type inference bug in the presence of variadic return types.
- Fixed some incorrect inspections when "Unknown type (any) is indexable" is enabled".
- Fixed type inference/inspections involving assignment of
nil
to a member oftable<K, nil | V>
- Fixed "Compute constant value" intention. However, many of the cases supported seem excessive and quite impractical. As such, this intention may be simplified in a future release.
- Fixed type inference & inspections for shapes that recursively reference themselves in their fields.
- Fixed auto-complete and type resolution for fields that are written to
self
typed variables. - Fixed several bugs where generic parameters declared in multiple scopes are involved in type inference.
- Fixed support for generic parameters referring to other generic parameters in their type constraints.
- Fixed occasional misreported generic parameter shadowed errors.
1.2.1
- Improved return inspection handling for unions of multiple results
- Improved stdlib string module definitions
1.2.0
- Requires IntelliJ IDEA 203 (2020.3)
- Breaking: Removed unsafe assumed constructor functionality (#12)
- Lua 5.4 support: <const> and <close> local variables and corresponding immutability inspections.
- Removed 'Recognize global name as type' plugin option as its use encourages unsafe development practices.
- Added new setting "Unknown type (any) is callable" which is enabled by default. For stricter type safety it's suggested you disable this option.
- Added an "Illegal inheritance" inspection which will report inheritance cycles and inheritance from primitives.
- Substantially improved (more refined) problem annotations on deeply nested table literals (#11 and more.)
- Ensured inspections are re-run in more situations when variable types or type definitions are modified.
- Improved lookup performance for locally scoped types, currently just generic types.
- Performance improvements when dealing with types defined in the non-working file.
- Jump to definition behavior for fields that are members of a table, table<K, V> or V[].
- Added proper descriptions for every Luanalysis inspection.
- Improved mouse-over pop-up docs for table literals that will be interpreted as a shape.
- Only a subset of inspections are now run against files with the extension .def.lua e.g. return statement inspections are not run against functions
- Improved inspections for missing arguments and colon/period function calls e.g. "Missing self argument. Did you mean to call the method with a colon?"
- Corrected stdlib definitions for string.find()
- Corrected stdlib definitions for next, ipairs and pairs.
- Improved type safety of stdlib io module methods.
- Improved stdlib math.random() definition. Contributed by Omniraptor
- Improved stdlib string.gsub() definition. Contributed by Omniraptor
- Fixed several related bugs that could cause Luanalysis to get into a state where it was unable to recognise both user and in-built types.
- Fixed issue where shape inspections were appearing on table literals subject to a type cast (#14)
- Static analysis now correctly handles use of parentheses to restrict multiple return values to just the first value.
- Fixed handling of iterators.
- Improved formatting/consistency of complex types displayed in the UI.
function
type is now treated as returningany...
- Fixed use of
@overload
in@class
definitions that do not proceed a variable declaration/assignment. - Smarter union behavior that eliminates duplicate/covariant types from the union. This tends to result in much simple error message.
- Fixed handling of some situations where table literals ought to be interpreted as arrays, but were not.
1.1.0
- Ctrl/Cmd + Click ("Go To") on a string literal argument of a require("file") now takes you to the return value of the referenced file, rather than simply opening the file.
- Fixed type resolution of require("file") expressions, where the referenced file has no return statements.
- Added/fixed support for negative number literal types.
- Type inference will now handle unary minus (negate) expressions, where the operand is a number literal. String literals representing values that Lua will silently coerce to a number are also handled.
1.0.3
Ensured "Return type 'void' specified but no return values found" annotation is no longer raised for functions annotated as ---@return void
.
1.0.2
Same as 1.0.1, but not tied to IntelliJ 201 (2020.1).
1.0.1
- Replaced duplicate class inspection with duplicate type inspection. Class/alias name collisions are now reported.
- Despite the Lua manual indicating otherwise, bit32 is present in Lua 5.3, added it.
- Ensured arrays are not covariant of shapes representing tuples.