xmake-io / xmake-vscode

🍩 A XMake integration in Visual Studio Code
https://xmake.io
Apache License 2.0
230 stars 56 forks source link

如果taget名是动态的就无法解析 #281

Open Dozingfiretruck opened 2 hours ago

Dozingfiretruck commented 2 hours ago

Xmake 版本

2.8.9

操作系统版本和架构

win10

描述问题

project_dir = os.scriptdir()
project_name = project_dir:match(".+[/\\]([%w_]+)")

target(project_name,function()
end)

例如这样就无法解析了

期待的结果

正常解析

工程配置

project_dir = os.scriptdir()
project_name = project_dir:match(".+[/\\]([%w_]+)")

target(project_name,function()
end)

附加信息和错误日志

waruqi commented 2 hours ago

这不是好好的么,自己确认下 project_name 是否正常解析到有效值

project_dir = os.scriptdir()
project_name = project_dir:match(".+[/\\]([%w_]+)")

print("project_name", project_name)

target(project_name,function()
    set_kind("binary")
    add_files("src/*.cpp")
end)
ruki-2:test ruki$ xmake
project_name    test
project_name    test
checking for platform ... macosx
checking for architecture ... x86_64
checking for Xcode directory ... /Applications/Xcode.app
checking for SDK version of Xcode for macosx (x86_64) ... 14.0
checking for Minimal target version of Xcode for macosx (x86_64) ... 14.0
project_name    test
project_name    test
project_name    test
project_name    test
[ 50%]: cache compiling.release src/main.cpp
[ 75%]: linking.release test
[100%]: build ok, spent 1.695s
Dozingfiretruck commented 2 hours ago

编译没问题,是vscode的xmake插件里解析不出来 image

waruqi commented 2 hours ago

插件问题,你直接拉下插件源码调下,暂时没空看。