xmake-io / xmake-vscode Goto Github PK
View Code? Open in Web Editor NEW🍩 A XMake integration in Visual Studio Code
Home Page: https://xmake.io
License: Apache License 2.0
🍩 A XMake integration in Visual Studio Code
Home Page: https://xmake.io
License: Apache License 2.0
调试使用不了。
下面是我的操作步骤:
xmake create -l c -t console test
cd test
xmake f -p msys -a x86_64 -m debug --toolchain=clang
code .
vscode打开后,点击vscode状态栏中xmake的"Build"选项成功编译。
在源文件中下一个有效的断点。
点击vscode状态栏中xmake的"调试按钮
"来调试程序。
并不能像readme所展示的那样,就可以直接启用调试。我之后得自己配置launch.json来自己配置调试器。
请问xmake的vscode插件有什么便利的方法来调试程序吗?
当然我理想中,只要配置好xmake.lua,在vscode中就可以自己完成intelligence或者debug的相关配置。
谢谢。
在windows10,2004企业版下使用VSCode创建 qt.widgetapp 项目出现错误
> Executing task: xmake create -t qt.widgetapp -l c++ -P c:\temp\demo <
create demo ...
error: project directory (C:\temp\demo) is not empty!
The terminal process "C:\Windows\System32\cmd.exe /d /c xmake create -t qt.widgetapp -l c++ -P c:\temp\demo" failed to launch (exit code: 4294967295).
Terminal will be reused by tasks, press any key to close it.
在执行之前确认文件夹为空
C:\Users>xmake l os.emptydir "c:\temp\demo"
true
add_package
添加的package能够在vscode中显示intellisense信息
目前似乎都是在编译或者手动require
时才会编译package,这样的话感觉没法实现根据xmake.lua
中的package信息来支持intellisense?
打算用于交叉编译单片机程序,然后通过cortex-debug插件来调试,由于cortex-debug指向程序的字段为executable而不是本地程序调试用的program,因此用xmake.customDebugConfig来自定义使用cortex-debug插件的时候,没办法很好设置这个字段(当然可以直接填程序路径,但是这样就失去直接按按钮的便捷性了,例如从debug改为release之后,配置就要改)。
对vscode插件开发不熟,不知道能否插件导出环境变量,然后通过${env XXX}的方式获取?
The debugger uses xmake.debuggingTargetsArguments
in order to set up the arguments for a debugging session correctly on most platforms, however when debugging on Windows these settings are ignored, and an empty argument list is used instead.
Debugging on Windows should use arguments from the xmake.debuggingTargetsArguments
, as is expected on other platforms.
None. Arguments are simply not used during debugging.
比如...\test_lib\build\windows\x64\debug\test_lib_demo.exe
,可以的话就可以很方便地集成到vscode,从而利用vscode的调试机制
如果不行,加一个xmake get_config target_path
怎么样?
Hi again,
Windows 10
xmake v2.3.8+202011211435
llvm-mingw
vscode 1.51.1
I'm just trying out the vscode add-in. Your instructions indicate a compile_commands.json file is generated when xmake is installed but I don't have that file in my .vscode directory? I added a reference to that file in my c_cpp_properties.json file as noted in the README:
{
"configurations": [
{
"name": "Win32",
"compileCommands": ".vscode/compile_commands.json",
"includePath": [
"${workspaceFolder}/**",
"C:\\Program Files (x86)\\WinLua\\Lua\\5.3\\include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\Users\\russh\\llvm-mingw\\bin\\clang.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
Which generates the following error:
Cannot find ".vscode\compile_commands.json".
Not a big deal, I'm just trying things out. Thanks!
Russ
environment: vscode 1.45.1, ubuntu 20.04 in windows 10 wsl, xmake vscode extension 1.3.4
While opening a project folder from within wsl, xmake buttons does not appear on the bottom status bar. In vscode developer tools ->console, I can see an error message which says 'cannot spawn xmake, ENOENT'.
I guess this is because xmake is installed in user's home directory and vscode cannot find it. I moved xmake files from ~/.local/xmake to /usr/local and then the problem is gone.
Since xmake is recommended to be installed locally, I'd like to know whether there's another solution to this issue.
thanks
We need to set
"xmake.customDebugConfig": {
"cwd": "${workspaceFolder}"
},
if we want to change running directory when debugging
Hope to use set_rundir by default
注:提问题时若使用
不能用/没效果/有问题/报错
此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将会直接标记为Invalid。
同时安装了mingw64与mingw32,从x86_64切换到i386时,无法切换到ming32版本,
一直检测的是ming64
能否在这样情况下,自动完成检测切换到mingw32呢?
请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:
Xmake 能增加 一些Qt模板吗?
比如
xmake create add -t qt_DialogWithButtonsBottom AboutUsDialog
创建添加一个Dialog在当前项目下
模板包括
Dialog with Buttons Bottom
Dialog wiht Buttons Right
Dialog without Buttons
Main Window
Widget
模板文件可以参考 Qt Creator 默认生成的文件
我在服务器上部署了vscode web,并安装了xmake插件,但是该插件不能够正常使用,希望能够增加对vscode web的适应性。
~/.config/code-server/config.yaml
绑定相应的ip地址与port。Note: If it is a 'bug report' or 'feature request', please select the corresponding issue template, otherwise this issue will be not replied.
Please describe your problem details here.
在VS code 中 C++ 源文件 如下
bool cPlcManager::ReadMtrCtrl( 中的 ::
会被标记为 红色波浪线
请问在 c_cpp_properties.json 文件中应该怎么配置,貌似 IntelliSense 的分析识别并不是很有效果
require了第三方库,include第三方头文件,但是vscode提示找不到(编译是没问题)
是不是可以通过解析第三方库的include路径,然后自动添加到vscode的c++ include path里?
无
无
windows平台
按照入门指导建立了一个工程.
啥都是最新版
当前的版本中只有选择目标平台target的选项,类似Windows,Linux,macos之类。但是我在Windows下做开发的话电脑上面不仅装了vs 2017的工具链,还装了clang和gcc,如果直接使用插件提供的选项进行编译的话会默认使用vs 2017,而如果要想使用其他的工具链就只能够自己写脚本或者配置task实现。
希望能够加入一个类似vscode插件cmake-tools的工具链的选择功能,能够扫描机器上面的工具链并且列出来以供选择,这样就方便许多。
主要是大部分从win平台过来的都习惯了F5,个人觉得最好能够把F5自动开启xmake run -d这个效果,类似nodejs的npm start。
然后我去看了一下关于launch.json的配置以及说明,感觉应该是可以对type这个字段下手,
我是参考了这里的,他里面type就是用了node,我感觉应该跟xmake调试启动接口类似,但是我接下来不是太明白这个地方type到底能不能自定义修改,可能需要跟vscode的插件实现有关系了吧?
不知道这个思路是不是已经有考虑过?我回头也会继续看看怎么搞。
使用xmake build
xmake run 可以正常使用
在vscode中使用xmake rebuild,然后debug,报错
Stopping due to fatal error: NullReferenceException: Object reference not set to an instance of an object
同时一个新的terminal被自动打开,zsh无法被加载,我的terminal用的是zsh
Note: If you use the fuzzy expressions such as 'can't use/no effect/problem/error', but don't give any relevant auxiliary information according to the template below, this issue will be not replied.
build按钮有时可以使用,有时不可以使用。主要表现就是在我修改cpp文件之后,按build按钮没有任何反应,必须自己手动输入xmake命令进行编译。除了build按钮不可用之外,运行按钮也不可用,只有debug按钮可以使用。重启vscode之后都可以使用。原因未知。
平台如下:
ubuntu 18.04
vscode 1.38.1 x64
VMware 15pro
xmake-vscode 似乎在 debug 时不能自定义参数,望可以加入自定义参数的选项
在 vscode 环境下,单击状态栏选择一个target的时候,希望能对弹出的target列表进行排序。
可以按下列顺序排序:
default
all
target 名称首字母排序
也可以按脚本中target定义的顺序排序。
无
xmake-vscode cannot be found in vscodium extensions search.
构建成功,就目录名不对
xmake.lua
add_rules("mode.release")
local lua_root = "lua-5.3.5/src"
local lua_lib_file_names =
{
"lapi.c",
"lcode.c",
"lctype.c",
"ldebug.c",
"ldo.c",
"ldump.c",
"lfunc.c",
"lgc.c",
"llex.c",
"lmem.c",
"lobject.c",
"lopcodes.c",
"lparser.c",
"lstate.c",
"lstring.c",
"ltable.c",
"ltm.c",
"lundump.c",
"lvm.c",
"lzio.c",
"lauxlib.c",
"lbaselib.c",
"lbitlib.c",
"lcorolib.c",
"ldblib.c",
"liolib.c",
"lmathlib.c",
"loslib.c",
"lstrlib.c",
"ltablib.c",
"lutf8lib.c",
"loadlib.c",
"linit.c"
}
-- lua interpreter
target("lua")
set_kind("binary")
add_files(lua_root.."/lua.c")
add_deps("lua_shared_lib")
target_end()
-- lua compiler
target("luac")
set_kind("binary")
add_files(lua_root.."/luac.c")
add_deps("lua_static_lib")
target_end()
-- lua shared lib
target("lua_shared_lib")
set_kind("shared")
set_basename("lua")
add_defines("LUA_USE_WINDOWS")
add_defines("LUA_BUILD_AS_DLL")
local file_name_count = table.getn(lua_lib_file_names);
local file_path;
for i = 1, file_name_count do
file_path = lua_root.."/"..lua_lib_file_names[i]
add_files(file_path)
end
target_end()
-- lua static lib
target("lua_static_lib")
set_kind("static")
set_basename("lua_static_lib")
add_defines("LUA_USE_WINDOWS")
local file_name_count = table.getn(lua_lib_file_names);
local file_path;
for i = 1, file_name_count do
file_path = lua_root.."/"..lua_lib_file_names[i]
add_files(file_path)
end
target_end()
When attempting to debug a program using the xmake Debug button in the VS Code extension, we get an error message popup.
Unable to start debugging. Launch options string provided by the project system is invalid. Unable to determine path to debugger. Please specify the “MIDebuggerPath” option.
The line that is causing the issue is:
https://github.com/xmake-io/xmake-vscode/blob/master/src/debugger.ts#L116
Putting the full path to gdb.exe in that field, eg:
miDebuggerPath: "C:/dev/msys64/mingw64/bin/gdb.exe",
... fixes it.
I do not know at this stage how to get the MinGW root from xmake in this extension so that we can append /bin/gdb.exe
to it.
在Windows下使用vscode远程连接Linux时,xmake的编译、debug等图标不可用。使用crtl+shift+p
调用xmake:build
xmake:debug
等也没有反应。
理论上应当与xmake和操作系统、vscode等的版本无关。在使用xmake的两年中,频繁出现过相同问题。且重新安装xmake的插件也是无效的。
最近一次出现问题的原因是,我安装了zsh
。然后使用在Windows下使用vscode远程连接服务器之后出现了xmake插件无法使用的情况。且没有任何报错提示。
我不是清楚xmake
插件那边的逻辑。不过在vscode中的命令行里面执行xmake
进行编译运行也是可以的。理论上xmake
的路径是可以被搜索到的。
After clicking the debug button (Debug the give target), the vscode debug toolbar appears but the program does not break at the entry point or any other break points.
After some investigation, I found that changing debugConfig externalConsole to false (in ...\out\src\debugger.js) makes the debugger working properly (I have microsoft cpp tools installed):
else if (os.platform() == "linux") {
debugConfig = {
...
// externalConsole: true,
externalConsole: false,
...
};
注:提问题时若使用
不能用/没效果/有问题/报错
此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将绝对不会有任何反馈。
目前的运行功能是主动打开一个终端,然后发送输入事件到终端,这里存在很多问题
1 是如果当前终端刚好有内容,则发送过去的输入就会直接尾随到其后,问题很大
2 是(大概是为了避免其他问题导致)发送两个换行符,这样会使得运行后的程序也收到两个换行。。。影响了执行结果
3 是如果vscode打开项目后再创建xmake相关文件,终端就不会自动打开了,然后快捷操作也不能使用了
使用 VSCode 内建的Task机制执行构建和运行命令,具体来说使用类似这个插件的机制去运行:https://marketplace.visualstudio.com/items?itemName=spmeesseman.vscode-taskexplorer
请提供其他附加信息帮助我们诊断问题。
调试第三方库的时候需要在 launch.json 里配置 source map
添加对应扩展配置选项, 例如 code-lldb 的: https://github.com/vadimcn/vscode-lldb/blob/v1.5.0/MANUAL.md#source-path-remapping
我自己本身有一个工程,目录树如下:
这里我是使用cmake进行自动化编译的。当我尝试使用xmake进行工程创建的时候,发现只能在src目录下进行创建,就变成了下面这样:
事实上,我希望我的工程应当与src在同级目录。这里产生的问题就有一是我本身就是一个git仓库,但是xmake又帮我创建了一个git仓库,二是我的所有东西都与源文件放在了一起。事实上我希望能够自己定义目录结构。同时进行编译过程中,发现include失败,如下:
或许可以允许用户指定新的目录,并创建目录树如下:
同时不要自己创建git仓库。让用户保有更大自主权。另一方面,关于头文件目录希望作者能够解决一下。
类似于这个扩展:
https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools
可以把一些功能放在侧边栏上操作,目前是全部放在状态栏.
“xmake.debuggingTargetsArguments” 不能正确发挥作用
"xmake.debuggingTargetsArguments": {
"tinydb" : ["tiny.db"],
"default": []
},
"xmake.runningTargetsArguments": {
"tinydb" : ["tiny.db"],
"default": []
}
设置完后点击运行run和debug按键,tinydb程序均可以带tinydb的参数(即"tiny.db")运行
按照targetName设置对应参数之后点击debug按键,仍然按照 default传参数运行
同时,run按键可以按照tinydb的参数运行。
很奇怪为什么run可以正确传参,而debug不行
When starting a debugging session with XMake: Debug
, the program is paused on entry. Is there a way to disable this behavior? If there isn't, it would be nice to add this option. In programs debugged with gdb/lldb/etc, in the launch.json
configuration, you can set the stopOnEntry
field. Because XMake is not run through launch.json
, I think it would be reasonable.
If it is okay, I could submit a PR for this.
主机: MacOS 10.15.3
服务端: Windows 2019, OpenSSH-Server
测试代码为xmake创建的基础工程,没有添加其它代码,点底部的 build 报告错误.
> Executing task: xmake -v <
/d : The term '/d' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ /d /c xmake -v
+ ~~
+ CategoryInfo : ObjectNotFound: (/d:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我试了下正常在命令行输入xmake则能正常编译.
我已经使用过xmake project -k compile_commands
生成compile_commands.json文件
但是intellisense无法识别*.ui生成的ui_.h文件
推测是compile_commands.json的includePath不含ui_.h
如题, 同时安装2个插件后,vim插件无法移动光标,无法出字..
Note: If you use the fuzzy expressions such as 'can't use/no effect/problem/error', but don't give any relevant auxiliary information according to the template below, this issue will be not replied.
在树莓派4b安装vscarm-64版本,使用xmake插件,架构固定显示x86/x64
点击x86/x64切换架构时,报错Running the contributed command:'xmake.setargetarch' failed
Running the contributed command:'xmake.setargetarch' failed
Please provide compiling and running environment information:
Find no way to set "program" in lauch.json.
Thanks
注:提问题时若使用
不能用/没效果/有问题/报错
此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将会直接标记为Invalid。
如图所示,用VS Code+Msys2 gdb时点击debug按钮没有UI提示,断点也没有作用。
有debug UI提示
没有错误信息
如果是xmake相关编译问题,请加上
-vD
参数运行,并给出详细编译输出信息。
请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:
项目配置就是默认xmake create
产生的,只在main.cpp
中加了几行。
命令行xmake r -d
没有问题,用Visual Studio调试也没有问题。
不能用/没效果/有问题/报错
此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将会直接标记为 Invalid。插件自动生成的compile_commands.json没有包含QT相关的头文件路径
{
"directory": "D:\\workspace\\xmake",
"arguments": ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX64\\x64\\cl.exe", "/c", "/EHsc", "/nologo",
"/ID:\\workspace\\xmake\\build\\.gens\\xmake\\windows\\x64\\debug\\rules\\qt\\ui",
"/Fobuild\\.objs\\xmake\\windows\\x64\\debug\\src\\main.cpp.obj", "src\\main.cpp"],
"file": "src\\main.cpp"
},
使用命令xmake project -k compile_commands
生成的compile_commands.json包含了Qt的头文件路径
{
"directory": "D:\\workspace\\xmake",
"arguments": ["C:\\Program Files (x86)\\Microsoft Visual
Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX64\\x64\\cl.exe", "/c", "/EHsc", "/nologo", "/Zi", "/FS",
"/Fdbuild\\windows\\x64\\debug\\compile.xmake.pdb", "/Od",
"/ID:\\workspace\\xmake\\build\\.gens\\xmake\\windows\\x64\\debug\\rules\\qt\\ui", "/DQT_QML_DEBUG",
"/DQT_DEPRECATED_WARNINGS", "/DQT_CONCURRENT_LIB", "/DQT_GUI_LIB", "/DQT_WIDGETS_LIB", "/DQT_CORE_LIB",
"/D_WINDOWS", "/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtConcurrent",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtGui",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtGui\\5.12.11",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtGui\\5.12.11\\QtGui",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtWidgets",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtWidgets\\5.12.11",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtWidgets\\5.12.11\\QtWidgets",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtCore",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtCore\\5.12.11",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include\\QtCore\\5.12.11\\QtCore",
"/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\include", "/IC:\\Programming\\Qt\\5.12.11\\msvc2017_64\\mkspecs\\win32-
msvc", "/Fobuild\\.objs\\xmake\\windows\\x64\\debug\\src\\main.cpp.obj", "src\\main.cpp"],
"file": "src\\main.cpp"
},
请提供编译和运行环境信息,下面是一些必须填写的基础信息,便于我们针对性排查问题:
请提供关键的 xmake.lua 配置内容,或者完整 xmake.lua,也可以是其他附加信息帮助我们诊断问题(比如截图,xmake.lua或者可复现的demo),以及你遇到的问题的一些背景信息。
点击debug按钮,虽然能运行,但是不能调试,相当于直接运行程序。不过不是插件问题,试了一下,是cppdbg这个调试类型调试不了程序了,最后换了一个类型(安装codelldb插件,也可以调试rust的玩意),就可以了。不过插件的debug小按钮固定使用一个debug配置,现在每个项目都要用vscode自带的调试了。
必须先把要用的动态dll复制到工程build的相应目录下,才能调试?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.