Posts with tag vscode

Setup clangd, cmake just like on unix

2024-07-03
softwares-and-toolsvscodewindows

Setup clangd, cmake just like on unixref: https://blog.csdn.net/tyKuGengty/article/details/120119820 (not reliable) ref: https://www.perplexity.ai/search/windows-shang-ru-he-huo-qu-he-UAy020tWRWG50tRSmDYuIw#0Don'tDon't use clangd exe downloaded by clangd extension in vscode.Don't need tasks.json like files.StepsInstall msys2 https://www.msys2.org/Install C++ toolchainpacman -Syu pacman -S mingw-w64-x86_64-gcc pacman -S mingw-w64-x86_64-cmake # use cmake --build ., no need make pacman -S mingw-w64-x86_64-clang pacman -S mingw-w64-x86_64-clang-tools-extra # clangd is hereFind your clangd.exe in C:\msys64\mingw64\clangd.exePut the path in your vscode clangd settings.Done.TestCreate unix like cmake projectcd buildcmake ..Reload vscode window and see if it can find headersIf you want lsp without cmakeAdd this two flags to your vscode clangd fallback flags:-IC:/msys64/mingw64/include/c++/14.1.0 --target=x86_64-w64-windows-gnucheck if a single file can find headers.(Tested ok)Use ninjaIn msys2:pacman -S mingw-w64-x86_64-ninjaWrite cmake as usual. ref: https://blog.51cto.com/u_15127539/3336648cd build # I forget if I need to specify "build for ninja". This just works on my win10 now cmake .. ninja installGo to install/bin/ and check generated executable

remote-ssh-failed

2024-05-21
remote-sshsoftwares-and-toolsvscode

无法在远程服务器上自动安装 VSCode Server关了梯子试试。23.9.18 这样解决的。但是随即又失败了,没有解决啊。无法连接远程,但插件 Output 有正常输出试试 https://stackoverflow.com/questions/64034813/vs-code-remote-ssh-connection-not-working 中的所有方法24.5.21(应该没有用)先删除本地 known_hosts删除远程 ~/.vscode-server/在本地 VSCode Settings 文件中加入 "remote.SSH.useLocalServer": false, "remote.SSH.useExecServer": false,成功。24.6.19error: 无法连接远程,插件输出 connectionTimeoutproblem: 在插件输出中发现 ssh 命令是 ssh -v -T -D 49942 -o ConnectTimeout=15 47.103.61.134,没有用户名很奇怪(虽然使用 remote-ssh 的时候我是带用户名的)在 ~/.ssh/config 中添加一个 config 记录,手动指定用户名和服务器Host mfa HostName 47.103.61.134 User julyfun再检查检查有没有重复的 HostName,删除重复的成功24.9.27今天即使在 ssh config 中配好了 Host,还是 SSH Timed out. 排除法发现是 vscode ssh 命令自带的 ssh -T 选项造成的超时,该选项要求不分配伪终端。结果还是通过在本地 settings 中添加此来解决: "remote.SSH.useLocalServer": false, "remote.SSH.useExecServer": false

python-debug

2024-01-23
debugpythonsoftwares-and-toolsvscode

This method is verified!https://code.visualstudio.com/docs/python/debugginghttps://stackoverflow.com/questions/51244223/visual-studio-code-how-debug-python-script-with-arguments开始vscode cmd: show run and debug.click 'create launch.json'A file is created.If you wanna run shell script for python like this:CUDA_VISIBLE_DEVICES=0 python cloth_funnels/run_sim.py \ name="demo-single" \ load=models/longsleeve_canonicalized_alignment.pth \ eval_tasks=assets/tasks/longsleeve-single.hdf5 \ eval=True \ num_processes=1 \ episode_length=10 \ wandb=disabled \ fold_finish=True \ dump_visualizations=True Add args like, [tested ok]:{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Python: 当前文件", "type": "python", "request": "launch", "program": "${file}", // "program": "${workspaceFolder}/script/eval_policy.py", // 这样也行 "console": "integratedTerminal", "args": ["name=\"demo-single\"", "load=models/longsleeve_canonicalized_alignment.pth", "eval_tasks=assets/tasks/longsleeve-single.hdf5", "eval=True", "num_processes=1", "episode_length=10", "wandb=disabled", "fold_finish=True", "dump_visualizations=True"], "env": { "CUDA_VISIBLE_DEVICES": "0", "HYDRA_FULL_ERROR": "1", }, } ] }Switch to the file you want to run (as in launch.json we by default designate "Run current file", so you have to switch to the exact file to run).Add a breakpoint,Click the green delta in "Run python and debug" menu,Everything is well! And watch params in the menu!RemoteUsing vscode-ssh is also ok to run python debug in remote machine

怎么用-vscode-写-unity-脚本-以及-intellisense

2024-01-15
softwares-and-toolsunityvscode

https://zhuanlan.zhihu.com/p/245846735其中的 Mono SDK 似乎不用安装也可以。安装后重启电脑!然后再从 unity 打开脚本,intellisense 可以正常用了!甚至可以点开外部库函数!以上测试日期 23-11-3,uname -a 为:Darwin floriandeMacBook-Air.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103 arm64但是过了一会儿 intellisense 又没了。又提示“在计算机上找不到已安装的 .NET SDK”。所以我再次重启电脑。重启后 vscode C# 插件通知:某插件只适用于 SDK 样式项目,是否要为工作区使用 C# 插件?我说好的,然后 intellisense 又回来了。过几天没有 intellisense 了,提示 C# 插件只适用于 SDK 样式项目让你选择要不要为工作区使用 C# 插件。你就选择使用。然后它让你重启工作区,就有智能提示了。过几天又“在计算机上找不到 .NET SDK” ... path...重启电脑,没啥办法。另一个可能的方案https://zhuanlan.zhihu.com/p/601343633?utm_id=

c-cmake-debug

2024-01-15
debugsoftwares-and-toolsvscode

原理是这样的,你编译出来的可执行文件只要是编译的时候开了 Debug 的时候,是可以直接调试的。所以你在 cmakelists.txt 加上:set(CMAKE_BUILD_TYPE "Debug")然后去 cmake + make 一下。现在,用 vscode 命令面板唤出 debug 面板。面板里有一个链接让你创建 launch.json。你点击会让你选择调试环境,你选 LLDB 他生成一个 json,然后这个 json 内容改成这样:{ "version": "0.2.0", "configurations": [ { "type": "lldb", "request": "launch", "name": "Debug", "program": "${workspaceFolder}/build/demo", "args": [], "cwd": "${workspaceFolder}" } ] }这边 "program" 条目你改成要执行的文件。没错直接可执行文件就行了。现在在源文件里面加一个断点,然后捏点击 debug 面板上方的播放按钮。他就会停在断点了。还会出现一个小长条工具栏,用来到下一行、跳转行等。一般你用 F10 逐过程,避免进入每个函数。如果你要输入数据,就在面板的“终端”里面输入。Problem点击创建 launch.json 的时候可能会卡。这可能是因为某些其他语言的 vscode debugger 在试图更新自己的配置。建议手动创建 launch.json 或者等一等就会有

No more posts to load.