Code Monkey home page Code Monkey logo

luahelper's Introduction

LuaHelper Guide

logo

Introduction

LuaHelper is a High-performance lua plugin, Language Server Protocol for lua.

Lua is very popular in game development because of its simple syntax and flexible use. However, its ecology is not perfect, and IDE tools and support are few, which affects Lua's development efficiency and quality. LuaHelper complies with Microsoft Language Server Protocol and is a cross-platform Lua code editing and testing tool developed in go language. Compared with other Lua plugins currently on the market, it has the following improvements:

  • 1. Coroutine development, real-time detection, millisecond output detection results
  • 2. Support large-scale Lua projects, perfectly support editing and testing of 1000+ file project
  • 3. Comprehensive error type detection, including: grammar detection, semantic detection
  • 4. Various types of reference search, including: multi-file reference search, multi-layer reference search
  • 5. Rich configurable items, including: multiple alarm information configurations, ignorable file settings
  • 6. Low memory consumption, low-performance machines can still run smoothly

Lua因其语法简单、使用灵活,在游戏开发中十分流行。但其生态并不完善,IDE开发工具及配套支持较少,一定程度上影响了Lua的开发效率及质量。LuaHelper遵从微软Language Server Protocol协议,是采用go语言开发的一种跨平台Lua代码编辑及检测工具。

相较目前市面其他Lua插件,具有以下改进

  • 1.协程开发,实时检测,毫秒级输出检测结果
  • 2.支持大型Lua项目,完美支持1000+文件项目工程的编辑与检测
  • 3.全面的错误类型检测,包括:语法检测、语义检测
  • 4.多种类引用查找,包括:多文件引用查找、多层引用查找
  • 5.丰富的可配置项,包括:多种告警信息配置、可忽略文件设定
  • 6.内存消耗低,低性能机器仍可流畅运行

Documentation

Background [项目背景] | Configuration [检查配置] | Manual [源码介绍] | Annotate [注解功能]

Feature Summary

Code Editing

Code Detection

Debug lua

调试功能集成了腾讯开源LuaPanda的调试组件,采用了Debug Adapter Protocol调试协议。debugger主体使用lua语言开发,调试程序只要引入LuaPanda.lua文件,即可方便开启调试功能。

Installation

App Market Installation

应用市场安装

avatar

Acknowledgements

  • luago-books, Go language generates Lua's AST, modified the source code (adding column attributes to each node of the AST, and also optimizing performance).
  • LuaFormatter, Lua code formatting library written in c++, with high performance.
  • LuaPanda, Integrating the debugging components of LuaPanda, LuaPanda author stuartwang also provided us with a lot of help.
  • EmmyLua, The author, Tang, provides a lot of help and suggestions for the implementation of our entire plug-in.

  • luago-books, go语言生成lua的AST,修改了源码(对AST的每个节点增加了列的属性,同时也优化了性能)。
  • LuaFormatter, c++写的Lua代码格式化库,性能较高。
  • LuaPanda,集成了LuaPanda的调试组件,LuaPanda的作者stuartwang也给我们提供了很多帮助。
  • EmmyLua, 作者阿唐对我们整个插件的实现提供很多帮助和建议。

Support

If you have any questions, please refer to FAQ. If you have any questions, please use issues. We will follow and reply. 如有问题先参阅 FAQ ,如有问题建议使用 issues ,我们会关注和回复。

Email:[email protected]; [email protected]; [email protected]

QQ群:747590892

luahelper's People

Contributors

5m1ly avatar chenhaogang-magictavern-com avatar ggshily avatar hexian000 avatar jqknono avatar lalawue avatar legend-master avatar richardyin avatar yinfei8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

luahelper's Issues

目前已知的待完善功能点总结

对目前已知的特性做了总结,如下:


@alias test #26 (很有用)

---@alias RequestMode string
---| '"GET"'   # 资源已被提取并在消息正文中传输。
---| '"HEAD"'  # 实体标头位于消息正文中。
---|>'"POST"'  # 描述动作结果的资源在消息体中传输。
---| '"TRACE"' # 消息正文包含服务器收到的请求消息。

---@param mode RequestMode
function toRequest(mode)
    -- 首先,光标悬浮在此方法上,就应该有展开的RequestMode完整提示
end

toRequest()  -- 其次,这里光标到括号内,按语法提示快捷键,应该列出完整的RequestMode选项

@see test #25 (很有用)

---@class Emmy
local emmy = {}
function emmy:sayHello()
end

---@see Emmy#sayHello
local function testHello()
    -- 目前还不支持点击跳转
    -- 也不支持书写see后面时自动提示
end

GOLD_ID = 100001

---@see _G#GOLD_ID
function getGoodsIcon(goodsId)
    -- 这里也应该能点击跳转到上面定义
end

@deprecated test (有点用)

#期望效果

---@deprecated
function oldFun()
end

oldFun()  -- 使用不推荐的方法,ide会报警告

@overload test (这个特性好像用处不大)

#期望效果

---@param tbl table
---@param name string
---@param hook function
---@overload fun(name: string, hook: function) @mode 2
function hooksecurefunc(tbl, name, hook) end

--[[
    在输入此方法时,ide会提示出两个候选项
    function hooksecurefunc(name: string, hook: function)
    function hooksecurefunc(tbl: table, name: string, hook: function)
]]
hooksecurefunc()

注释的 markdown 支持显示bug

--- - item 1
---   - level 21
---   - level 22
--- - item 2
function TestFunc()
end

现在展示效果
image

期望展示效果
image

作者辛苦了,请酌情安排计划,再次感谢作者的辛苦付出~

Suggestion : static analysis of Lua code

It could be great to have the same feature than in Zerobrane : perfom a 'static' code analysis thru the contextual menu, that will outputs all the warnings/error as a textual summary in the console.

Debugging into a loaded C library

Your breakpoint/stepping debugging support is excellent. Thank you.
But I wondered if it was possible to step into a loaded C library.

For example:-

#!/usr/bin/env -S lua -W

-- Require cffi-lua, not from luaJIT
-- via LuaRocks, with LUA_CPATH set
local cffi = require("cffi")

-- Load libfoo
local mylib = cffi.load('./libfoo.so')

--Call function
local ret = mylib.getStable(mytableSCuserdata)

As I think you'll agree, your debugger steps over the Function call.

Any chance it could step in?

hover提示乱码

文件是gb2312编码时,函数的hover提示乱码,utf8文件编码则正常。

vscode-lua插件没这个问题

image

关于luasock.dll动态库

您好,我用mingw编译的lua,不能调试,猜测可能是dll使用的是vs编译的,所以想用vs再编一次,请问您的插件自带的dll是x86还是x64的

方法嵌套调用,导致返回类型丢失

-- 方法嵌套调用,导致返回类型丢失

---@class uiButton
local uiButton = class('uiButton')

---@return uiButton
function uiButton.new()
    return self
end

---@return uiButton
function uiButton:setX(x)
    self.x_ = x
    return self
end

---@return uiButton
function uiButton:setY(y)
    self.y_ = y
    return self
end

local btn1 = uiButton.new()                    -- 返回类型 uiButton
local btn2 = uiButton.new():setX(10)           -- 返回类型 any
local btn3 = uiButton.new():setX(10):setY(10)  -- 返回类型 any

示例代码如上,期待早日修复
作者辛苦了~

format文件必报错

图片

版本 Windows 10 专业版
版本号 20H2

插件版本:商店最新,v0.1.41

任何一个lua文件格式化就会报这个错误

项目有空白lua文件,就会编辑器报错

常常因为新建lua文件是空白的,出现这种报错,不得不重新打开VSCode

panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: interface conversion: interface {} is runtime.boundsError, not lexer.LuaParseError

goroutine 215 [running]:
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze.func1(0xc0007d7b50)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:25 +0x1c7
panic(0x13ab660, 0xc000aeccc0)
	D:/Go/src/runtime/panic.go:965 +0x1c7
luahelper-lsp/langserver/check/compiler/lexer.(*Lexer).SkipFirstLineComment(0xc0007d7da8)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/lexer/lexer.go:84 +0x13d
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze(0xc0007d7c00, 0x0, 0x0, 0x0, 0x0)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:30 +0x85
luahelper-lsp/langserver/check.(*AllProject).analysisFirstLuaFile(0xc00073e0e0, 0xc0012c85a0, 0xc00017fa00, 0x7e, 0x0, 0x0, 0x0, 0xc0002b0000, 0x1, 0x1, ...)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:76 +0x2ad
luahelper-lsp/langserver/check.GoRoutineFirstWork(0xc0000860c0)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:136 +0x2e5
created by luahelper-lsp/langserver/check.(*AllProject).firstCreateAndTraverseAst
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:203 +0xe6
[Info  - 下午5:56:30] Connection to server got closed. Server will restart.
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: interface conversion: interface {} is runtime.boundsError, not lexer.LuaParseError

goroutine 274 [running]:
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze.func1(0xc00071fb50)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:25 +0x1c7
panic(0x13ab660, 0xc00060e060)
	D:/Go/src/runtime/panic.go:965 +0x1c7
luahelper-lsp/langserver/check/compiler/lexer.(*Lexer).SkipFirstLineComment(0xc00071fda8)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/lexer/lexer.go:84 +0x13d
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze(0xc00071fc00, 0x0, 0x0, 0x0, 0x0)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:30 +0x85
luahelper-lsp/langserver/check.(*AllProject).analysisFirstLuaFile(0xc0003ef880, 0xc0007fa960, 0xc00049dd00, 0x7e, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, ...)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:76 +0x2ad
luahelper-lsp/langserver/check.GoRoutineFirstWork(0xc000200840)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:136 +0x2e5
created by luahelper-lsp/langserver/check.(*AllProject).firstCreateAndTraverseAst
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:203 +0xe6
[Info  - 下午5:56:30] Connection to server got closed. Server will restart.
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: interface conversion: interface {} is runtime.boundsError, not lexer.LuaParseError

goroutine 263 [running]:
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze.func1(0xc000537b50)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:25 +0x1c7
panic(0x13ab660, 0xc00020a000)
	D:/Go/src/runtime/panic.go:965 +0x1c7
luahelper-lsp/langserver/check/compiler/lexer.(*Lexer).SkipFirstLineComment(0xc000537da8)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/lexer/lexer.go:84 +0x13d
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze(0xc000537c00, 0x0, 0x0, 0x0, 0x0)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:30 +0x85
luahelper-lsp/langserver/check.(*AllProject).analysisFirstLuaFile(0xc0007052d0, 0xc000f88550, 0xc000524100, 0x7e, 0x0, 0x0, 0x0, 0xc000010000, 0x1, 0x1, ...)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:76 +0x2ad
luahelper-lsp/langserver/check.GoRoutineFirstWork(0xc0004a2360)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:136 +0x2e5
created by luahelper-lsp/langserver/check.(*AllProject).firstCreateAndTraverseAst
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:203 +0xe6
[Info  - 下午5:56:30] Connection to server got closed. Server will restart.
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: interface conversion: interface {} is runtime.boundsError, not lexer.LuaParseError

goroutine 268 [running]:
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze.func1(0xc0022a7b50)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:25 +0x1c7
panic(0x13ab660, 0xc0025325b8)
	D:/Go/src/runtime/panic.go:965 +0x1c7
luahelper-lsp/langserver/check/compiler/lexer.(*Lexer).SkipFirstLineComment(0xc0022a7da8)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/lexer/lexer.go:84 +0x13d
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze(0xc0022a7c00, 0x0, 0x0, 0x0, 0x0)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:30 +0x85
luahelper-lsp/langserver/check.(*AllProject).analysisFirstLuaFile(0xc000598f50, 0xc0025d5180, 0xc0003e2780, 0x7e, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, ...)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:76 +0x2ad
luahelper-lsp/langserver/check.GoRoutineFirstWork(0xc0002e0b40)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:136 +0x2e5
created by luahelper-lsp/langserver/check.(*AllProject).firstCreateAndTraverseAst
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:203 +0xe6
[Info  - 下午5:56:30] Connection to server got closed. Server will restart.
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: interface conversion: interface {} is runtime.boundsError, not lexer.LuaParseError

goroutine 247 [running]:
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze.func1(0xc000737b50)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:25 +0x1c7
panic(0x13ab660, 0xc000227d10)
	D:/Go/src/runtime/panic.go:965 +0x1c7
luahelper-lsp/langserver/check/compiler/lexer.(*Lexer).SkipFirstLineComment(0xc000737da8)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/lexer/lexer.go:84 +0x13d
luahelper-lsp/langserver/check/compiler/parser.(*Parser).BeginAnalyze(0xc000737c00, 0x0, 0x0, 0x0, 0x0)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/compiler/parser/parser.go:30 +0x85
luahelper-lsp/langserver/check.(*AllProject).analysisFirstLuaFile(0xc00058dc00, 0xc0000e31d0, 0xc0002dd8c0, 0x81, 0x0, 0x0, 0x0, 0xc000010000, 0x1, 0x1, ...)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:76 +0x2ad
luahelper-lsp/langserver/check.GoRoutineFirstWork(0xc00001af00)
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:136 +0x2e5
created by luahelper-lsp/langserver/check.(*AllProject).firstCreateAndTraverseAst
	G:/companyproject/LuaHelper/LuaHelper/luahelper-lsp/langserver/check/check_first_hanlde.go:203 +0xe6
[Error - 下午5:56:30] Connection to server got closed. Server will not be restarted.

add option to enable/disable luaformat

Is it possible to add an option to enable/disable luaformat? For now I have to edit the source file to disable the format provider.

Thanks for the extension and I found it very useful.

Option to disable lint

Using the extension to deal with GLua, which is a LUA api for GMOD.
The lint constantly shows errors about GLua syntax implementations (! instead of not) (|| instead of or).

Would be nice to have an option to completly disable warns on linting.

试用了下跳转功能,发现不尽如人意。

插件的跳转功能感觉不如Lua-Tags插件好用,比如下面的代码:
按下F12原本是想跳转到Lobby2Club符号的定义处,但实际上跳转到了SNSUtil的定义处了。
希望作者可以参考下Lua-Tags的跳转功能更好的完善插件,感谢作者的奉献!
image

for 循环没有注释提示

---@class Cat
local Cat = class()

function Cat:test()
end


---@type table<string, Cat>
local catsMap = {}


---@return table<string, Cat>
function getCatsMap()
    return catsMap
end


---@param catData Cat
for catId, catData in pairs(getCatsMap()) do
    catData:test()  -- 这句打的时候没提示
end

如题,这是一个简单的例子,for循环中的提示还是蛮常用的,期待这个支持能早日向emmet一样。
这是我在vscod中用到的最好用的插件了,所以很期待能早日解决这个需求,感激不尽~谢谢辛苦付出的作者

LUA Format not working

I have Lua Helper installed.
When I try to format my code I get the following pop up
Annotation 2020-07-31 170222
I hope this can be fixed.

xlua中,有必要引入'libpdebug'吗?如何引入?

这几行LuaPanda源码,会出现这样的错误

        --sync breaks to c
        if hookLib ~= nil then
            hookLib.sync_breakpoints();
        end
