summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCppCXY <812125110@qq.com>2023-03-30 13:45:30 +0800
committerCppCXY <812125110@qq.com>2023-03-30 13:45:30 +0800
commit44e44a42eb33381867f1d0f3e0013ed3506c1536 (patch)
tree93eddc0ca1f49b0b7847accdd84fb7838f1b7241
parent7db52b765ca82cbaedf2bcb765643bb132c6aebd (diff)
parent93bd7aa371d361e3d7bc19d9bf31d66821067a9e (diff)
downloadlua-language-server-44e44a42eb33381867f1d0f3e0013ed3506c1536.zip
Merge branch 'master' of github.com:CppCXY/lua-language-server
m---------3rd/bee.lua0
m---------3rd/love-api0
m---------3rd/lovr-api0
m---------3rd/luamake0
-rw-r--r--README.md35
-rw-r--r--changelog.md20
-rw-r--r--make.lua14
-rw-r--r--meta/3rd/bee/config.json4
-rw-r--r--meta/3rd/bee/library/bee/filesystem.lua240
-rw-r--r--meta/3rd/bee/library/bee/platform.lua62
-rw-r--r--meta/3rd/bee/library/bee/subprocess.lua99
-rw-r--r--meta/3rd/bee/library/bee/thread.lua62
-rw-r--r--meta/3rd/love2d/library/love/physics.lua14
-rw-r--r--meta/3rd/lovr/library/lovr/audio.lua42
-rw-r--r--meta/3rd/lovr/library/lovr/graphics.lua332
-rw-r--r--meta/3rd/lovr/library/lovr/math.lua7
-rw-r--r--meta/3rd/lovr/library/lovr/physics.lua56
-rw-r--r--meta/3rd/skynet/library/skynet.lua9
-rw-r--r--meta/template/string.lua40
-rw-r--r--script/cli/check.lua2
-rw-r--r--script/cli/doc.lua93
-rw-r--r--script/core/semantic-tokens.lua15
-rw-r--r--script/parser/luadoc.lua11
-rw-r--r--script/string-merger.lua4
-rw-r--r--script/vm/operator.lua83
-rw-r--r--script/vm/type.lua1
-rw-r--r--test/crossfile/hover.lua39
-rw-r--r--test/diagnostics/type-check.lua17
-rw-r--r--test/hover/init.lua6
-rw-r--r--test/type_inference/init.lua41
30 files changed, 1107 insertions, 241 deletions
diff --git a/3rd/bee.lua b/3rd/bee.lua
-Subproject 07870ccd5ffba13c167b4bb40622baea1ad4d7e
+Subproject ca581b9191d98a0644da1dc3332bb59274c9f10
diff --git a/3rd/love-api b/3rd/love-api
-Subproject 495ecc72d994f5d52fc21592dda9d16f4fd75ba
+Subproject ab6dc6756683686b5506107116f994253aef5a2
diff --git a/3rd/lovr-api b/3rd/lovr-api
-Subproject f08de6bc658f385dfa1b6d1fcba52da5f88b785
+Subproject cd208aeb7dabf47d4edecdb9162c1d7d10e73a1
diff --git a/3rd/luamake b/3rd/luamake
-Subproject 915baa5a3141e3f45708b59a7bbc76d7a701d7f
+Subproject 22f861ac8444d1b85ceb29561b2a599fcbff4e3
diff --git a/README.md b/README.md
index c1262add..58bdc4e2 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@ The Lua language server provides various language features for Lua to make devel
## Features
+- ⚙️ Supports `Lua 5.4`, `Lua 5.3`, `Lua 5.2`, `Lua 5.1`, and `LuaJIT`
- 📄 Over 20 supported [annotations](https://github.com/LuaLS/lua-language-server/wiki/Annotations) for documenting your code
- ↪ Go to definition
- 🦺 Dynamic [type checking](https://github.com/LuaLS/lua-language-server/wiki/Type-Checking)
@@ -28,29 +29,27 @@ The Lua language server provides various language features for Lua to make devel
- 📖 [Documentation Generation](https://github.com/LuaLS/lua-language-server/wiki/Export-Documentation)
## Install
-
-The language server can easily be installed for use in VS Code, but it can also be used by other clients using the command line.
+The language server can be installed for use in Visual Studio Code, NeoVim, and any [other clients](https://microsoft.github.io/language-server-protocol/implementors/tools/) that support the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/). The language server can be configured using a [configuration file](https://github.com/LuaLS/lua-language-server/wiki/Configuration-File). For a more detailed intro, check out the [getting started page in the wiki](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started).
### Visual Studio Code
[![Install in VS Code](https://img.shields.io/badge/VS%20Code-Install-blue?style=for-the-badge&logo=visualstudiocode "Install in VS Code")](https://marketplace.visualstudio.com/items?itemName=sumneko.lua)
The language server and Visual Studio Code client can be installed from [the VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=sumneko.lua).
-![](https://github.com/LuaLS/vscode-lua/raw/master/images//Install%20In%20VSCode.gif)
+### NeoVim
+[![Install for NeoVim](https://img.shields.io/badge/NeoVim-Install-blue?style=for-the-badge&logo=neovim "Install for NeoVim")](https://dev.to/vonheikemen/getting-started-with-neovims-native-lsp-client-in-the-year-of-2022-the-easy-way-bp3)
+
+You can read [Heiker's guide](https://dev.to/vonheikemen/getting-started-with-neovims-native-lsp-client-in-the-year-of-2022-the-easy-way-bp3) for getting set up from scratch.
### Command Line
[![Install for command line](https://img.shields.io/badge/Command%20Line-Install-blue?style=for-the-badge&logo=windowsterminal "Install for command line")](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#command-line)
-Check the [wiki for a guide](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#command-line) to install the language server for use on the command line. This allows the language server to be used with NeoVim and [other clients](https://microsoft.github.io/language-server-protocol/implementors/tools/) that follow the [language server protocol](https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/).
+Check the [wiki for a guide](https://github.com/LuaLS/lua-language-server/wiki/Getting-Started#command-line) to install the language server for use on the command line. This allows the language server to be used with [other clients](https://microsoft.github.io/language-server-protocol/implementors/tools/) that follow the [language server protocol](https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/).
+
+### Community Install Methods
+The install methods below are maintained by community members.
-## Supported Lua Versions
-| Version | Supported |
-| :-----: | :------------: |
-| Lua 5.1 | ![✅][checkmark] |
-| Lua 5.2 | ![✅][checkmark] |
-| Lua 5.3 | ![✅][checkmark] |
-| Lua 5.4 | ![✅][checkmark] |
-| LuaJIT | ![✅][checkmark] |
+[asdf plugin](https://github.com/bellini666/asdf-lua-language-server)
## Links
- [Changelog](https://github.com/LuaLS/lua-language-server/blob/master/changelog.md)
@@ -82,15 +81,6 @@ Are you able to [provide a translation](https://github.com/LuaLS/lua-language-se
Thank you to [all contributors of translations](https://github.com/LuaLS/lua-language-server/commits/master/locale)!
-## Configuration
-Configuration of the server can be done in a number of ways, which are explained more in-depth in the [wiki](https://github.com/LuaLS/lua-language-server/wiki/Configuration-File).
-
-### Visual Studio Code
-You can use the [settings editor](https://code.visualstudio.com/docs/getstarted/settings#_settings-editor) or edit the [raw JSON file](https://code.visualstudio.com/docs/getstarted/settings#_settingsjson).
-
-### Other
-See the [configuration file wiki page](https://github.com/LuaLS/lua-language-server/wiki/Configuration-File).
-
## Privacy
The language server had **opt-in** telemetry that collected usage data and sent it to the development team to help improve the extension. Read our [privacy policy](https://github.com/LuaLS/lua-language-server/wiki/Home#privacy) to learn more. Telemetry was removed in `v3.6.5` and is no longer part of the language server.
@@ -116,6 +106,3 @@ Software that the language server (or the development of it) uses:
* [json.lua](https://github.com/actboy168/json.lua)
* [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle)
* [inspect.lua](https://github.com/kikito/inspect.lua)
-
-
-[checkmark]: https://user-images.githubusercontent.com/61925890/183228083-d3aa4eca-30c7-4b9f-aaab-26ce3d8a14fb.png
diff --git a/changelog.md b/changelog.md
index 5009ced8..325a0a15 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,25 @@
# changelog
+## 3.6.19
+* `FIX` commandline parameter `checklevel` may not work
+* `FIX` [#2036]
+* `FIX` [#2037]
+
+[#2036]: https://github.com/LuaLS/lua-language-server/issues/2036
+[#2037]: https://github.com/LuaLS/lua-language-server/issues/2037
+
+## 3.6.18
+`2023-3-23`
+* `FIX` [#1943]
+* `FIX` [#1996]
+* `FIX` [#2004]
+* `FIX` [#2013]
+
+[#1943]: https://github.com/LuaLS/lua-language-server/issues/1943
+[#1996]: https://github.com/LuaLS/lua-language-server/issues/1996
+[#2004]: https://github.com/LuaLS/lua-language-server/issues/2004
+[#2013]: https://github.com/LuaLS/lua-language-server/issues/2013
+
## 3.6.17
`2023-3-9`
* `CHG` export documents: export global variables
diff --git a/make.lua b/make.lua
index 983f6334..25234c75 100644
--- a/make.lua
+++ b/make.lua
@@ -92,20 +92,26 @@ if lm.notest then
return
end
-lm:rule "runtest" {
+lm:rule "run-bee-test" {
+ lm.bindir .. "/lua-language-server" .. exe, "$in",
+ description = "Run test: $in.",
+ pool = "console",
+}
+
+lm:rule "run-unit-test" {
"bin/lua-language-server" .. exe, "$in",
description = "Run test: $in.",
pool = "console",
}
lm:build "bee-test" {
- rule = "runtest",
- deps = { "all" },
+ rule = "run-bee-test",
+ deps = { "lua-language-server", "copy_script" },
input = "3rd/bee.lua/test/test.lua",
}
lm:build 'unit-test' {
- rule = "runtest",
+ rule = "run-unit-test",
deps = { "bee-test", "all" },
input = "test.lua",
}
diff --git a/meta/3rd/bee/config.json b/meta/3rd/bee/config.json
new file mode 100644
index 00000000..0dce5817
--- /dev/null
+++ b/meta/3rd/bee/config.json
@@ -0,0 +1,4 @@
+{
+ "name" : "bee",
+ "words" : [ "require[%s%(\"']+bee%.%w+[%)\"']" ]
+}
diff --git a/meta/3rd/bee/library/bee/filesystem.lua b/meta/3rd/bee/library/bee/filesystem.lua
new file mode 100644
index 00000000..7cd4dcbb
--- /dev/null
+++ b/meta/3rd/bee/library/bee/filesystem.lua
@@ -0,0 +1,240 @@
+---@meta
+
+local m = {}
+
+---@enum bee.filesystem.copy_options
+local copy_options = {
+ none = 0,
+ skip_existing = 1,
+ overwrite_existing = 2,
+ update_existing = 4,
+ recursive = 8,
+ copy_symlinks = 16,
+ skip_symlinks = 32,
+ directories_only = 64,
+ create_symlinks = 128,
+ create_hard_links = 256,
+ __in_recursive_copy = 512,
+}
+
+---@alias bee.filesystem.path_arg string|bee.filesystem.path
+
+---@class bee.filesystem.path
+---@operator div(any):bee.filesystem.path
+---@operator concat(any):bee.filesystem.path
+local path = {}
+
+---@return string
+function path:string()
+end
+
+---@return bee.filesystem.path
+function path:filename()
+end
+
+---@return bee.filesystem.path
+function path:parent_path()
+end
+
+---@return bee.filesystem.path
+function path:stem()
+end
+
+---@return bee.filesystem.path
+function path:extension()
+end
+
+---@return boolean
+function path:is_absolute()
+end
+
+---@return boolean
+function path:is_relative()
+end
+
+---@return bee.filesystem.path
+function path:remove_filename()
+end
+
+---@param filename bee.filesystem.path_arg
+---@return bee.filesystem.path
+function path:replace_filename(filename)
+end
+
+---@param extension bee.filesystem.path_arg
+---@return bee.filesystem.path
+function path:replace_extension(extension)
+end
+
+---@param path bee.filesystem.path_arg
+---@return boolean
+function path:equal_extension(path)
+end
+
+---@return bee.filesystem.path
+function path:lexically_normal()
+end
+
+---@class bee.filesystem.file_status
+local file_status = {}
+
+---@alias bee.filesystem.file_type
+---| "'none'"
+---| "'not_found'"
+---| "'regular'"
+---| "'directory'"
+---| "'symlink'"
+---| "'block'"
+---| "'character'"
+---| "'fifo'"
+---| "'socket'"
+---| "'junction'"
+---| "'unknown'"
+
+---@return bee.filesystem.file_type
+function file_status:type()
+end
+
+---@return boolean
+function file_status:exists()
+end
+
+---@return boolean
+function file_status:is_directory()
+end
+
+---@return boolean
+function file_status:is_regular_file()
+end
+
+---@class bee.filesystem.directory_entry
+local directory_entry = {}
+
+---@return bee.filesystem.path
+function directory_entry:path()
+end
+
+---@return bee.filesystem.file_status
+function directory_entry:status()
+end
+
+---@return bee.filesystem.file_status
+function directory_entry:symlink_status()
+end
+
+---@return bee.filesystem.file_type
+function directory_entry:type()
+end
+
+---@return boolean
+function directory_entry:exists()
+end
+
+---@return boolean
+function directory_entry:is_directory()
+end
+
+---@return boolean
+function directory_entry:is_regular_file()
+end
+
+---@return bee.filesystem.path
+function m.path(path)
+end
+
+---@return bee.filesystem.file_status
+function m.status(path)
+end
+
+---@return bee.filesystem.file_status
+function m.symlink_status(path)
+end
+
+---@return boolean
+function m.exists(path)
+end
+
+---@return boolean
+function m.is_directory(path)
+end
+
+---@return boolean
+function m.is_regular_file(path)
+end
+
+function m.create_directory(path)
+end
+
+function m.create_directories(path)
+end
+
+function m.rename(from, to)
+end
+
+function m.remove(path)
+end
+
+function m.remove_all(path)
+end
+
+---@return bee.filesystem.path
+function m.current_path()
+end
+
+---@param options bee.filesystem.copy_options
+function m.copy(from, to, options)
+end
+
+---@param options bee.filesystem.copy_options
+function m.copy_file(from, to, options)
+end
+
+function m.absolute(path)
+end
+
+function m.canonical(path)
+end
+
+function m.relative(path)
+end
+
+function m.last_write_time(path)
+end
+
+function m.permissions(path)
+end
+
+function m.create_symlink(target, link)
+end
+
+function m.create_directory_symlink(target, link)
+end
+
+function m.create_hard_link(target, link)
+end
+
+---@return bee.filesystem.path
+function m.temp_directory_path()
+end
+
+---@return fun(table: bee.filesystem.path[]): bee.filesystem.path
+function m.pairs(path)
+end
+
+---@return bee.filesystem.path
+function m.exe_path()
+end
+
+---@return bee.filesystem.path
+function m.dll_path()
+end
+
+---@return bee.file
+function m.filelock(path)
+end
+
+---@return bee.filesystem.path
+function m.fullpath(path)
+end
+
+return m
diff --git a/meta/3rd/bee/library/bee/platform.lua b/meta/3rd/bee/library/bee/platform.lua
new file mode 100644
index 00000000..f380a9bf
--- /dev/null
+++ b/meta/3rd/bee/library/bee/platform.lua
@@ -0,0 +1,62 @@
+---@meta
+
+---@alias bee.platform.os
+---| '"windows"'
+---| '"android"'
+---| '"linux"'
+---| '"netbsd"'
+---| '"freebsd"'
+---| '"openbsd"'
+---| '"ios"'
+---| '"macos"'
+---| '"unknown"'
+
+---@alias bee.platform.OS
+---| '"Windows"'
+---| '"Android"'
+---| '"Linux"'
+---| '"NetBSD"'
+---| '"FreeBSD"'
+---| '"OpenBSD"'
+---| '"iOS"'
+---| '"macOS"'
+---| '"unknown"'
+
+---@alias bee.platform.arch
+---| '"x86"'
+---| '"x86_64"'
+---| '"arm"'
+---| '"arm64"'
+---| '"riscv"'
+---| '"unknown"'
+
+---@alias bee.platform.compiler
+---| '"clang"'
+---| '"gcc"'
+---| '"msvc"'
+---| '"unknown"'
+
+---@alias bee.platform.crt
+---| '"msvc"'
+---| '"bionic"'
+---| '"libstdc++"'
+---| '"libc++"'
+---| '"unknown"'
+
+local m = {
+ ---@type bee.platform.os
+ os = "unknown",
+ ---@type bee.platform.OS
+ OS = "unknown",
+ ---@type bee.platform.compiler
+ Compiler = "clang",
+ CompilerVersion = "",
+ CRTVersion = "",
+ ---@type bee.platform.crt
+ CRT = "msvc",
+ ---@type bee.platform.arch
+ Arch = "x86",
+ DEBUG = false,
+}
+
+return m
diff --git a/meta/3rd/bee/library/bee/subprocess.lua b/meta/3rd/bee/library/bee/subprocess.lua
new file mode 100644
index 00000000..0c979729
--- /dev/null
+++ b/meta/3rd/bee/library/bee/subprocess.lua
@@ -0,0 +1,99 @@
+---@meta
+
+---@class bee.file:lightuserdata
+local file = {}
+
+---@alias bee.file.readmode integer|"'a'"
+
+---@param mode bee.file.readmode
+---@return string
+function file:read(mode)
+end
+
+---@param buf number|integer|string
+function file:write(buf)
+end
+
+---@return fun():string
+function file:lines()
+end
+
+function file:flush()
+end
+
+function file:close()
+end
+
+---@param mode "'no'"|"'full'"|"'line'"
+function file:setvbuf(mode)
+end
+
+---@class bee.process
+---@field stderr bee.file?
+---@field stdout bee.file?
+---@field stdin bee.file?
+local process = {}
+
+---@return integer exit_code
+function process:wait()
+end
+
+---@return boolean success
+function process:kill()
+end
+
+---@return integer process_id
+function process:get_id()
+end
+
+---@return boolean is_running
+function process:is_running()
+end
+
+---@return boolean success
+function process:resume()
+end
+
+---@return any native_handle
+function process:native_handle()
+end
+
+---@class bee.subprocess
+local m = {}
+
+---@alias bee.bee.subprocess.spawn_io_arg boolean|file*|bee.file|"'stderr'"|"'stdout'"
+
+---@class bee.subprocess.spawn.options : string[]
+---@field stdin bee.bee.subprocess.spawn_io_arg?
+---@field stdout bee.bee.subprocess.spawn_io_arg?
+---@field stderr bee.bee.subprocess.spawn_io_arg?
+---@field env table<string,string>?
+---@field suspended boolean?
+---@field detached boolean?
+
+---@param options bee.subprocess.spawn.options
+---@return bee.process process
+function m.spawn(options)
+end
+
+---@param file file*|bee.file
+---@return integer offset
+---@return string? error_message
+function m.peek(file)
+end
+
+function m.filemode()
+end
+
+---@param name string
+---@param value string
+---@return boolean success
+---@return string? error_message
+function m.setenv(name, value)
+end
+
+---@return integer current_process_id
+function m.get_id()
+end
+
+return m
diff --git a/meta/3rd/bee/library/bee/thread.lua b/meta/3rd/bee/library/bee/thread.lua
new file mode 100644
index 00000000..9e005ea4
--- /dev/null
+++ b/meta/3rd/bee/library/bee/thread.lua
@@ -0,0 +1,62 @@
+---@meta
+
+---@class bee.rpc:lightuserdata
+
+---@class bee.thread_obj:lightuserdata
+
+---@class bee.channel
+local channel = {}
+
+function channel:push(...)
+end
+
+---@return boolean ok
+---@return ...
+function channel:pop()
+end
+
+---@return ...
+function channel:bpop()
+end
+
+---@class bee.thread
+local m = {}
+
+function m.sleep(sec)
+end
+
+---@return bee.thread_obj
+function m.thread(source, params)
+end
+
+function m.newchannel(name)
+end
+
+---@return bee.channel
+function m.channel(name)
+end
+
+function m.reset()
+end
+
+---@param th bee.thread_obj
+function m.wait(th)
+end
+
+function m.setname(name)
+end
+
+---@return bee.rpc
+function m.rpc_create()
+end
+
+function m.rpc_wait(rpc)
+end
+
+function m.rpc_return(rpc)
+end
+
+function m.preload_module()
+end
+
+return m
diff --git a/meta/3rd/love2d/library/love/physics.lua b/meta/3rd/love2d/library/love/physics.lua
index 616e4791..82ea008a 100644
--- a/meta/3rd/love2d/library/love/physics.lua
+++ b/meta/3rd/love2d/library/love/physics.lua
@@ -3122,14 +3122,12 @@ function World:queryBoundingBox(topLeftX, topLeftY, bottomRightX, bottomRightY,
---
---[Open in Browser](https://love2d.org/wiki/World:rayCast)
---
----@param fixture love.Fixture # The fixture intersecting the ray.
----@param x number # The x position of the intersection point.
----@param y number # The y position of the intersection point.
----@param xn number # The x value of the surface normal vector of the shape edge.
----@param yn number # The y value of the surface normal vector of the shape edge.
----@param fraction number # The position of the intersection on the ray as a number from 0 to 1 (or even higher if the ray length was changed with the return value).
----@return number control # The ray can be controlled with the return value. A positive value sets a new ray length where 1 is the default value. A value of 0 terminates the ray. If the callback function returns -1, the intersection gets ignored as if it didn't happen.
-function World:rayCast(fixture, x, y, xn, yn, fraction) end
+---@param x1 number # The x position of the starting point of the ray.
+---@param y1 number # The x position of the starting point of the ray.
+---@param x2 number # The x position of the end point of the ray.
+---@param y2 number # The x value of the surface normal vector of the shape edge.
+---@param callback function # A function called for each fixture intersected by the ray. The function gets six arguments and should return a number as a control value. The intersection points fed into the function will be in an arbitrary order. If you wish to find the closest point of intersection, you'll need to do that yourself within the function. The easiest way to do that is by using the fraction value.
+function World:rayCast(x1, y1, x2, y2, callback) end
---
---Sets functions for the collision callbacks during the world update.
diff --git a/meta/3rd/lovr/library/lovr/audio.lua b/meta/3rd/lovr/library/lovr/audio.lua
index c56a37d6..ebe35714 100644
--- a/meta/3rd/lovr/library/lovr/audio.lua
+++ b/meta/3rd/lovr/library/lovr/audio.lua
@@ -271,6 +271,7 @@ function lovr.audio.setGeometry(vertices, indices, material) end
---
---Sets the orientation of the virtual audio listener in angle/axis representation.
---
+---@overload fun(orientation: lovr.Quat)
---@param angle number # The number of radians the listener should be rotated around its rotation axis.
---@param ax number # The x component of the axis of rotation.
---@param ay number # The y component of the axis of rotation.
@@ -280,9 +281,14 @@ function lovr.audio.setOrientation(angle, ax, ay, az) end
---
---Sets the position and orientation of the virtual audio listener.
---
----@param x number # The x position of the listener, in meters.
----@param y number # The y position of the listener, in meters.
----@param z number # The z position of the listener, in meters.
+---
+---### NOTE:
+---The position of the listener doesn't use any specific units, but usually they can be thought of as meters to match the headset module.
+---
+---@overload fun(position: lovr.Vec3, orientation: lovr.Quat)
+---@param x number # The x position of the listener.
+---@param y number # The y position of the listener.
+---@param z number # The z position of the listener.
---@param angle number # The number of radians the listener is rotated around its axis of rotation.
---@param ax number # The x component of the axis of rotation.
---@param ay number # The y component of the axis of rotation.
@@ -290,8 +296,11 @@ function lovr.audio.setOrientation(angle, ax, ay, az) end
function lovr.audio.setPose(x, y, z, angle, ax, ay, az) end
---
----Sets the position of the virtual audio listener, in meters.
+---Sets the position of the virtual audio listener.
+---
+---The position doesn't have any specific units, but usually they can be thought of as meters, to match the headset module.
---
+---@overload fun(position: lovr.Vec3)
---@param x number # The x position of the listener.
---@param y number # The y position of the listener.
---@param z number # The z position of the listener.
@@ -612,6 +621,7 @@ function Source:setLooping(loop) end
---
---Sets the orientation of the Source in angle/axis representation.
---
+---@overload fun(self: lovr.Source, orientation: lovr.Quat)
---@param angle number # The number of radians the Source should be rotated around its rotation axis.
---@param ax number # The x component of the axis of rotation.
---@param ay number # The y component of the axis of rotation.
@@ -635,9 +645,14 @@ function Source:setPitch(pitch) end
---
---Sets the position and orientation of the Source.
---
----@param x number # The x position of the Source, in meters.
----@param y number # The y position of the Source, in meters.
----@param z number # The z position of the Source, in meters.
+---
+---### NOTE:
+---The position doesn't have any defined units, but meters are used by convention.
+---
+---@overload fun(self: lovr.Source, position: lovr.Vec3, orientation: lovr.Quat)
+---@param x number # The x position of the Source.
+---@param y number # The y position of the Source.
+---@param z number # The z position of the Source.
---@param angle number # The number of radians the Source is rotated around its axis of rotation.
---@param ax number # The x component of the axis of rotation.
---@param ay number # The y component of the axis of rotation.
@@ -645,7 +660,7 @@ function Source:setPitch(pitch) end
function Source:setPose(x, y, z, angle, ax, ay, az) end
---
----Sets the position of the Source, in meters.
+---Sets the position of the Source.
---
---Setting the position will cause the Source to be distorted and attenuated based on its position relative to the listener.
---
@@ -653,9 +668,14 @@ function Source:setPose(x, y, z, angle, ax, ay, az) end
---
---Setting the position of a stereo Source will cause an error.
---
----@param x number # The x coordinate.
----@param y number # The y coordinate.
----@param z number # The z coordinate.
+---
+---### NOTE:
+---The position doesn't have any defined units, but meters are used by convention.
+---
+---@overload fun(self: lovr.Source, position: lovr.Vec3)
+---@param x number # The x coordinate of the position.
+---@param y number # The y coordinate of the position.
+---@param z number # The z coordinate of the position.
function Source:setPosition(x, y, z) end
---
diff --git a/meta/3rd/lovr/library/lovr/graphics.lua b/meta/3rd/lovr/library/lovr/graphics.lua
index 8157bdb2..b0833fea 100644
--- a/meta/3rd/lovr/library/lovr/graphics.lua
+++ b/meta/3rd/lovr/library/lovr/graphics.lua
@@ -332,11 +332,22 @@ function lovr.graphics.getLimits() end
---### NOTE:
---Fun facts about render passes:
---
----- Textures must have the same dimensions, layer counts, and sample counts.
---- Textures must have been created with the `render` `TextureUsage`.
+---- Textures must have the same dimensions, layer counts, and sample counts.
+---- When rendering to textures with multiple layers, each draw will be broadcast to all layers.
+--- Render passes have multiple "views" (cameras), and each layer uses a corresponding view,
+--- allowing each layer to be rendered from a different viewpoint.
+---
+---This enables fast stereo
+--- rendering, but can also be used to efficiently render to cubemaps.
+---
+---The `ViewIndex` variable
+--- can also be used in shaders to set up any desired per-view behavior.
---- If `mipmap` is true, then any textures with mipmaps must have the `transfer` `TextureUsage`.
---- It's okay to have zero color textures, but in this case there must be a depth texture.
---- Setting `clear` to `false` for textures is usually very slow on mobile GPUs.
+---- It's possible to render to a specific mipmap level of a Texture, or a subset of its layers, by
+--- rendering to texture views, see `Texture:newView`.
---
---For `compute` and `transfer` passes, all of the commands in the pass act as though they run in parallel.
---
@@ -1277,10 +1288,6 @@ function Model:getNodePosition(index, space) end
---
---Returns the scale of a node.
---
----
----### NOTE:
----For best results when animating, it's recommended to keep the 3 components of the scale the same.
----
---@overload fun(self: lovr.Model, name: string, origin?: lovr.OriginType):number, number, number
---@param index number # The index of the node.
---@param origin? lovr.OriginType # Whether the scale should be returned relative to the root node or the node's parent.
@@ -1397,56 +1404,103 @@ function Model:resetNodeTransforms() end
---
---Sets or blends the orientation of a node to a new orientation.
---
----@overload fun(self: lovr.Model, name: string, orientation: lovr.rotation, blend?: number)
+---This sets the local orientation of the node, relative to its parent.
+---
+---@overload fun(self: lovr.Model, name: string, angle: number, ax: number, ay: number, az: number, blend?: number)
+---@overload fun(self: lovr.Model, index: number, orientation: lovr.Quat, blend?: number)
+---@overload fun(self: lovr.Model, name: string, orientation: lovr.Quat, blend?: number)
---@param index number # The index of the node.
----@param orientation lovr.rotation # The target orientation.
+---@param angle number # The number of radians the node should be rotated around its rotation axis.
+---@param ax number # The x component of the axis of rotation.
+---@param ay number # The y component of the axis of rotation.
+---@param az number # The z component of the axis of rotation.
---@param blend? number # A number from 0 to 1 indicating how much of the target orientation to blend in. A value of 0 will not change the node's orientation at all, whereas 1 will fully blend to the target orientation.
-function Model:setNodeOrientation(index, orientation, blend) end
+function Model:setNodeOrientation(index, angle, ax, ay, az, blend) end
---
---Sets or blends the pose (position and orientation) of a node to a new pose.
---
+---This sets the local pose of the node, relative to its parent.
+---
+---The scale will remain unchanged.
+---
+---@overload fun(self: lovr.Model, name: string, x: number, y: number, z: number, angle: number, ax: number, ay: number, az: number, blend?: number)
+---@overload fun(self: lovr.Model, index: number, position: lovr.Vec3, orientation: lovr.Quat, blend?: number)
---@overload fun(self: lovr.Model, name: string, position: lovr.Vec3, orientation: lovr.Quat, blend?: number)
---@param index number # The index of the node.
----@param position lovr.Vec3 # The target position. Can also be provided as 3 numbers.
----@param orientation lovr.Quat # The target orientation. Can also be provided as 4 numbers in angle-axis form.
+---@param x number # The x component of the position.
+---@param y number # The y component of the position.
+---@param z number # The z component of the position.
+---@param angle number # The number of radians the node should be rotated around its rotation axis.
+---@param ax number # The x component of the axis of rotation.
+---@param ay number # The y component of the axis of rotation.
+---@param az number # The z component of the axis of rotation.
---@param blend? number # A number from 0 to 1 indicating how much of the target pose to blend in. A value of 0 will not change the node's pose at all, whereas 1 will fully blend to the target pose.
-function Model:setNodePose(index, position, orientation, blend) end
+function Model:setNodePose(index, x, y, z, angle, ax, ay, az, blend) end
---
----Sets or blends the position of a node to a new position.
+---Sets or blends the position of a node.
---
+---This sets the local position of the node, relative to its parent.
+---
+---@overload fun(self: lovr.Model, name: string, x: number, y: number, z: number, blend?: number)
+---@overload fun(self: lovr.Model, index: number, position: lovr.Vec3, blend?: number)
---@overload fun(self: lovr.Model, name: string, position: lovr.Vec3, blend?: number)
---@param index number # The index of the node.
----@param position lovr.Vec3 # The target position. Can also be provided as 3 numbers.
----@param blend? number # A number from 0 to 1 indicating how much of the target position to blend in. A value of 0 will not change the node's position at all, whereas 1 will fully blend to the target position.
-function Model:setNodePosition(index, position, blend) end
+---@param x number # The x coordinate of the new position.
+---@param y number # The y coordinate of the new position.
+---@param z number # The z coordinate of the new position.
+---@param blend? number # A number from 0 to 1 indicating how much of the new position to blend in. A value of 0 will not change the node's position at all, whereas 1 will fully blend to the target position.
+function Model:setNodePosition(index, x, y, z, blend) end
---
---Sets or blends the scale of a node to a new scale.
---
+---This sets the local scale of the node, relative to its parent.
+---
---
---### NOTE:
----For best results when animating, it's recommended to keep the 3 components of the scale the same.
+---For best results when animating, it's recommended to keep the 3 scale components the same.
---
+---@overload fun(self: lovr.Model, name: string, sx: number, sy: number, sz: number, blend?: number)
+---@overload fun(self: lovr.Model, index: number, scale: lovr.Vec3, blend?: number)
---@overload fun(self: lovr.Model, name: string, scale: lovr.Vec3, blend?: number)
---@param index number # The index of the node.
----@param scale lovr.Vec3 # The target scale. Can also be provided as 3 numbers.
----@param blend? number # A number from 0 to 1 indicating how much of the target scale to blend in. A value of 0 will not change the node's scale at all, whereas 1 will fully blend to the target scale.
-function Model:setNodeScale(index, scale, blend) end
+---@param sx number # The x scale.
+---@param sy number # The y scale.
+---@param sz number # The z scale.
+---@param blend? number # A number from 0 to 1 indicating how much of the new scale to blend in. A value of 0 will not change the node's scale at all, whereas 1 will fully blend to the target scale.
+function Model:setNodeScale(index, sx, sy, sz, blend) end
---
---Sets or blends the transform of a node to a new transform.
---
+---This sets the local transform of the node, relative to its parent.
+---
---
---### NOTE:
---For best results when animating, it's recommended to keep the 3 components of the scale the same.
---
+---Even though the translation, scale, and rotation parameters are given in TSR order, they are applied in the normal TRS order.
+---
+---@overload fun(self: lovr.Model, name: string, x: number, y: number, z: number, sx: number, sy: number, sz: number, angle: number, ax: number, ay: number, az: number, blend?: number)
+---@overload fun(self: lovr.Model, index: number, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, blend?: number)
+---@overload fun(self: lovr.Model, name: string, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, blend?: number)
+---@overload fun(self: lovr.Model, index: number, transform: lovr.Mat4, blend?: number)
---@overload fun(self: lovr.Model, name: string, transform: lovr.Mat4, blend?: number)
---@param index number # The index of the node.
----@param transform lovr.Mat4 # The target transform. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers, with 3 scale components.
+---@param x number # The x component of the position.
+---@param y number # The y component of the position.
+---@param z number # The z component of the position.
+---@param sx number # The x component of the scale.
+---@param sy number # The y component of the scale.
+---@param sz number # The z component of the scale.
+---@param angle number # The number of radians the node should be rotated around its rotation axis.
+---@param ax number # The x component of the axis of rotation.
+---@param ay number # The y component of the axis of rotation.
+---@param az number # The z component of the axis of rotation.
---@param blend? number # A number from 0 to 1 indicating how much of the target transform to blend in. A value of 0 will not change the node's transform at all, whereas 1 will fully blend to the target transform.
-function Model:setNodeTransform(index, transform, blend) end
+function Model:setNodeTransform(index, x, y, z, sx, sy, sz, angle, ax, ay, az, blend) end
---
---Pass objects are used to record commands for the GPU.
@@ -1509,9 +1563,20 @@ function Pass:blit(src, dst, srcx, srcy, srcz, dstx, dsty, dstz, srcw, srch, src
---
---This is like `Pass:cube`, except it takes 3 separate values for the scale.
---
----@param transform lovr.Mat4 # The transform of the box. Can also be provided as position, 3-component scale, and rotation using a mix of `Vectors` or numbers.
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, size: lovr.Vec3, orientation: lovr.Quat, style?: lovr.DrawStyle)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle)
+---@param x? number # The x coordinate of the center of the box.
+---@param y? number # The y coordinate of the center of the box.
+---@param z? number # The z coordinate of the center of the box.
+---@param width? number # The width of the box.
+---@param height? number # The height of the box.
+---@param depth? number # The depth of the box.
+---@param angle? number # The rotation of the box around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param style? lovr.DrawStyle # Whether the box should be drawn filled or outlined.
-function Pass:box(transform, style) end
+function Pass:box(x, y, z, width, height, depth, angle, ax, ay, az, style) end
---
---Draws a capsule.
@@ -1524,10 +1589,20 @@ function Pass:box(transform, style) end
---
---The local origin of the capsule is in the center, and the local z axis points towards the end caps.
---
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, segments?: number)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, segments?: number)
---@overload fun(self: lovr.Pass, p1: lovr.Vec3, p2: lovr.Vec3, radius?: number, segments?: number)
----@param transform lovr.Mat4 # The transform of the capsule. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the length. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the length.
+---@param x? number # The x coordinate of the center of the capsule.
+---@param y? number # The y coordinate of the center of the capsule.
+---@param z? number # The z coordinate of the center of the capsule.
+---@param radius? number # The radius of the capsule.
+---@param length? number # The length of the capsule.
+---@param angle? number # The rotation of the capsule around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param segments? number # The number of circular segments to render.
-function Pass:capsule(transform, segments) end
+function Pass:capsule(x, y, z, radius, length, angle, ax, ay, az, segments) end
---
---Draws a circle.
@@ -1536,14 +1611,23 @@ function Pass:capsule(transform, segments) end
---### NOTE:
---The local origin of the circle is in its center.
---
----The local z axis is perpendicular to plane of the circle.
----
----@param transform lovr.Mat4 # The transform of the circle. Can also be provided as position, radius, and rotation, using a mix of `Vectors` or numbers.
+---The local z axis is perpendicular to the circle.
+---
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, radius?: number, orientation: lovr.Quat, style?: lovr.DrawStyle, angle1?: number, angle2?: number, segments?: number)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle, angle1?: number, angle2?: number, segments?: number)
+---@param x? number # The x coordinate of the center of the circle.
+---@param y? number # The y coordinate of the center of the circle.
+---@param z? number # The z coordinate of the center of the circle.
+---@param radius? number # The radius of the circle.
+---@param angle? number # The rotation of the circle around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param style? lovr.DrawStyle # Whether the circle should be filled or outlined.
---@param angle1? number # The angle of the beginning of the arc.
---@param angle2? number # angle of the end of the arc.
---@param segments? number # The number of segments to render.
-function Pass:circle(transform, style, angle1, angle2, segments) end
+function Pass:circle(x, y, z, radius, angle, ax, ay, az, style, angle1, angle2, segments) end
---
---Clears a Buffer or Texture.
@@ -1621,9 +1705,19 @@ function Pass:compute(x, y, z) end
---### NOTE:
---The local origin is at the center of the base of the cone, and the negative z axis points towards the tip.
---
----@param transform lovr.Mat4 # The transform of the cone. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the length. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the length.
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, segments?: number)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, segments?: number)
+---@param x? number # The x coordinate of the center of the base of the cone.
+---@param y? number # The y coordinate of the center of the base of the cone.
+---@param z? number # The z coordinate of the center of the base of the cone.
+---@param radius? number # The radius of the cone.
+---@param length? number # The length of the cone.
+---@param angle? number # The rotation of the cone around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param segments? number # The number of segments in the cone.
-function Pass:cone(transform, segments) end
+function Pass:cone(x, y, z, radius, length, angle, ax, ay, az, segments) end
---
---Copies data to or between `Buffer` and `Texture` objects.
@@ -1649,9 +1743,18 @@ function Pass:copy(table, bufferdst, srcindex, dstindex, count) end
---### NOTE:
---The local origin is in the center of the cube.
---
----@param transform lovr.Mat4 # The transform of the cube. Can also be provided as position, 1-component scale, and rotation using a mix of `Vectors` or numbers.
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, size?: number, orientation: lovr.Quat, style?: lovr.DrawStyle)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle)
+---@param x? number # The x coordinate of the center of the cube.
+---@param y? number # The y coordinate of the center of the cube.
+---@param z? number # The z coordinate of the center of the cube.
+---@param size? number # The size of the cube.
+---@param angle? number # The rotation of the cube around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param style? lovr.DrawStyle # Whether the cube should be drawn filled or outlined.
-function Pass:cube(transform, style) end
+function Pass:cube(x, y, z, size, angle, ax, ay, az, style) end
---
---Draws a cylinder.
@@ -1660,24 +1763,45 @@ function Pass:cube(transform, style) end
---### NOTE:
---The local origin is in the center of the cylinder, and the length of the cylinder is along the z axis.
---
----@overload fun(self: lovr.Pass, p1: lovr.Vec3, p2: lovr.Vec3, radius: number, capped?: boolean, angle1?: number, angle2?: number, segments?: number)
----@param transform lovr.Mat4 # The transform of the cylinder. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the length. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the length.
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, capped?: boolean, angle1?: number, angle2?: number, segments?: number)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, capped?: boolean, angle1?: number, angle2?: number, segments?: number)
+---@overload fun(self: lovr.Pass, p1: lovr.Vec3, p2: lovr.Vec3, radius?: number, capped?: boolean, angle1?: number, angle2?: number, segments?: number)
+---@param x? number # The x coordinate of the center of the cylinder.
+---@param y? number # The y coordinate of the center of the cylinder.
+---@param z? number # The z coordinate of the center of the cylinder.
+---@param radius? number # The radius of the cylinder.
+---@param length? number # The length of the cylinder.
+---@param angle? number # The rotation of the cylinder around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param capped? boolean # Whether the tops and bottoms of the cylinder should be rendered.
---@param angle1? number # The angle of the beginning of the arc.
---@param angle2? number # angle of the end of the arc.
---@param segments? number # The number of circular segments to render.
-function Pass:cylinder(transform, capped, angle1, angle2, segments) end
+function Pass:cylinder(x, y, z, radius, length, angle, ax, ay, az, capped, angle1, angle2, segments) end
---
---Draws a model.
---
+---@overload fun(self: lovr.Pass, model: lovr.Model, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, nodeindex?: number, children?: boolean, instances?: number)
+---@overload fun(self: lovr.Pass, model: lovr.Model, transform: lovr.Mat4, nodeindex?: number, children?: boolean, instances?: number)
+---@overload fun(self: lovr.Pass, model: lovr.Model, x?: number, y?: number, z?: number, scale?: number, angle?: number, ax?: number, ay?: number, az?: number, nodename?: string, children?: boolean, instances?: number)
+---@overload fun(self: lovr.Pass, model: lovr.Model, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, nodename?: string, children?: boolean, instances?: number)
---@overload fun(self: lovr.Pass, model: lovr.Model, transform: lovr.Mat4, nodename?: string, children?: boolean, instances?: number)
---@param model lovr.Model # The model to draw.
----@param transform lovr.Mat4 # The transform of the model. Can also be provided as a position, 1-component scale, and rotation using a combination of `Vectors` and numbers.
+---@param x? number # The x coordinate to draw the model at.
+---@param y? number # The y coordinate to draw the model at.
+---@param z? number # The z coordinate to draw the model at.
+---@param scale? number # The scale of the model.
+---@param angle? number # The rotation of the model around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param nodeindex? number # The index of the node to draw. If nil, the root node is drawn.
---@param children? boolean # Whether the children of the node should be drawn.
---@param instances? number # The number of instances to draw.
-function Pass:draw(model, transform, nodeindex, children, instances) end
+function Pass:draw(model, x, y, z, scale, angle, ax, ay, az, nodeindex, children, instances) end
---
---Draws a fullscreen triangle.
@@ -1823,21 +1947,31 @@ function Pass:line(x1, y1, z1, x2, y2, z2, ...) end
---
---It can be used to reorder, reuse, or omit vertices from the mesh.
---
+---When drawing without a vertex buffer, the `VertexIndex` variable can be used in shaders to compute the position of each vertex, possibly by reading data from other `Buffer` or `Texture` resources.
+---
---The active `MeshMode` controls whether the vertices are drawn as points, lines, or triangles.
---
---The active `Material` is applied to the mesh.
---
+---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, position: lovr.Vec3, scales: lovr.Vec3, orientation: lovr.Quat, start?: number, count?: number, instances?: number)
+---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, transform: lovr.Mat4, start?: number, count?: number, instances?: number)
+---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, x?: number, y?: number, z?: number, scale?: number, angle?: number, ax?: number, ay?: number, az?: number, start?: number, count?: number, instances?: number, base?: number)
+---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, position: lovr.Vec3, scales: lovr.Vec3, orientation: lovr.Quat, start?: number, count?: number, instances?: number, base?: number)
---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, transform: lovr.Mat4, start?: number, count?: number, instances?: number, base?: number)
---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, draws: lovr.Buffer, drawcount: number, offset: number, stride: number)
----@overload fun(self: lovr.Pass, vertexcount: number, transform: lovr.Mat4)
----@overload fun(self: lovr.Pass, vertexcount: number, indices: lovr.Buffer, transform: lovr.Mat4)
---@param vertices? lovr.Buffer # The buffer containing the vertices to draw.
----@param transform lovr.Mat4 # The transform to apply to the mesh. Can also be provided as a position, 1-component scale, and rotation using a combination of `Vectors` and numbers.
+---@param x? number # The x coordinate of the position to draw the mesh at.
+---@param y? number # The y coordinate of the position to draw the mesh at.
+---@param z? number # The z coordinate of the position to draw the mesh at.
+---@param scale? number # The scale of the mesh.
+---@param angle? number # The number of radians the mesh is rotated around its rotational axis.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param start? number # The 1-based index of the first vertex to render from the vertex buffer (or the first index, when using an index buffer).
---@param count? number # The number of vertices to render (or the number of indices, when using an index buffer). When `nil`, as many vertices or indices as possible will be drawn (based on the length of the Buffers and `start`).
---@param instances? number # The number of copies of the mesh to render.
----@param base? number # A base offset to apply to vertex indices.
-function Pass:mesh(vertices, transform, start, count, instances, base) end
+function Pass:mesh(vertices, x, y, z, scale, angle, ax, ay, az, start, count, instances) end
---
---Generates mipmaps for a texture.
@@ -1859,11 +1993,21 @@ function Pass:origin() end
---
---Draws a plane.
---
----@param transform lovr.Mat4 # The transform of the plane. Can also be provided as a position, 2-component scale, and rotation using a combination of `Vectors`, and numbers.
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, size: lovr.Vec2, orientation: lovr.Quat, style?: lovr.DrawStyle, columns?: number, rows?: number)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle, columns?: number, rows?: number)
+---@param x? number # The x coordinate of the center of the plane.
+---@param y? number # The y coordinate of the center of the plane.
+---@param z? number # The z coordinate of the center of the plane.
+---@param width? number # The width of the plane.
+---@param height? number # The height of the plane.
+---@param angle? number # The rotation of the plane around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param style? lovr.DrawStyle # Whether the plane should be drawn filled or outlined.
---@param columns? number # The number of horizontal segments in the plane.
---@param rows? number # The number of vertical segments in the plane.
-function Pass:plane(transform, style, columns, rows) end
+function Pass:plane(x, y, z, width, height, angle, ax, ay, az, style, columns, rows) end
---
---Draws points.
@@ -1930,14 +2074,21 @@ function Pass:read(buffer, index, count) end
---
---Rotates the coordinate system.
---
----@param rotation lovr.Quat # A quaternion containing the rotation to apply. Can also be provided as 4 numbers in angle-axis representation.
-function Pass:rotate(rotation) end
+---@overload fun(self: lovr.Pass, rotation: lovr.Quat)
+---@param angle number # The amount to rotate the coordinate system by, in radians.
+---@param ax number # The x component of the axis of rotation.
+---@param ay number # The y component of the axis of rotation.
+---@param az number # The z component of the axis of rotation.
+function Pass:rotate(angle, ax, ay, az) end
---
---Scales the coordinate system.
---
----@param scale lovr.Vec3 # The scale to apply to the coordinate system. Can also be provided as 1 or 3 numbers.
-function Pass:scale(scale) end
+---@overload fun(self: lovr.Pass, scale: lovr.Vec3)
+---@param sx number # The x component of the scale.
+---@param sy number # The y component of the scale.
+---@param sz number # The z component of the scale.
+function Pass:scale(sx, sy, sz) end
---
---Sends a value to a variable in the Pass's active `Shader`.
@@ -1957,12 +2108,14 @@ function Pass:scale(scale) end
---@overload fun(self: lovr.Pass, name: string, texture: lovr.Texture)
---@overload fun(self: lovr.Pass, name: string, sampler: lovr.Sampler)
---@overload fun(self: lovr.Pass, name: string, constant: any)
----@overload fun(self: lovr.Pass, binding: number, buffer: lovr.Buffer)
+---@overload fun(self: lovr.Pass, binding: number, buffer: lovr.Buffer, offset?: number, extent?: number)
---@overload fun(self: lovr.Pass, binding: number, texture: lovr.Texture)
---@overload fun(self: lovr.Pass, binding: number, sampler: lovr.Sampler)
---@param name string # The name of the Shader variable.
---@param buffer lovr.Buffer # The Buffer to assign.
-function Pass:send(name, buffer) end
+---@param offset? number # An offset from the start of the buffer where data will be read, in bytes.
+---@param extent? number # The number of bytes that will be available for reading. If zero, as much data as possible will be bound, depending on the offset, buffer size, and the `uniformBufferRange` or `storageBufferRange` limit.
+function Pass:send(name, buffer, offset, extent) end
---
---Sets whether alpha to coverage is enabled.
@@ -2226,6 +2379,10 @@ function Pass:setShader(shader) end
---### NOTE:
---The stencil test is disabled by default.
---
+---Setting the stencil test requires the `Pass` to have a depth texture with the `d24s8` or `d32fs8` format (the `s` means "stencil").
+---
+---The `t.graphics.stencil` and `t.headset.stencil` flags in `lovr.conf` can be used to request a stencil format for the default window and headset passes, respectively.
+---
---@overload fun(self: lovr.Pass)
---@param test lovr.CompareMode # The new stencil test to use.
---@param value number # The stencil value to compare against.
@@ -2241,6 +2398,10 @@ function Pass:setStencilTest(test, value, mask) end
---### NOTE:
---By default, stencil writes are disabled.
---
+---Setting the stencil test requires the `Pass` to have a depth texture with the `d24s8` or `d32fs8` format (the `s` means "stencil").
+---
+---The `t.graphics.stencil` and `t.headset.stencil` flags in `lovr.conf` can be used to request a stencil format for the default window and headset passes, respectively.
+---
---@overload fun(self: lovr.Pass, actions: table, value?: number, mask?: number)
---@overload fun(self: lovr.Pass)
---@param action lovr.StencilAction # How pixels drawn will update the stencil buffer.
@@ -2259,6 +2420,7 @@ function Pass:setStencilWrite(action, value, mask) end
---
---These view poses are also available using `lovr.headset.getViewPose`.
---
+---@overload fun(self: lovr.Pass, view: number, position: lovr.Vec3, orientation: lovr.Quat)
---@overload fun(self: lovr.Pass, view: number, matrix: lovr.Mat4, inverted: boolean)
---@param view number # The index of the view to update.
---@param x number # The x position of the viewer, in meters.
@@ -2343,10 +2505,19 @@ function Pass:skybox(skybox) end
---### NOTE:
---The local origin of the sphere is in its center.
---
----@param transform lovr.Mat4 # The transform of the sphere. Can also be provided as a position, radius, and rotation using a mix of `Vectors and numbers.'
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, radius?: number, orientation: lovr.Quat, longitudes?: number, latitudes?: number)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, longitudes?: number, latitudes?: number)
+---@param x? number # The x coordinate of the center of the sphere.
+---@param y? number # The y coordinate of the center of the sphere.
+---@param z? number # The z coordinate of the center of the sphere.
+---@param radius? number # The radius of the sphere.
+---@param angle? number # The rotation of the sphere around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param longitudes? number # The number of "horizontal" segments.
---@param latitudes? number # The number of "vertical" segments.
-function Pass:sphere(transform, longitudes, latitudes) end
+function Pass:sphere(x, y, z, radius, angle, ax, ay, az, longitudes, latitudes) end
---
---Draws text.
@@ -2373,13 +2544,24 @@ function Pass:sphere(transform, longitudes, latitudes) end
---
---This function can draw up to 16384 visible characters at a time, and will currently throw an error if the string is too long.
---
+---@overload fun(self: lovr.Pass, text: string, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign)
+---@overload fun(self: lovr.Pass, text: string, transform: lovr.Mat4, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign)
+---@overload fun(self: lovr.Pass, colortext: table, x?: number, y?: number, z?: number, scale?: number, angle?: number, ax?: number, ay?: number, az?: number, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign)
+---@overload fun(self: lovr.Pass, colortext: table, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign)
---@overload fun(self: lovr.Pass, colortext: table, transform: lovr.Mat4, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign)
---@param text string # The text to render.
----@param transform lovr.Mat4 # The transform of the text. Can also be provided as position, 1-component scale, and rotation using a mix of `Vectors` or numbers.
+---@param x? number # The x coordinate of the text origin.
+---@param y? number # The y coordinate of the text origin.
+---@param z? number # The z coordinate of the text origin.
+---@param scale? number # The scale of the text (with the default pixel density, units are meters).
+---@param angle? number # The rotation of the text around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param wrap? number # The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap.
----@param halign? lovr.HorizontalAlign # The horizontal alignment.
----@param valign? lovr.VerticalAlign # The vertical alignment.
-function Pass:text(text, transform, wrap, halign, valign) end
+---@param halign? lovr.HorizontalAlign # The horizontal alignment relative to the text origin.
+---@param valign? lovr.VerticalAlign # The vertical alignment relative to the text origin.
+function Pass:text(text, x, y, z, scale, angle, ax, ay, az, wrap, halign, valign) end
---
---Starts a GPU measurement.
@@ -2416,16 +2598,37 @@ function Pass:tock(tally, slot) end
---### NOTE:
---The local origin is in the center of the torus, and the torus forms a circle around the local Z axis.
---
----@param transform lovr.Mat4 # The transform of the torus. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the thickness. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the thickness.
+---@overload fun(self: lovr.Pass, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, tsegments?: number, psegments?: number)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4, tsegments?: number, psegments?: number)
+---@param x? number # The x coordinate of the center of the torus.
+---@param y? number # The y coordinate of the center of the torus.
+---@param z? number # The z coordinate of the center of the torus.
+---@param radius? number # The radius of the torus.
+---@param thickness? number # The thickness of the torus.
+---@param angle? number # The rotation of the torus around its rotation axis, in radians.
+---@param ax? number # The x component of the axis of rotation.
+---@param ay? number # The y component of the axis of rotation.
+---@param az? number # The z component of the axis of rotation.
---@param tsegments? number # The number of toroidal (circular) segments to render.
---@param psegments? number # The number of poloidal (tubular) segments to render.
-function Pass:torus(transform, tsegments, psegments) end
+function Pass:torus(x, y, z, radius, thickness, angle, ax, ay, az, tsegments, psegments) end
---
---Transforms the coordinate system.
---
----@param transform lovr.Mat4 # A matrix containing the transformation to apply to the coordinate system. Can also be provided as a position, 3-component scale, and rotation, using a mix of `Vectors` or numbers.
-function Pass:transform(transform) end
+---@overload fun(self: lovr.Pass, translation: lovr.Vec3, scale: lovr.Vec3, rotation: lovr.Quat)
+---@overload fun(self: lovr.Pass, transform: lovr.Mat4)
+---@param x number # The x component of the translation.
+---@param y number # The y component of the translation.
+---@param z number # The z component of the translation.
+---@param sx number # The x component of the scale.
+---@param sy number # The y component of the scale.
+---@param sz number # The z component of the scale.
+---@param angle number # The amount to rotate the coordinate system by, in radians.
+---@param ax number # The x component of the axis of rotation.
+---@param ay number # The y component of the axis of rotation.
+---@param az number # The z component of the axis of rotation.
+function Pass:transform(x, y, z, sx, sy, sz, angle, ax, ay, az) end
---
---Translates the coordinate system.
@@ -2434,8 +2637,11 @@ function Pass:transform(transform) end
---### NOTE:
---Order matters when scaling, translating, and rotating the coordinate system.
---
----@param translation lovr.Vec3 # The translation to apply to the coordinate system. Can also be provided as 3 numbers.
-function Pass:translate(translation) end
+---@overload fun(self: lovr.Pass, translation: lovr.Vec3)
+---@param x number # The x component of the translation.
+---@param y number # The y component of the translation.
+---@param z number # The z component of the translation.
+function Pass:translate(x, y, z) end
---
---Readbacks track the progress of an asynchronous read of a `Buffer`, `Texture`, or `Tally`.
diff --git a/meta/3rd/lovr/library/lovr/math.lua b/meta/3rd/lovr/library/lovr/math.lua
index 1b3a401d..e3aa426a 100644
--- a/meta/3rd/lovr/library/lovr/math.lua
+++ b/meta/3rd/lovr/library/lovr/math.lua
@@ -61,6 +61,7 @@ function lovr.math.mat4() end
---
---Creates a new `Curve` from a list of control points.
---
+---@overload fun(v: lovr.Vec3, ...):lovr.Curve
---@overload fun(points: table):lovr.Curve
---@overload fun(n: number):lovr.Curve
---@param x number # The x coordinate of the first control point.
@@ -491,8 +492,10 @@ function Mat4:scale(scale) end
---Sets the components of the matrix from separate position, rotation, and scale arguments or an existing matrix.
---
---@overload fun(self: lovr.Mat4, n: lovr.mat4):lovr.Mat4
----@overload fun(self: lovr.Mat4, position?: lovr.Vec3, scale?: lovr.Vec3, rotation?: lovr.Quat):lovr.Mat4
----@overload fun(self: lovr.Mat4, position?: lovr.Vec3, rotation?: lovr.Quat):lovr.Mat4
+---@overload fun(self: lovr.Mat4, x: number, y: number, z: number, sx: number, sy: number, sz: number, angle: number, ax: number, ay: number, az: number):lovr.Mat4
+---@overload fun(self: lovr.Mat4, x: number, y: number, z: number, angle: number, ax: number, ay: number, az: number):lovr.Mat4
+---@overload fun(self: lovr.Mat4, position: lovr.Vec3, scale: lovr.Vec3, rotation: lovr.Quat):lovr.Mat4
+---@overload fun(self: lovr.Mat4, position: lovr.Vec3, rotation: lovr.Quat):lovr.Mat4
---@overload fun(self: lovr.Mat4, ...):lovr.Mat4
---@overload fun(self: lovr.Mat4, d: number):lovr.Mat4
---@return lovr.Mat4 m # The input matrix.
diff --git a/meta/3rd/lovr/library/lovr/physics.lua b/meta/3rd/lovr/library/lovr/physics.lua
index 4563a328..6d635c2b 100644
--- a/meta/3rd/lovr/library/lovr/physics.lua
+++ b/meta/3rd/lovr/library/lovr/physics.lua
@@ -15,6 +15,7 @@ lovr.physics = {}
---
---It tries to keep the distance between the colliders and the anchor position the same, but does not constrain the angle between them.
---
+---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, anchor: lovr.Vec3):lovr.BallJoint
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param x number # The x position of the joint anchor point, in world coordinates.
@@ -73,6 +74,7 @@ function lovr.physics.newCylinderShape(radius, length) end
---
---The joint allows for rotation on the anchor points.
---
+---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, first: lovr.Vec3, second: lovr.Vec3):lovr.DistanceJoint
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param x1 number # The x position of the first anchor point, in world coordinates.
@@ -91,14 +93,15 @@ function lovr.physics.newDistanceJoint(colliderA, colliderB, x1, y1, z1, x2, y2,
---### NOTE:
---A hinge joint constrains two colliders to allow rotation only around the hinge's axis.
---
+---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, anchor: lovr.Vec3, axis: lovr.Vec3):lovr.HingeJoint
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param x number # The x position of the hinge anchor, in world coordinates.
---@param y number # The y position of the hinge anchor, in world coordinates.
---@param z number # The z position of the hinge anchor, in world coordinates.
----@param ax number # The x component of the hinge axis.
----@param ay number # The y component of the hinge axis.
----@param az number # The z component of the hinge axis.
+---@param ax number # The x component of the hinge axis direction.
+---@param ay number # The y component of the hinge axis direction.
+---@param az number # The z component of the hinge axis direction.
---@return lovr.HingeJoint hinge # The new HingeJoint.
function lovr.physics.newHingeJoint(colliderA, colliderB, x, y, z, ax, ay, az) end
@@ -122,6 +125,7 @@ function lovr.physics.newMeshShape(vertices, indices) end
---### NOTE:
---A slider joint constrains two colliders to only allow movement along the slider's axis.
---
+---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, axis: lovr.Vec3):lovr.SliderJoint
---@param colliderA lovr.Collider # The first collider to attach the Joint to.
---@param colliderB lovr.Collider # The second collider to attach the Joint to.
---@param ax number # The x component of the slider axis.
@@ -211,6 +215,7 @@ function BallJoint:getTightness() end
---
---Sets a new anchor point for the BallJoint.
---
+---@overload fun(self: lovr.BallJoint, anchor: lovr.Vec3)
---@param x number # The x coordinate of the anchor point, in world coordinates.
---@param y number # The y coordinate of the anchor point, in world coordinates.
---@param z number # The z coordinate of the anchor point, in world coordinates.
@@ -308,6 +313,8 @@ function Collider:addShape(shape) end
---If the Collider is asleep, it will need to be woken up with `Collider:setAwake` for this function to have any affect.
---
---@overload fun(self: lovr.Collider, x: number, y: number, z: number, px: number, py: number, pz: number)
+---@overload fun(self: lovr.Collider, force: lovr.Vec3)
+---@overload fun(self: lovr.Collider, force: lovr.Vec3, position: lovr.Vec3)
---@param x number # The x component of the force to apply.
---@param y number # The y component of the force to apply.
---@param z number # The z component of the force to apply.
@@ -320,6 +327,7 @@ function Collider:applyForce(x, y, z) end
---### NOTE:
---If the Collider is asleep, it will need to be woken up with `Collider:setAwake` for this function to have any effect.
---
+---@overload fun(self: lovr.Collider, torque: lovr.Vec3)
---@param x number # The x component of the torque.
---@param y number # The y component of the torque.
---@param z number # The z component of the torque.
@@ -414,6 +422,7 @@ function Collider:getLinearVelocity() end
---
---Returns the linear velocity of a point relative to the Collider.
---
+---@overload fun(self: lovr.Collider, point: number):number, number, number
---@param x number # The x coordinate.
---@param y number # The y coordinate.
---@param z number # The z coordinate.
@@ -425,6 +434,7 @@ function Collider:getLinearVelocityFromLocalPoint(x, y, z) end
---
---Returns the linear velocity of a point on the Collider specified in world space.
---
+---@overload fun(self: lovr.Collider, point: lovr.Vec3):number, number, number
---@param x number # The x coordinate in world space.
---@param y number # The y coordinate in world space.
---@param z number # The z coordinate in world space.
@@ -444,6 +454,7 @@ function Collider:getLocalCenter() end
---
---Converts a point from world coordinates into local coordinates relative to the Collider.
---
+---@overload fun(self: lovr.Collider, point: lovr.Vec3):number, number, number
---@param wx number # The x coordinate of the world point.
---@param wy number # The y coordinate of the world point.
---@param wz number # The z coordinate of the world point.
@@ -455,6 +466,7 @@ function Collider:getLocalPoint(wx, wy, wz) end
---
---Converts a direction vector from world space to local space.
---
+---@overload fun(self: lovr.Collider, vector: lovr.Vec3):number, number, number
---@param wx number # The x component of the world vector.
---@param wy number # The y component of the world vector.
---@param wz number # The z component of the world vector.
@@ -559,6 +571,7 @@ function Collider:getWorld() end
---
---Convert a point relative to the collider to a point in world coordinates.
---
+---@overload fun(self: lovr.Collider, point: lovr.Vec3):number, number, number
---@param x number # The x position of the point.
---@param y number # The y position of the point.
---@param z number # The z position of the point.
@@ -570,6 +583,7 @@ function Collider:getWorldPoint(x, y, z) end
---
---Converts a direction vector from local space to world space.
---
+---@overload fun(self: lovr.Collider, vector: lovr.Vec3):number, number, number
---@param x number # The x coordinate of the local vector.
---@param y number # The y coordinate of the local vector.
---@param z number # The z coordinate of the local vector.
@@ -642,6 +656,7 @@ function Collider:setAngularDamping(damping, threshold) end
---
---Sets the angular velocity of the Collider.
---
+---@overload fun(self: lovr.Collider, velocity: lovr.Vec3)
---@param vx number # The x component of the angular velocity.
---@param vy number # The y component of the angular velocity.
---@param vz number # The z component of the angular velocity.
@@ -703,6 +718,7 @@ function Collider:setLinearDamping(damping, threshold) end
---
---Usually it's preferred to use `Collider:applyForce` to change velocity since instantaneous velocity changes can lead to weird glitches.
---
+---@overload fun(self: lovr.Collider, velocity: lovr.Vec3)
---@param vx number # The x velocity of the Collider, in meters per second.
---@param vy number # The y velocity of the Collider, in meters per second.
---@param vz number # The z velocity of the Collider, in meters per second.
@@ -727,6 +743,7 @@ function Collider:setMassData(cx, cy, cz, mass, inertia) end
---
---Sets the orientation of the Collider in angle/axis representation.
---
+---@overload fun(self: lovr.Collider, orientation: lovr.Quat)
---@param angle number # The number of radians the Collider is rotated around its axis of rotation.
---@param ax number # The x component of the axis of rotation.
---@param ay number # The y component of the axis of rotation.
@@ -736,6 +753,7 @@ function Collider:setOrientation(angle, ax, ay, az) end
---
---Sets the position and orientation of the Collider.
---
+---@overload fun(self: lovr.Collider, position: lovr.Vec3, orientation: lovr.Quat)
---@param x number # The x position of the Collider, in meters.
---@param y number # The y position of the Collider, in meters.
---@param z number # The z position of the Collider, in meters.
@@ -748,6 +766,7 @@ function Collider:setPose(x, y, z, angle, ax, ay, az) end
---
---Sets the position of the Collider.
---
+---@overload fun(self: lovr.Collider, position: lovr.Vec3)
---@param x number # The x position of the Collider, in meters.
---@param y number # The y position of the Collider, in meters.
---@param z number # The z position of the Collider, in meters.
@@ -873,6 +892,7 @@ function DistanceJoint:getTightness() end
---
---Sets the anchor points of the DistanceJoint.
---
+---@overload fun(self: lovr.DistanceJoint, first: lovr.Vec3, second: lovr.Vec3)
---@param x1 number # The x coordinate of the first anchor point, in world coordinates.
---@param y1 number # The y coordinate of the first anchor point, in world coordinates.
---@param z1 number # The z coordinate of the first anchor point, in world coordinates.
@@ -966,6 +986,7 @@ function HingeJoint:getUpperLimit() end
---
---Sets a new anchor point for the HingeJoint.
---
+---@overload fun(self: lovr.HingeJoint, anchor: lovr.Vec3)
---@param x number # The x coordinate of the anchor point, in world coordinates.
---@param y number # The y coordinate of the anchor point, in world coordinates.
---@param z number # The z coordinate of the anchor point, in world coordinates.
@@ -974,6 +995,7 @@ function HingeJoint:setAnchor(x, y, z) end
---
---Sets the axis of the hinge.
---
+---@overload fun(self: lovr.HingeJoint, axis: lovr.Vec3)
---@param x number # The x component of the axis.
---@param y number # The y component of the axis.
---@param z number # The z component of the axis.
@@ -1179,6 +1201,7 @@ function Shape:setEnabled(enabled) end
---### NOTE:
---If the Shape isn't attached to a Collider, this will error.
---
+---@overload fun(self: lovr.Shape, orientation: lovr.Quat)
---@param angle number # The number of radians the Shape is rotated.
---@param ax number # The x component of the rotation axis.
---@param ay number # The y component of the rotation axis.
@@ -1192,6 +1215,7 @@ function Shape:setOrientation(angle, ax, ay, az) end
---### NOTE:
---If the Shape isn't attached to a Collider, this will error.
---
+---@overload fun(self: lovr.Shape, position: lovr.Vec3)
---@param x number # The x offset.
---@param y number # The y offset.
---@param z number # The z offset.
@@ -1257,6 +1281,7 @@ function SliderJoint:getUpperLimit() end
---
---Sets the axis of the slider.
---
+---@overload fun(self: lovr.SliderJoint, axis: lovr.Vec3)
---@param x number # The x component of the axis.
---@param y number # The y component of the axis.
---@param z number # The z component of the axis.
@@ -1503,6 +1528,7 @@ function World:isSleepingAllowed() end
---
---Adds a new Collider to the World with a BoxShape already attached.
---
+---@overload fun(self: lovr.World, position: lovr.Vec3, size: lovr.Vec3):lovr.Collider
---@param x? number # The x coordinate of the center of the box.
---@param y? number # The y coordinate of the center of the box.
---@param z? number # The z coordinate of the center of the box.
@@ -1515,9 +1541,10 @@ function World:newBoxCollider(x, y, z, width, height, depth) end
---
---Adds a new Collider to the World with a CapsuleShape already attached.
---
----@param x? number # The x coordinate of the center of the capsule.
----@param y? number # The y coordinate of the center of the capsule.
----@param z? number # The z coordinate of the center of the capsule.
+---@overload fun(self: lovr.World, position: lovr.Vec3, radius?: number, length?: number):lovr.Collider
+---@param x? number # The x coordinate of the center of the capsule, in meters.
+---@param y? number # The y coordinate of the center of the capsule, in meters.
+---@param z? number # The z coordinate of the center of the capsule, in meters.
---@param radius? number # The radius of the capsule, in meters.
---@param length? number # The length of the capsule, not including the caps, in meters.
---@return lovr.Collider collider # The new Collider.
@@ -1537,6 +1564,7 @@ function World:newCapsuleCollider(x, y, z, radius, length) end
---- `World:newCylinderCollider`
---- `World:newSphereCollider`
---
+---@overload fun(self: lovr.World, position: lovr.Vec3):lovr.Collider
---@param x? number # The x position of the Collider.
---@param y? number # The y position of the Collider.
---@param z? number # The z position of the Collider.
@@ -1546,9 +1574,10 @@ function World:newCollider(x, y, z) end
---
---Adds a new Collider to the World with a CylinderShape already attached.
---
----@param x? number # The x coordinate of the center of the cylinder.
----@param y? number # The y coordinate of the center of the cylinder.
----@param z? number # The z coordinate of the center of the cylinder.
+---@overload fun(self: lovr.World, position: lovr.Vec3, radius?: number, length?: number):lovr.Collider
+---@param x? number # The x coordinate of the center of the cylinder, in meters.
+---@param y? number # The y coordinate of the center of the cylinder, in meters.
+---@param z? number # The z coordinate of the center of the cylinder, in meters.
---@param radius? number # The radius of the cylinder, in meters.
---@param length? number # The length of the cylinder, in meters.
---@return lovr.Collider collider # The new Collider.
@@ -1566,9 +1595,10 @@ function World:newMeshCollider(vertices, indices) end
---
---Adds a new Collider to the World with a SphereShape already attached.
---
----@param x? number # The x coordinate of the center of the sphere.
----@param y? number # The y coordinate of the center of the sphere.
----@param z? number # The z coordinate of the center of the sphere.
+---@overload fun(self: lovr.World, position: lovr.Vec3, radius?: number):lovr.Collider
+---@param x? number # The x coordinate of the center of the sphere, in meters.
+---@param y? number # The y coordinate of the center of the sphere, in meters.
+---@param z? number # The z coordinate of the center of the sphere, in meters.
---@param radius? number # The radius of the sphere, in meters.
---@return lovr.Collider collider # The new Collider.
function World:newSphereCollider(x, y, z, radius) end
@@ -1603,6 +1633,7 @@ function World:overlaps() end
---### NOTE:
---The callback is passed the shape that was hit, the hit position (in world coordinates), and the normal vector of the hit.
---
+---@overload fun(self: lovr.World, start: lovr.Vec3, end: lovr.Vec3, callback: function)
---@param x1 number # The x coordinate of the starting position of the ray.
---@param y1 number # The y coordinate of the starting position of the ray.
---@param z1 number # The z coordinate of the starting position of the ray.
@@ -1628,6 +1659,7 @@ function World:setAngularDamping(damping, threshold) end
---
---Sets the gravity of the World.
---
+---@overload fun(self: lovr.World, gravity: lovr.Vec3)
---@param xg number # The x component of the gravity force.
---@param yg number # The y component of the gravity force.
---@param zg number # The z component of the gravity force.
diff --git a/meta/3rd/skynet/library/skynet.lua b/meta/3rd/skynet/library/skynet.lua
index f09d996c..0e4d19dd 100644
--- a/meta/3rd/skynet/library/skynet.lua
+++ b/meta/3rd/skynet/library/skynet.lua
@@ -471,7 +471,14 @@ function skynet.stat(what)
end
---返回任务信息
----@param ret any
+---这里说的任务是指:服务发出了请求,但未收到响应,已挂起的协程
+---当参数ret的值为:
+--- nil: 返回挂起的协程数量
+--- "init": 返回 traceback(init_thread)
+--- table: 所有挂起协程的状态信息
+--- number :代表一个会话ID,显示此会话状态信息
+--- thread: 某个协程的信息
+---@param ret nil|number|table|string
function skynet.task(ret)
end
diff --git a/meta/template/string.lua b/meta/template/string.lua
index cf83104b..841654f5 100644
--- a/meta/template/string.lua
+++ b/meta/template/string.lua
@@ -5,7 +5,7 @@
string = {}
---#DES 'string.byte'
----@param s string
+---@param s string|number
---@param i? integer
---@param j? integer
---@return integer ...
@@ -27,8 +27,8 @@ function string.char(byte, ...) end
function string.dump(f, strip) end
---#DES 'string.find'
----@param s string
----@param pattern string
+---@param s string|number
+---@param pattern string|number
---@param init? integer
---@param plain? boolean
---@return integer start
@@ -38,7 +38,7 @@ function string.dump(f, strip) end
function string.find(s, pattern, init, plain) end
---#DES 'string.format'
----@param s any
+---@param s string|number
---@param ... any
---@return string
---@nodiscard
@@ -46,22 +46,22 @@ function string.format(s, ...) end
---#DES 'string.gmatch'
---#if VERSION <= 5.3 then
----@param s string
----@param pattern string
+---@param s string|number
+---@param pattern string|number
---@return fun():string, ...
---@nodiscard
function string.gmatch(s, pattern) end
---#else
----@param s string
----@param pattern string
+---@param s string|number
+---@param pattern string|number
---@param init? integer
---@return fun():string, ...
function string.gmatch(s, pattern, init) end
---#end
---#DES 'string.gsub'
----@param s string
----@param pattern string
+---@param s string|number
+---@param pattern string|number
---@param repl string|number|table|function
---@param n? integer
---@return string
@@ -70,20 +70,20 @@ function string.gmatch(s, pattern, init) end
function string.gsub(s, pattern, repl, n) end
---#DES 'string.len'
----@param s string
+---@param s string|number
---@return integer
---@nodiscard
function string.len(s) end
---#DES 'string.lower'
----@param s string
+---@param s string|number
---@return string
---@nodiscard
function string.lower(s) end
---#DES 'string.match'
----@param s string
----@param pattern string
+---@param s string|number
+---@param pattern string|number
---@param init? integer
---@return any ...
---@nodiscard
@@ -107,29 +107,29 @@ function string.packsize(fmt) end
---#if VERSION <= 5.1 and not JIT then
---#DES 'string.rep<5.1'
----@param s string
+---@param s string|number
---@param n integer
---@return string
---@nodiscard
function string.rep(s, n) end
---#else
---#DES 'string.rep>5.2'
----@param s string
+---@param s string|number
---@param n integer
----@param sep? string
+---@param sep? string|number
---@return string
---@nodiscard
function string.rep(s, n, sep) end
---#end
---#DES 'string.reverse'
----@param s string
+---@param s string|number
---@return string
---@nodiscard
function string.reverse(s) end
---#DES 'string.sub'
----@param s string
+---@param s string|number
---@param i integer
---@param j? integer
---@return string
@@ -147,7 +147,7 @@ function string.sub(s, i, j) end
function string.unpack(fmt, s, pos) end
---#DES 'string.upper'
----@param s string
+---@param s string|number
---@return string
---@nodiscard
function string.upper(s) end
diff --git a/script/cli/check.lua b/script/cli/check.lua
index ea767fae..94f34b2a 100644
--- a/script/cli/check.lua
+++ b/script/cli/check.lua
@@ -64,7 +64,7 @@ lclient():start(function (client)
disables[name] = true
end
end
- config.set(nil, 'Lua.diagnostics.disable', util.getTableKeys(disables, true))
+ config.set(rootUri, 'Lua.diagnostics.disable', util.getTableKeys(disables, true))
local uris = files.getAllUris(rootUri)
local max = #uris
diff --git a/script/cli/doc.lua b/script/cli/doc.lua
index ae821527..f94a2066 100644
--- a/script/cli/doc.lua
+++ b/script/cli/doc.lua
@@ -218,10 +218,6 @@ local function collectVars(global, results)
defines = {},
}
for _, set in ipairs(global:getSets(ws.rootUri)) do
- local uri = guide.getUri(set)
- if files.isLibrary(uri) then
- goto CONTINUE
- end
if set.type == 'setglobal'
or set.type == 'setfield'
or set.type == 'setmethod'
@@ -235,7 +231,6 @@ local function collectVars(global, results)
}
result.desc = result.desc or getDesc(set)
end
- ::CONTINUE::
end
if #result.defines == 0 then
return
@@ -250,10 +245,41 @@ local function collectVars(global, results)
end
---@async
----@param outputPath string
-function export.makeDoc(outputPath)
+---@param callback fun(i, max)
+function export.export(outputPath, callback)
local results = {}
+ local globals = vm.getAllGlobals()
+ local max = 0
+ for _ in pairs(globals) do
+ max = max + 1
+ end
+ local i = 0
+ for _, global in pairs(globals) do
+ if global.cate == 'variable' then
+ collectVars(global, results)
+ elseif global.cate == 'type' then
+ collectTypes(global, results)
+ end
+ i = i + 1
+ callback(i, max)
+ end
+
+ table.sort(results, function (a, b)
+ return a.name < b.name
+ end)
+
+ local docPath = outputPath .. '/doc.json'
+ jsonb.supportSparseArray = true
+ util.saveFile(docPath, jsonb.beautify(results))
+
+ local mdPath = doc2md.buildMD(outputPath)
+ return docPath, mdPath
+end
+
+---@async
+---@param outputPath string
+function export.makeDoc(outputPath)
ws.awaitReady(ws.rootUri)
local expandAlias = config.get(ws.rootUri, 'Lua.hover.expandAlias')
@@ -265,32 +291,11 @@ function export.makeDoc(outputPath)
await.sleep(0.1)
local prog <close> = progress.create(ws.rootUri, '正在生成文档...', 0)
- local globalTypes = vm.getGlobals 'type'
- local globalVars = vm.getGlobals 'variable'
-
- local max = #globalTypes + #globalVars
-
- for i, global in ipairs(globalTypes) do
- collectTypes(global, results)
+ local docPath, mdPath = export.export(outputPath, function (i, max)
prog:setMessage(('%d/%d'):format(i, max))
- prog:setPercentage(i / max * 100)
- end
-
- for i, global in ipairs(globalVars) do
- collectVars(global, results)
- prog:setMessage(('%d/%d'):format(i + #globalTypes, max))
- prog:setPercentage((i + #globalTypes) / max * 100)
- end
-
- table.sort(results, function (a, b)
- return a.name < b.name
+ prog:setPercentage((i) / max * 100)
end)
- local docPath = outputPath .. '/doc.json'
- jsonb.supportSparseArray = true
- util.saveFile(docPath, jsonb.beautify(results))
-
- local mdPath = doc2md.buildMD(outputPath)
return docPath, mdPath
end
@@ -313,7 +318,6 @@ function export.runCLI()
util.enableCloseFunction()
local lastClock = os.clock()
- local results = {}
---@async
lclient():start(function (client)
@@ -331,11 +335,7 @@ function export.runCLI()
ws.awaitReady(rootUri)
await.sleep(0.1)
- local globals = vm.getGlobals 'type'
-
- local max = #globals
- for i, global in ipairs(globals) do
- collectTypes(global, results)
+ local docPath, mdPath = export.export(LOGPATH, function (i, max)
if os.clock() - lastClock > 0.2 then
lastClock = os.clock()
local output = '\x0D'
@@ -346,24 +346,15 @@ function export.runCLI()
.. tostring(i) .. '/' .. tostring(max)
io.write(output)
end
- end
- io.write('\x0D')
-
- table.sort(results, function (a, b)
- return a.name < b.name
end)
- end)
-
- local docPath = LOGPATH .. '/doc.json'
- jsonb.supportSparseArray = true
- util.saveFile(docPath, jsonb.beautify(results))
- local mdPath = doc2md.buildMD(LOGPATH)
+ io.write('\x0D')
- print(lang.script('CLI_DOC_DONE'
- , ('[%s](%s)'):format(files.normalize(docPath), furi.encode(docPath))
- , ('[%s](%s)'):format(files.normalize(mdPath), furi.encode(mdPath))
- ))
+ print(lang.script('CLI_DOC_DONE'
+ , ('[%s](%s)'):format(files.normalize(docPath), furi.encode(docPath))
+ , ('[%s](%s)'):format(files.normalize(mdPath), furi.encode(mdPath))
+ ))
+ end)
end
return export
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua
index 3d322a3e..0e27e8b8 100644
--- a/script/core/semantic-tokens.lua
+++ b/script/core/semantic-tokens.lua
@@ -710,7 +710,8 @@ local function buildTokens(state, results)
local tokens = {}
local lastLine = 0
local lastStartChar = 0
- for i, source in ipairs(results) do
+ local index = 0
+ for _, source in ipairs(results) do
local startPos = source.start
local finishPos = source.finish
local line = startPos.line
@@ -719,18 +720,23 @@ local function buildTokens(state, results)
local deltaStartChar
if deltaLine == 0 then
deltaStartChar = startChar - lastStartChar
+ if deltaStartChar == 0 then
+ goto continue
+ end
else
deltaStartChar = startChar
end
lastLine = line
lastStartChar = startChar
-- see https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#textDocument_semanticTokens
- local len = i * 5 - 5
+ index = index + 1
+ local len = index * 5 - 5
tokens[len + 1] = deltaLine
tokens[len + 2] = deltaStartChar
tokens[len + 3] = finishPos.character - startPos.character -- length
tokens[len + 4] = source.type
tokens[len + 5] = source.modifieres or 0
+ ::continue::
end
return tokens
end
@@ -795,6 +801,10 @@ local function solveMultilineAndOverlapping(state, results)
for token in tokens:pairs() do
local startPos = converter.packPosition(state, token.start)
local endPos = converter.packPosition(state, token.finish)
+ if startPos.line == endPos.line
+ and startPos.character == endPos.character then
+ goto continue
+ end
if endPos.line == startPos.line
or client.getAbility 'textDocument.semanticTokens.multilineTokenSupport' then
new[#new+1] = {
@@ -827,6 +837,7 @@ local function solveMultilineAndOverlapping(state, results)
}
end
end
+ ::continue::
end
return new
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 545f9d95..2f5a8ad3 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -1501,21 +1501,22 @@ end
local function trimTailComment(text)
local comment = text
if text:sub(1, 1) == '@' then
- comment = text:sub(2)
+ comment = util.trim(text:sub(2))
end
if text:sub(1, 1) == '#' then
- comment = text:sub(2)
+ comment = util.trim(text:sub(2))
end
if text:sub(1, 2) == '--' then
- comment = text:sub(3)
+ comment = util.trim(text:sub(3))
end
- if comment:find '^%s*[\'"[]' then
+ if comment:find '^%s*[\'"[]'
+ and comment:find '[\'"%]]%s*$' then
local state = compile(comment:gsub('^%s+', ''), 'String')
if state and state.ast then
comment = state.ast[1]
end
end
- return comment
+ return util.trim(comment)
end
local function buildLuaDoc(comment)
diff --git a/script/string-merger.lua b/script/string-merger.lua
index b2a63f02..65896575 100644
--- a/script/string-merger.lua
+++ b/script/string-merger.lua
@@ -127,6 +127,10 @@ function m.getOffsetBack(info, offset)
finish = diff.finish
end
if not start or not finish then
+ if offset > diff.cstart
+ and offset < diff.cfinish then
+ return diff.finish, diff.finish
+ end
local soff = offset - diff.cstart
local pos = math.min(diff.start + soff, diff.finish)
start = start or pos
diff --git a/script/vm/operator.lua b/script/vm/operator.lua
index b2a3aa10..bc8703c6 100644
--- a/script/vm/operator.lua
+++ b/script/vm/operator.lua
@@ -73,15 +73,22 @@ local function checkOperators(operators, op, value, result)
local valueNode = vm.compileNode(value)
local expNode = vm.compileNode(operator.exp)
local uri = guide.getUri(operator)
- if not vm.isSubType(uri, valueNode, expNode) then
- goto CONTINUE
+ for vo in valueNode:eachObject() do
+ if vm.isSubType(uri, vo, expNode) then
+ if not result then
+ result = vm.createNode()
+ end
+ result:merge(vm.compileNode(operator.extends))
+ return result
+ end
end
+ else
+ if not result then
+ result = vm.createNode()
+ end
+ result:merge(vm.compileNode(operator.extends))
+ return result
end
- if not result then
- result = vm.createNode()
- end
- result:merge(vm.compileNode(operator.extends))
- break
::CONTINUE::
end
return result
@@ -249,7 +256,9 @@ vm.binarySwitch = util.switch()
})
else
local node = vm.runOperator(binaryMap[op], source[1], source[2])
- vm.setNode(source, node or vm.declareGlobal('type', 'integer'))
+ if node then
+ vm.setNode(source, node)
+ end
end
end)
: case '+'
@@ -296,20 +305,38 @@ vm.binarySwitch = util.switch()
local uri = guide.getUri(source)
local infer1 = vm.getInfer(source[1])
local infer2 = vm.getInfer(source[2])
- if infer1:hasType(uri, 'integer')
- or infer2:hasType(uri, 'integer') then
- if not infer1:hasType(uri, 'number')
- and not infer2:hasType(uri, 'number') then
- vm.setNode(source, vm.declareGlobal('type', 'integer'))
- return
- end
+ if infer1:hasType(uri, 'integer')
+ and infer2:hasType(uri, 'integer') then
+ vm.setNode(source, vm.declareGlobal('type', 'integer'))
+ return
+ end
+ if (infer1:hasType(uri, 'number') or infer1:hasType(uri, 'integer'))
+ and (infer2:hasType(uri, 'number') or infer2:hasType(uri, 'integer')) then
+ vm.setNode(source, vm.declareGlobal('type', 'number'))
+ return
+ end
+ end
+ if op == '/'
+ or op == '^' then
+ local uri = guide.getUri(source)
+ local infer1 = vm.getInfer(source[1])
+ local infer2 = vm.getInfer(source[2])
+ if (infer1:hasType(uri, 'integer') or infer1:hasType(uri, 'number'))
+ and (infer2:hasType(uri, 'integer') or infer2:hasType(uri, 'number')) then
+ vm.setNode(source, vm.declareGlobal('type', 'number'))
+ return
end
end
if op == '//' then
- vm.setNode(source, node or vm.declareGlobal('type', 'integer'))
- return
+ local uri = guide.getUri(source)
+ local infer1 = vm.getInfer(source[1])
+ local infer2 = vm.getInfer(source[2])
+ if (infer1:hasType(uri, 'integer') or infer1:hasType(uri, 'number'))
+ and (infer2:hasType(uri, 'integer') or infer2:hasType(uri, 'number')) then
+ vm.setNode(source, vm.declareGlobal('type', 'integer'))
+ return
+ end
end
- vm.setNode(source, node or vm.declareGlobal('type', 'number'))
end
end)
: case '..'
@@ -345,8 +372,26 @@ vm.binarySwitch = util.switch()
[1] = a .. b,
})
else
+ local uri = guide.getUri(source)
+ local infer1 = vm.getInfer(source[1])
+ local infer2 = vm.getInfer(source[2])
+ if (
+ infer1:hasType(uri, 'integer')
+ or infer1:hasType(uri, 'number')
+ or infer1:hasType(uri, 'string')
+ )
+ and (
+ infer2:hasType(uri, 'integer')
+ or infer2:hasType(uri, 'number')
+ or infer2:hasType(uri, 'string')
+ ) then
+ vm.setNode(source, vm.declareGlobal('type', 'string'))
+ return
+ end
local node = vm.runOperator(binaryMap[source.op.type], source[1], source[2])
- vm.setNode(source, node or vm.declareGlobal('type', 'string'))
+ if node then
+ vm.setNode(source, node)
+ end
end
end)
: case '>'
diff --git a/script/vm/type.lua b/script/vm/type.lua
index 756926ba..8382eb86 100644
--- a/script/vm/type.lua
+++ b/script/vm/type.lua
@@ -466,6 +466,7 @@ function vm.isSubType(uri, child, parent, mark, errs)
if ext.type == 'doc.extends.name'
and (not isBasicType or guide.isBasicType(ext[1]))
and vm.isSubType(uri, ext[1], parent, mark, errs) == true then
+ mark[childName] = nil
return true
end
end
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index 3cd560ff..7763d643 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -575,7 +575,7 @@ function f(x: string, y: table)
@*param* `x` — this is comment
-@*param* `y` — comment 1
+@*param* `y` — comment 1
@*return* `name` — comment 2
@@ -746,7 +746,7 @@ function f(a: boolean)
---
-@*param* `a` — xxx
+@*param* `a` — xxx
```lua
a:
@@ -1308,7 +1308,7 @@ local n: integer
---
- comments]]
+comments]]
}
TEST {
@@ -1365,7 +1365,7 @@ local n: integer
---
- comments]]
+comments]]
}
TEST {
@@ -1384,7 +1384,7 @@ local n: integer
---
- comments]]
+comments]]
}
TEST {
@@ -1461,7 +1461,7 @@ TEST {
---
- comments]]
+comments]]
}
TEST {
@@ -1708,7 +1708,7 @@ local x: unknown
---
-See: [A](file:///a.lua#1#10) comment1]]
+See: [A](file:///a.lua#1#10) comment1]]
}
TEST { {path = 'a.lua', content = [[
@@ -1728,8 +1728,8 @@ local x: unknown
---
See:
- * [A](file:///a.lua#1#10) comment1
- * [TTT](file:///a.lua#3#0) comment2]]
+ * [A](file:///a.lua#1#10) comment1
+ * [TTT](file:///a.lua#3#0) comment2]]
}
TEST { {path = 'a.lua', content = [[
@@ -1755,3 +1755,24 @@ comment2
function f()
```]]
}
+
+TEST { {path = 'a.lua', content = [[
+---"hello world" this is ok
+---@param bar any "lorem ipsum" this is ignored
+---@param baz any # "dolor sit" this is ignored
+local function <?foo?>(bar, baz)
+end
+]]},
+hover = [[
+```lua
+function foo(bar: any, baz: any)
+```
+
+---
+
+"hello world" this is ok
+
+@*param* `bar` — "lorem ipsum" this is ignored
+
+@*param* `baz` — "dolor sit" this is ignored]]
+}
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua
index 4abe5855..18e7190d 100644
--- a/test/diagnostics/type-check.lua
+++ b/test/diagnostics/type-check.lua
@@ -1238,6 +1238,23 @@ local arr2 = {
}
]]
+TEST [[
+---@class A
+
+---@class B : A
+
+---@class C : B
+
+---@class D : B
+
+---@param x A
+local function func(x) end
+
+---@type C|D
+local var
+func(var)
+]]
+
config.remove(nil, 'Lua.diagnostics.disable', 'unused-local')
config.remove(nil, 'Lua.diagnostics.disable', 'unused-function')
config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global')
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 7521ddf4..e77d8c98 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -238,14 +238,14 @@ TEST [[
string.<?sub?>()
]]
[[
-function string.sub(s: string, i: integer, j?: integer)
+function string.sub(s: string|number, i: integer, j?: integer)
-> string
]]
TEST[[
('xx'):<?sub?>()
]]
-[[function string.sub(s: string, i: integer, j?: integer)
+[[function string.sub(s: string|number, i: integer, j?: integer)
-> string]]
TEST [[
@@ -272,7 +272,7 @@ TEST [[
string.<?lower?>()
]]
[[
-function string.lower(s: string)
+function string.lower(s: string|number)
-> string
]]
diff --git a/test/type_inference/init.lua b/test/type_inference/init.lua
index 597fb761..51de9cd5 100644
--- a/test/type_inference/init.lua
+++ b/test/type_inference/init.lua
@@ -178,7 +178,7 @@ TEST 'boolean' [[
<?x?> = a == b
]]
-TEST 'integer' [[
+TEST 'unknown' [[
<?x?> = a << b
]]
@@ -186,7 +186,7 @@ TEST 'integer' [[
<?x?> = 1 << 2
]]
-TEST 'string' [[
+TEST 'unknown' [[
<?x?> = a .. b
]]
@@ -202,7 +202,7 @@ TEST 'string' [[
<?x?> = 'a' .. 1.0
]]
-TEST 'number' [[
+TEST 'unknown' [[
<?x?> = a + b
]]
@@ -227,11 +227,11 @@ local a
<?x?> = - a
]]
-TEST 'integer' [[
+TEST 'unknown' [[
<?x?> = 1 + X
]]
-TEST 'number' [[
+TEST 'unknown' [[
<?x?> = 1.0 + X
]]
@@ -2416,7 +2416,7 @@ local <?z?> = f()
TEST 'integer|table' [[
local function returnI()
- return a + 1
+ return 1
end
local function f()
@@ -4239,3 +4239,32 @@ TEST 'number' [[
local n
local <?v?> = n or error('')
]]
+
+TEST 'Foo' [[
+---@class Foo
+---@operator mul(Foo): Foo
+---@operator mul(Bar): Foo
+---@class Bar
+
+---@type Foo
+local foo
+
+---@type Foo|Bar
+local fooOrBar
+
+local <?b?> = foo * fooOrBar
+]]
+
+TEST 'number' [[
+local a = 4;
+local b = 2;
+
+local <?c?> = a / b;
+]]
+
+TEST 'string' [[
+local a = '4';
+local b = '2';
+
+local <?c?> = a .. b;
+]]