Comments (2)
I know why it happens and I know that there's a workaround ;)
Doesn't mean it shouldn't be bug reported
from lua-language-server.
I think that's because you did not define the base
type of the function, so LuaLs just infer the base
type by itself, that this empty function can return nil
. To workaround this, you may change one of the ---@overload
declaration into ---@param
and ---@return
:
---@meta
local Foo = {}
---@param a string
---@return string
---@overload fun(a: number): table
function Foo.Bar(a)
end
local b = Foo.Bar('abc') -- type of is `string` now
from lua-language-server.
Related Issues (20)
- Support auto complete of callback arguments where callback is defined via a local variable
- Two Rule Suggestions: multiple returns in function calls / table definitions and string concatenation
- 让两个注解都生效@enum,@type HOT 8
- Code colors completely gone
- Validation of function-type parameters
- Added the setting to use spaces instead of tabs when completing keywordSnippet. HOT 2
- lua_lsp is abnormally consuming memory. HOT 5
- Build fails with version 3.9.3 on OpenBSD
- When the subclass inherits the constructor of the parent class, generics do not work (the type of `self` cannot be used for annotation) HOT 1
- Function Prototype Narrowing with nils HOT 2
- Overload intellisense issue with type of parameters
- `inject-field` error (`exact`) is not working as expected? HOT 4
- Typed field overrides the type of other fields HOT 1
- The type is not determined after the bitwise operation
- [Feature Request] Option for automatic requires to use class name
- When defining global variable using `---@class _G` + `---@field`, no autocompletion in `_G.*` for those injected fields
- Lua lsp using too much RAM on specific files HOT 1
- Need help with running lua lsp in a docker container HOT 3
- [Suggestion] Add ability to define an enum without using a table HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-language-server.