添加链接 注册    登录
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
睡不着的毛衣  ·  捐血後血液需經多少關卡才可使用? 探訪捐血中 ...·  5 月前    · 
玩命的青蛙  ·  Cassette filters MVP ...·  6 月前    · 
彷徨的热水瓶  ·  Linux/ubuntu中使用vscode时 ...·  7 月前    · 
痴情的豆腐  ·  V2文档完善(已完成) - ...·  9 月前    · 
会开车的熊猫  ·  《女士的法则》:一个双女主“爽文”故事_澎湃 ...·  10 月前    · 
link管理  ›  OpenResty Lua 代码补全 - Visual Studio Marketplace
string lua openresty
https://marketplace.visualstudio.com/items?itemName=killsen.openresty-vsce
贪玩的火车
6 月前
Visual Studio Code > Programming Languages > OpenResty Lua 代码补全 New to Visual Studio Code? Get it now.
OpenResty Lua 代码补全

OpenResty Lua 代码补全

killsen

|
4,324 installs
| ( 1 ) | Free
OpenResty Lua VSCode Extension
Install
Trouble Installing?

欢迎使用 OpenResty Lua 代码补全插件

升级日志 (CHANGELOG)

如何使用本插件运行代码和调试

功能 (Features)

  • 本插件仅支持 Windows 操作系统
  • 支持 io, math, os, string, table 内置库代码补全
  • 支持 coroutine, debug, package 内置库代码补全
  • 支持 ffi , jit , bit LuaJit内置库代码补全
  • 支持 ngx , ndk OpenResty内置库代码补全
  • 支持 lfs , cjson , utf8 , iconv , date 等第三方库代码补全
  • 支持 require 文件路径补全及定义跳转
  • 支持 local 及 upvalue 变量补全及定义跳转
  • 支持部分第三方库类型推导, 部分面向对象库默认使用 new 方法作为构造函数
  • 支持文档大纲
  • 支持 Attach 调试 ( EmmyLuaDebugger )
  • 支持静态检查 ( LuaCheck )
  • 支持自定义类型声明 演示代码
  • 类型声明演示代码

    -- 本插件仅在文件打开或保存时进行类型检查
    -- 简单类型声明 ----------------------------
    --- xyz : number
    local xyz
    xyz = 123
    ngx.say(xyz)
    -- 错误提示:不能将类型 “string” 分配给类型 “number”
    xyz = "abc"
    ngx.say(xyz)
    -- 忽略检查:将 “boolen” 类型当做 “any” 类型分配给类型 “number”
    xyz = true  --> any
    ngx.say(xyz)
    --  联合类型及交叉类型 ----------------------------
    --- T1 : number | string     // 联合类型
    --- T2 : string | boolean    // 联合类型
    --- T3 : T1 & T2             // 交叉类型
    --- abc : T3
    local abc
    abc = 123       -- 不能将类型 “number” 分配给类型 “string”
    ngx.say(abc)
    abc = "abc"
    ngx.say(abc)
    abc = true      -- 不能将类型 “boolean” 分配给类型 “string”
    ngx.say(abc)
    --  复杂类型声明 ----------------------------
    --- HttpOption : { uri, method?, body?, query? }    //声明类型 HttpOption
    --- HttpOption & { headers?: map<string> }          //添加字段 headers
    --- HttpOption & { ssl_verify?: boolean  }          //添加字段 ssl_verify
    -- http 请求
    local function request(option)
    -- @option : @HttpOption  //声明参数类型
        local http  = require "resty.http"
        local httpc = http.new()
        local  res, err = httpc:request_uri(option.uri, option)
        return res, err
    local opt = {}  --> @HttpOption
    -- 类似 TypeScript 写法:
    -- let opt = {} as HttpOption
    -- 下面的 opt 对象就支持成员字段补全了
    opt.uri     = "https://www.baidu.com"
    opt.method  = "POST"
    opt.body    = "{}"
    opt.headers = {
        ["Content-Type"] = "application/json"
    local res, err = request(opt)
    if not res then
        ngx.say(err)
    elseif (res.status == 200) then
        ngx.say(res.body)
    -- 直接调用函数也是有参数类型成员字段补全的
    local res, err = request { uri = "https://www.baidu.com", method = "GET" }
    if not res then
        ngx.say(err)
    elseif (res.status == 200) then
        ngx.say(res.body)
    

    依赖 (Dependences)

  • LuaParse
  • LuaCheck
  • EmmyLuaDebugger
  • OpenResty
  • OpenResty ORPM
  • 截图 (Screenshots)

    • Contact us
    • Jobs
    • Privacy
    • Manage cookies
    • Terms of use
    • Trademarks
    © 2024 Microsoft
     
    推荐文章
    睡不着的毛衣  ·  捐血後血液需經多少關卡才可使用? 探訪捐血中心帶你一次瞭解! - 健康醫療網
    5 月前
    玩命的青蛙  ·  Cassette filters MVP 75 V08 Viledon | Freudenberg Filtration Technologies
    6 月前
    彷徨的热水瓶  ·  Linux/ubuntu中使用vscode时,Ctrl+C/V复制粘贴快捷键功能失效【已解决】_ubuntu中vscode快捷键不能用-CSDN博客
    7 月前
    痴情的豆腐  ·  V2文档完善(已完成) - GoFrame社区团队 - GoFrame官网 - 类似PHP-Laravel, Java-SpringBoot的Go企业级开发框架
    9 月前
    会开车的熊猫  ·  《女士的法则》:一个双女主“爽文”故事_澎湃号·湃客_澎湃新闻-The Paper
    10 月前
    Link管理   ·   51好读   ·   Sov5搜索   ·   小百科
    link管理 - 链接快照平台