Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Lua BoosterNew to Visual Studio Code? Get it now.

Lua Booster

Tencent

|
2,193 installs
| (6) | Free
Boost your productivity and happiness when coding with Lua, Powerful toolkit of IntelliSense, Linting, code formatting and more.
Install
Trouble Installing?

Introduction/介绍

Lua Booster is a VSCode plugin for lua. It's core uses c++ for developing, thus guaranteed a low memory consumption while ensuring high performance. It can support lua project with more than 10,000 files. It can help you write lua code safely and effectively.

What's more, you can customize require modules and rules for static check(lint).


Lua Booster 是一款针对lua语言的VSCode插件。底层使用 c++ 开发,在保证高性能的同时满足低内存消耗。可以对拥有 10,000+ 文件的超大型lua工程提供支持。它能够帮助你安全高效的使用Lua编程。

此外,用户还能够自定义模块化(require)和静态检查规则。


Features/特性演示

Information Viewing/信息速览:

  • Type Inference [类型推导]
  • Hover Info [悬浮代码信息]
  • [Customize Syntax Coloring 自定义语法着色](#自定义语法着色)
  • Code Outline [代码大纲]
  • WorkSpace And Global Symbol Info [工作区与全局符号信息]

Quick Coding/快速编码:

  • IntelliSense、AutoComplete [智能提示、自动完成]
  • Document Formatting [文档格式化]
  • Goto Definition [定义跳转]
  • Find Reference [引用查找]
  • Rename Symbol [变量重命名]

Code Inspection/代码检查:

  • Semantic Analysis [语义分析]
  • Static Checking [静态检查]

Debug/调试:

  • Lua Panda Debugger [LuaPanda Debugger]
  • Local launch/attach Debugger[本地launch/attach调试器]

Ect./其他:

  • Annotation Parsing [注解信息解析]
  • [Setting UI 设置UI](#设置ui)

Quick Navigation/快速导航

  • Install/安装
  • Features/特性演示
  • Setting/配置详解
  • Commands/相关命令
  • FAQ
  • Contributor
  • Acknowledgement
  • Link

Installation/安装

Install from marketplace

  • Click VSCode extension market icon
  • Search Lua Booster
  • Click and install Lua Booster

Install from command line

  • CTRL/CMD+p
  • Copy/Past or type in ext install operali.lua-booster
  • ENTER

应用市场安装

  • 点击VSCode应用市场图标
  • 在输入框中搜索 Lua Booster
  • 点击安装Lua Booster

命令行安装

  • CTRL/CMD+p
  • 复制/粘贴 或 输入 ext install operali.lua-booster
  • ENTER
*.png

Demo/演示

Type Inference and Hover Info

类型推导与悬浮代码信息

*.png

Back to Top [回到顶部]


Auto Complete, IntelliSense and Code Template

自动完成/智能提示/代码模板

*.png

Back to Top [回到顶部]


Semantic Analysis and Static Checking

语义分析和静态检查

*.png

Back to Top [回到顶部]


Syntax Coloring and Code Outline

代码大纲与符号信息

*.png

Back to Top [回到顶部]


Go to Definition And Format Doc

定义跳转与文档格式化

*.png

Back to Top [回到顶部]


Find Reference and Rename Symbol

引用查找与变量重命名

*.png

Back to Top [回到顶部]


Annotation

EmmyLua注解

*.png

Back to Top [回到顶部]


Syntax Coloring

自定义语法着色

*.png

Back to Top [回到顶部]


Setting UI

设置UI

*.png

Back to Top [回到顶部]


Debugger

调试器

*.png

了解更多LuaPanda调试器信息,请参考:LuaPanda

For more information about LuaPanda, please read: LuaPanda

Back to Top [回到顶部]



ATTENTION : After installing lua booster ,you can enjoy coding right away. You can simply stop reading the documentation right here. But if you want to learn more about the usage of lua booster, the following instructions provide advanced usage guidances.

Also, we have provided a great UI for you to quickly use and set functions below, check UI if you don't want to read docs.

注意 : 安装Lua booster 之后,你可以立即开始编码并体验lua booster 的特性。你可以在这里停止阅读文档。 但是如果你想要了解lua booster 的更多进阶用法,下方的内容提供了一个很好的指引。

我们也提供了一个很棒的UI来帮助你使用和配置我们的功能,如果你不想继续阅读文档,请查看UI。

Setting/配置详解

ctrl + shift + p open command box, type in open workspace setting

  1. lua.booster.source.requireDirectory API Searching Path
    • If API path is C:/API, then code require('a.b.c') will refer to C:/API/a/b/c.lua. Reference lookup is in the following order:
      • Path relative to the current directory workspace
      • Directory path relative to the current file
      • Relative to lua.booster.requireDirectory
  2. lua.booster.source.preload Preload directory. Let's see how lua booster starts
    • Load and analyze lua standard library(within plugin)
    • Load and analyze directories under lua.booster.preload
    • Load and analyze the opened workspace directory
  3. lua.booster.source.excludes The file mode of avoiding search , generally used to avoid super large directory search
  4. lua.booster.source.language config the language of the standard lib

ctrl + shift + p open command box, type in open user setting

lua.booster.highlight This command will lead you to the settings where you can configure the color of syntax highlight. We have currently provided dozens of colors for you to select. Check the select box and pick whichever color you like. You can see the changes in your lua files afterwards.


ctrl + shift + p 打开命令框, 输入 open workspace setting

  1. lua.booster.source.requireDirectory API搜索路径
    • 如果API 路径为 C:/API, 代码 require('a.b.c') 会引用到 C:/API/a/b/c.lua, 引用查找按以下顺序:
      • 相对当前目录 workspace的路径
      • 相对当前文件所在目录 路径
      • 依次相对 lua.booster.requireDirectory
  2. lua.booster.source.preload 预加载目录,这里解释下 lua booster 启动顺序
    • 加载分析 lua 标准库(内置)
    • 加载分析 lua.booster.preload 下目录
    • 加载分析 已打开的工作目录(workspace 目录)
  3. lua.booster.source.excludes 避免搜索的文件模式, 一般用于避免超大目录搜索
  4. lua.booster.source.language 配置标准库语言

ctrl + shift + p 打开命令框, 输入 open user setting

lua.booster.highlight 以上命令会导航到设置lua booster语法着色的设置。我们提供了二十多个可选的颜色,你可以查看下拉列表并选择你喜爱的颜色。之后在 lua 文件中即可看到变化。

Back to Top [回到顶部]


Commands/命令详解

ctrl + shift + p open the command box, type in the following Commands:

  • lua booster reload You can reload the symbol table when there is a problem with the symbol table
  • lua booster setting Set the user configuration template.
  • lua booster open logger Open log directory.
  • lua booster setting -> module Customizable module lookup rules in user environment (TODO)
  • lua booster open lint Command to open the lint directory for viewing and add lint rules to the directory.

ctrl + shift + p 打开命令框 输入以下命令:

  • lua booster reload 可在符号表发生问题时,重置符号表
  • lua booster setting 设置用户配置模板。
  • lua booster open logger 打开日志目录
  • lua booster setting -> module 用户环境可自定义的模块查找规则 (TODO)
  • lua booster open lint 命令打开lint目录查看, 在该目录添加 lint规则

Back to Top [回到顶部]


FAQ

  1. require is not functioning,how to config the require path ?

    1. ctrl + shift + p open the command box
    2. Type in open workspace setting
    3. Set lua.booster.requireDirectory , fill in your path
    4. reload window, Restart or ctrl + shift + p -> lua booster reload
  2. our project use Module instead require

    1. ctrl + shift + p open the command box
    2. Type in ``lua booster setting`
    3. choose module
    4. add procedure for load *.png
  3. There are too many files and it loads too slowly.

    1. ctrl + shift + p open the command box
    2. Type in open workspace setting
    3. Set lua.booster.includes. Fill in the file matching pattern. Note that it is the relative path of the working directory
    4. You can also set lua.booster.excludes, fill in the exclude path
    5. reload window, Restart, or ctrl + shift + p -> lua booster reload
  4. How to customize lint ?

    1. ctrl + shift + p open the command box
    2. Type in open workspace setting
    3. Copy your own directories here.
    4. (Refer to the existing scripts in this directory for how to implement static code checking by yourself)
    5. reload window,Restart, or ctrl + shift + p -> lua booster reload
  5. Config lua std lib to other language

    See the setting item lua.booster.document.language

  6. How to ignore a specific lint rule or get it back?

    1. Hover at the diagnostic info provided by lint/luacheck

    2. In the floating window, click QuickFix, then click Ignore rule of ...

    3. Then you can see the diagnostic disappeared and a setting item is added to lua.booster.lint.json.

    4. To stop ignoring a ignored rule, open lua.booster.lint.json which is under .vscode directory.

    5. Find the lint rule you want to stop ignoring, delete the item or simply change the value from false to true

    6. reload window,Restart, or ctrl + shift + p -> lua booster reload

  7. How to change lua formatter setting?

    1. ctrl + shift + p open the command box
    2. Type in ``lua booster setting`
    3. choose formatter
    4. read the js file and change the settings you wanna change.

  1. require 没有效果,如何配置require路径

    1. ctrl + shift + p 打开命令框
    2. 输入 open workspace setting
    3. 设置 lua.booster.requireDirectory 填入路径
    4. reload window, 重启 或者 ctrl + shift + p -> lua booster reload
  2. 在项目里使用 Module 替代 require

    1. ctrl + shift + p 打开命令框
    2. 输入 ``lua booster setting`
    3. 选择 module
    4. 填加用户模块查找例程 *.png
  3. 目录下太多文件,加载速度太慢

    1. ctrl + shift + p 打开命令框
    2. 输入 open workspace setting
    3. 设置 lua.booster.includes, 填入文件匹配模式, 注意是工作目录相对路径
    4. 也可以设置 lua.booster.excludes, 填入排除路径
    5. reload window, 重启, 或ctrl + shift + p -> lua booster reload重置
  4. 配置lua标准库中/英文

    见配置项 lua.booster.document.language

  5. 如何定制静态代码检查

    1. ctrl + shift + p 打开命令框
    2. 输入 open lint 打开lint目录
    3. 将你的目录拷贝到该目录
    4. (关于如何自已实现静态代码检查,可参考该目录已有脚本)
    5. reload window, 重启, 或ctrl + shift + p -> lua booster reload重置
  6. 如何忽视某条静态检查规则或取消忽视它?

    1. 鼠标移至相关的diagnostic上,点击QuickFix,之后点击Ignore rule of ...
    2. 可以看到对应的诊断提示已经消失,而且一条设置被加入到了 lua.booster.lint.json文件中。
    3. 如果想要取消忽视某条规则,打开.vscode目录下的lua.booster.lint.json文件
    4. 找到想要恢复的规则,将对应的条目删除或者将字段的值由false改为true
    5. reload window,Restart, 或者 ctrl + shift + p -> lua booster reload
  7. 如何更改formatter的设置?

    1. ctrl + shift + p 打开命令框
    2. 输入 ``lua booster setting`
    3. 选择 formatter
    4. 查看打开的js文件并对其做出更改

Back to Top [回到顶部]

Contributor

  • operali
  • nierhan
  • keevinzhu
  • xuyanghuang
  • yorkeryan
  • kylau
  • leon

Back to Top [回到顶部]

Acknowledgement

Chinese translation from cloudwu

LuaPanda debugger provided LuaPanda, specially thanks to stuartwang's help

Type annotation rules from tangzx 阿唐 (also contribute to debugger)

Formatter provided by lua-formatter

Luacheck provided by luacheck

Thanks to the creators of Lua for the wonderful language experience


中文文档引用 云风的翻译

类型注解功能根据 阿唐 的 EmmyLua 规范 (阿唐亦对调试器帮助良多)

文档格式化来自 lua-formatter

lint功能集成 luacheck

debugger集成了 LuaPanda, 特别感谢作者 stuartwang 的贡献

感谢 Lua 的创作者带来美妙的语言体验

Back to Top [回到顶部]

Link

if you are a game developer, using Unreal Engine, and prefer Lua, you might interested in UnLua we developed and maintained

if your are using Unity Engine, and prefer Lua, you might interested in xlua we developed and maintained.


如果你是一个游戏开发者, 在 虚幻引擎 下使用 lua, 可以试用我们团队的 UnLua 。

如果你在 Unity Engine 环境下使用 Lua, 可以试用我们团队的 xlua 。

Back to Top [回到顶部]

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft