Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用了distinguishSameNameFile=true,truncatedOPath过滤公共串后,同名文件正则识别错误(没有处理"["、"]") #172

Open
weng7654 opened this issue Oct 9, 2023 · 2 comments

Comments

@weng7654
Copy link

weng7654 commented Oct 9, 2023

使用testBreakpoint,能显示匹配串,但是文件名包含[ ]这样的正则表达式,没有转义:
消息如下:
"

  • BreakPoint Test:
    User set lua extension: .
    Auto get lua extension: .lua
    User set truncatedOPath: test1/0
    GetInfo: @e:/test1.0/spec/[xxxx]test.lua
    Normalized: /spec/[xxxx]test.lua
    Formated: [xxxx]test.lua
    Breakpoint: e:/test1.0/spec/[xxxx]test.lua
    说明:自动路径(autoPathMode)模式已开启。同名文件中的断点识别(distinguishSameNameFile) 已开启。本文件中断点可被正常命中"

但是代码luaPanda命中短点逻辑this.isHitBreakpoint函数中
if (not distinguishSameNameFile) or (string.match(fullpath, oPathFormated ) and this.checkRealHitBreakpoint(opath, curLine)) then
.....

string.match(fullpath, oPathFormated ) 这里会永久返回nil,测试发现是文件名包含正则表达式[ ] 导致的,导致断点无法命中

@weng7654
Copy link
Author

weng7654 commented Oct 9, 2023

顺便问下,把路径的. 都替换成/是有什么考量吗,如果项目路径带.的,不同的lua文件夹没有公共部分会导致无法命中断点

@stuartwang
Copy link
Collaborator

问题收到,我最近会看一下,目前确实对路径中的异常字符处理的不好。所以如果可以路径中尽量不使用特殊字符。

关于 . 替换成 / 的原因,现在假设a文件夹下存在b.lua ,那么require这个文件的方式可以是

require("a/b")  或者
require("a.b")

因为lua require中 . 和 / 同义,代表一级目录,用户可以用上面任何一种写法,而用户写的a/b或者a.b这个路径最终会被调试器获得,用于做断点命中比对。

调试前端发过来的路径肯定是 a/b,为了路径比对能够成功,兼容a.b的写法,所以我们把路径中的 . 整体提换成了 / ,所以这要要求用户路径中不能出现 "." ,会造成你上面遇到的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants