运行环境:
openjdk 11.0.6 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
emacs:26
`---@class Car
---@field public name string @add name field to class Car, you'll see it in code completion
local cls = class()
---@return Car[]
local function createCars()
end
---@type table<string, Car>
local dict = {}
local car = dict['key']
-- car. and you'll see completion
for key, car in pairs(createCars()) do
-- car. and you'll see completion
end
`
运行环境: openjdk 11.0.6 2020-01-14 OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1) OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing) emacs:26 `---@class Car ---@field public name string @add name field to class Car, you'll see it in code completion local cls = class()
---@return Car[] local function createCars() end
---@type table<string, Car> local dict = {}
local car = dict['key'] -- car. and you'll see completion
for key, car in pairs(createCars()) do -- car. and you'll see completion end `![image](https://user-images.githubusercontent.com/61351818/75092720-88283780-55b5-11ea-83fc-2054fe9e9a06.png)