Error:Editor/LuaPanda:1132: bad argument #-1 to 'sync_breakpoints' (string expected, got nil)
stack traceback:
	[C]: in function 'libpdebug.sync_breakpoints'
	 in function 'Editor/LuaPanda.dataProcess' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:1132)
	 in function 'Editor/LuaPanda.receiveMessage' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:1566)
	 in function 'Editor/LuaPanda.debugger_wait_msg' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:1590)
	 in function 'Editor/LuaPanda.dataProcess' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:1404)
	 in function 'Editor/LuaPanda.receiveMessage' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:1566)
	 in function 'Editor/LuaPanda.debugger_wait_msg' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:1590)
	 in function 'Editor/LuaPanda.connectSuccess' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:275)
	 in function 'Editor/LuaPanda.start' -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/LuaPanda:247)
	 in main chunk -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Editor/EditorDebug:6)
	[C]: in function 'require'
	 in main chunk -(at E:/Project/Saint_Seiya/Client/Trunk/ProjectSaintSeiya/Assets/Res/LuaScripts/Game:32)
	[C]: in function 'require'
	[string "chunk"]:1: in main chunk

经过一番研究,我已经发现这个库的位置,VSCode插件会将dll文件位置发送到LuaPanda.tryRequireClib里。

我尝试通过项目的XLua加载脚本,把这个位置传递给了CustomLoder。也就是进入了 StaticLuaCallbacks.LoadFromCustomLoaders这个函数中。能读出byte[]。但是仍然会显示

error loading module libpdebug from CustomLoader, 【用户目录】\\.vscode\\extensions\\yinfei.luahelper-0.1.65/Debugger/debugger_lib/plugins/win/x86_64/503/libpdebug.dll:1: syntax error near '<\\144>'"

我们主程确实改过xlua源码。我也不确定是不是他们改出问题了🤣。不过如果有时间我新建一个项目看看

Extension issue

  • Issue Type: Bug
  • Extension Name: luahelper
  • Extension Version: 0.1.58
  • OS Version: Darwin x64 20.6.0
  • VSCode version: 1.53.2

⚠️ We have written the needed data into your clipboard. Please paste! ⚠️

Jump method will be inaccurate

Steps to reproduce:

obj.lua

obj = {}
obj.fun = function()
end

obj1.lua

obj.fun1 = function()
end

main.lua

obj = {}

-- Can jump and locate normally 能正常跳转定位
obj.fun()

-- Cannot be located 不能被定位到
obj.fun1()

Scene two

main.lua

obj.fun()

obj.lua

local createObj = function()
    local o = {}
    o.fun = function()
    end
    return {fun=o.fun}
end
obj = obj or createObj()

err vscodeRoot: is not exist

How to reproduce the bug
Method 1:

  1. open a new vscode window (CTRL+SHIFT+O)
  2. CTRL + O
  3. Select the .lua file

Method 2:

  1. Open Windows File Explorer
  2. Open the .lua file with a double click

image

Support for non-standard symbols?

I'm working on a project that has a build process that runs as a preprocessor and converts backticks to convert values before runtime. so I could have

local test = `somevalue`
-- or
local test2 = {
    [`weapon_name`] = "information"
}

Then before the code is run those would be converted to hash values. In another resource it makes use of Lua › Runtime: Nonstandard Symbol which saves to settings.json as:

"Lua.runtime.nonstandardSymbol": [
    "`"
],

Would it be possible to add support for something like that? I'd just like them to be treated just as a string would just without auto-replacement and not throwing errors, nothing fancy. There's a whole community using this same system. read more

LuaHelper-DebugFile

LuaHelper-DebugFile 一闪而过 不起作用,麻烦给看看休息 ,luaPath/packagePath填写什么呢
{
"type": "LuaHelper-Debug",
"request": "launch",
"name": "LuaHelper-DebugFile",
"luaPath": "",
"packagePath": [],
"luaFileExtension": "cocos2dx",
"connectionPort": 8818,
"stopOnEntry": true,
"useCHook": true,
"logLevel": 1
}

完善 @alias 中枚举类型的提示与使用

期望作者大大能够完善竞品插件般的的枚举提示
https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations#alias

当我使用了竞品插件后,定义了如下代码

---@alias requestMode string
---| '"GET"'   # 资源已被提取并在消息正文中传输。
---| '"HEAD"'  # 实体标头位于消息正文中。
---|>'"POST"'  # 描述动作结果的资源在消息体中传输。
---| '"TRACE"' # 消息正文包含服务器收到的请求消息。

---@param mode requestMode
function toRequest(mode)
end

首先,竞品插件拥有悬浮提示
image

其次,竞品插件输入时也具有配套的自动提示
image

诚恳作者大大能够加入todo任务中,期待早日用上这个功能特性,真的能很方便coding体验。

return定义的的类型无法传递出来了!

---@class MyModel
    local myModel = class('MyModel')

    ---@return MyModel
    function getMyModel()
        return myModel
    end

    local model = getMyModel()  -- type is any ??

麻烦作者抽看看一下,是不是之前改出bug了?
这还是非常常用的提示功能,听影响coding的。

代码格式化功能失效

从0.16.2至最新版0.2.4都无法正常工作,打开日志后,选择格式化代码无任何日志输出

调试配置说明完善

如果说,Unity 项目中。有人用vscode做主开发,其中,lua根目录在Unity项目的Assets某目录里。而不是与Unity同级根目录。如果就这样LuaHelper-Attach ,将会找不到路径。
但是呢,可以调整json

  • 例如 lua根目录在 Unity项目中Assets/LuaScript/
  • LuaHelper-Attach 下面添加
"cwd": "${workspaceFolder}/Assets/LuaScript/"

经测试,甚至可以C#,lua 两种调试同一个vscode同时开启。将会带来巨大的方便。

Format removes comment

The formatter formats

variable = {
  'entry' -- comment
  -- another comment
}

into

variable = {'entry' -- comment
}

Syntax 的检查无法 Ignore 目录

目前测试的结果有下列问题

  1. 关闭了【Warn Type:1】这个检查,但是在 Problems 视窗还是有显示
  2. 我在工程中有特定目录要排除 lua 的语法检查,不过目前都没有办法可以排除

还有,这个项目什么时候开源,如果开源了我就可以自己解决问题并发 pr 给你们

Warn Type 15 is wrong

local a = {
    b = 3
}
local c = (a and a.b) or true
print(c)

when you run this code, you got 3. but lua helper says:

[Warn type:15], or expression is always true [4, 12]

代码着色显示不正确

情形1:

image
C_ORANGE 是全局变量,显示不正确

不是每次都显示不正确,下图是正常显示
image

情形2

image

情形3

image

[Feature] Ability to change color for Global/Local variables

This will be a great feature if an option can be added that can be able to change color for global variables and local variables.

Proposed setting using luahelper.json:

{
    "globalVarColor": "#xxxxxx",
    "localVarColor": "#xxxxxx",
}

or via VSCode:

"luahelper.global_var_color":"#xxxxxxx"
"luahelper.local_var_color":"#xxxxxxx"

[bug] 执行文件时未加入双引号以及“luaPath”定义无效

VSCode Version: 1.62.2
Extension Version: v0.2.2

问题描述:
在独立文件调试模式中

  1. 当系统登陆用户名含有空格时,其路径事例类似:”C:/Users/USER 1“,这种情况下当Lua Helper执行自身路径下的Lua5.4.exe时未加入双引号,致使CMD/PS因存在空格无法执行对应文件,表现为
    'c:/Users/USER' 不是内部或外部命令,也不是可运行的程序或批处理文件。
    建议加入双引号或者使用%USERPROFILE%

  2. 为了解决问题1,我尝试修改launch.json中的luaPath为
    %USERPROFILE%/.vscode/extensions/yinfei.luahelper-0.2.2/debugger/luasocket/win/x64/lua5.4/lua54.exe
    后执行调试发现没有变化,遂改成说明中默认的
    "C:/lua5.3/lua.exe"
    发现执行调试时的命令行依旧无变化
    提示该配置没有起到正确作用

Can't find luasocket?

I'm sorry, I'm very new to Lua and don't really understand what the problem is here.
vscode1
vscode2
vscode3
vscode4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.