windows vscode使用
vscode删除干净
- 使用 工具卸载干净
- 删除 C:\Users\darling.vscode 文件夹 ps:darling 是你自己的个人用户,也就是你打开电脑,进入c盘->用户就可以看到
- 删除 C:\Users\darling\AppData\Roaming\Code文件夹
删除这三个基本上就是删除干净了
2024.9.2 更新关于显示配置setting.json文件
- 本地(电脑的) setting.json配置
{
"files.autoGuessEncoding": true,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
// cmake_build 另外建目录,不要覆盖了原来的 build/Makefile
"cmake.buildDirectory": "${workspaceFolder}/cmake_build",
// 大部分工程都是在build目录中编译的,如果个别工程是在其他目录编译的,在workspace中单独修改
"C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json",
"editor.indentSize": "tabSize",
"files.exclude": {
"**/Example/**": true,
"**/Src/VSPHSAppV2/**": true,
"**/Test/**": true,
"**/UnitTest/**": true
},
"editor.fontLigatures": false,
"editor.inlayHints.enabled": "off",
"files.watcherExclude": {
"**/.svn/**": true,
"**/**.svn/**": true
},
"javascript.format.placeOpenBraceOnNewLineForControlBlocks": true
}
- 远程 setting.json配置
{
"remote.SSH.remotePlatform": {
"10.6.5.218": "linux",
"10.6.5.183": "linux"
},
"editor.fontSize": 16,
"workbench.settings.applyToAllProfiles": [],
"files.autoGuessEncoding": true,
"files.exclude": {
"**/Example/**": true,
"**/Src/VSPHSAppV2/**": true,
"**/Test/**": true,
"**/UnitTest/**": true
},
"Lingma.localMachineModel": true,
"editor.inlayHints.enabled": "off",
"C_Cpp.clang_format_style": "{ BasedOnStyle: LLVM, BreakBeforeBraces: Attach }",
"terminal.integrated.enableMultiLinePasteWarning": false,
"makefile.configureOnOpen": true
}
配置问题
-
自动识别编码,需要开启一下识别编码配置,参考: https://zhuanlan.zhihu.com/p/553457718?utm_id=0
-
连接到远程很慢,主要是你本地安装中文插件,远程没有安装,具体参考 : https://blog.csdn.net/weixin_49325064/article/details/133941514
-
远程插件安装慢:从 https://marketplace.visualstudio.com/publishers/Microsoft 这个里面下载插件,然后通过VSI安装
-
vscode卡顿优化设置,https://blog.csdn.net/weixin_40968646/article/details/129144667
-
搜索忽略指定的文件夹 ,参考: https://zhuanlan.zhihu.com/p/654171310
-
clangd插件中vscode关闭函数调用时的形参显示: https://blog.csdn.net/airhcoaz/article/details/124850316
使用vscdoe开发c++程序,在刚配置好clangd环境后,会发现函数调用会显示函数的形参名,如下图
这种提示虽然有助于我们开发,但是也有不好的地方,会妨碍我们控制代码的长度。在配置中可以将inlay Hints设置成off把提示关闭。
mac vscode的使用
做c/c++开发的,其实还是更习惯使用source insight的,尤其是si的全局模糊匹配的功能,这个切到vscode后最难适应的,但但无奈si没有mac版本,那就切到vscode,并慢慢去熟练使用吧~
谨以此文记录一下vscode从入门到放弃😊
clangd插件关闭自动类型推导
点击左下的齿轮图标->设置,搜索inlayHints ,有4个下拉选项
- on: 始终显示内联提示
- onUnlessPressed: 默认显示内联提示,并在按Ctrl+Alt时隐藏
- offUnlessPressed: 默认隐藏内联提示,并在按Ctrl+Alt时显示
- off: 始终隐藏内联提示
- 插件
-
高亮插件
名称: highlight
是一个红色的插件里面有描述写,高亮,我个人很喜欢这个插件,从si过来的,一定不要下错了,装完后,高亮插件快捷键是shift fn f8 ,可以自己改,自己改的在快捷键里面,直接搜这个快捷键就会出来
修改高亮快捷键:
-
注释插件
名称: Doxygen Documentation Generator
直接上注释插件配置文件吧{ "doxdocgen.file.copyrightTag": [ "\nCopyright (C), ZheJiang Dahua Technology Stock CO.LTD.\n", ], "doxdocgen.file.fileTemplate": "Filename Main.cpp", "doxdocgen.file.versionTag": "version 1.0.0", "doxdocgen.generic.paramTemplate": "@param \t {param}:", "doxdocgen.generic.dateFormat": "YYYY/MM/DD", "doxdocgen.generic.authorEmail": "ni_dailiang@dahuatech.com", "doxdocgen.generic.authorName": "ni_dailiang", "doxdocgen.generic.authorTag": "@author \t {author}", "doxdocgen.generic.dateTemplate": "@date \t {date}", "doxdocgen.generic.briefTemplate": "@brief \t 注释", "doxdocgen.generic.returnTemplate": "@return \t 返回值", "doxdocgen.file.customTag": [ // 文件级的自定义注释 "Author {author}", "Version 1.0.0", "Date {date}", "Description The function interface", "Revisions {date} : create file" ], "doxdocgen.generic.customTags": [ "@note\t 特殊说明", ], // 文件注释 "doxdocgen.file.fileOrder": [ "copyright", "file", "custom", ], // 函数注释 "doxdocgen.generic.order": [ "author", "date", "brief", "param", "return", "custom" ], "doxdocgen.generic.useGitUserEmail": true, "doxdocgen.generic.useGitUserName": true, }
使用的话在文件开始或者函数上输入 /** 再回车,会自动补全相关注释,个人觉得还是好用
-
查看内存插件
名称: MemoryView
可以查看运行的代码内存,不做演示了
-
快捷键:
快速打开关闭左侧弹窗:command b
快速打开关闭终端:control ~(1左边的那个按键)
快速打开关闭下侧窗口: command j
全文搜索: command p
当前文件全文搜索函数: command shift o 或者 command p后输入@
快速跳转到行:control g
撤销/反撤销 :control z / control shift z
快速多行注释和取消注释:command /
注释一整段代码:option + shift + a
进入所选字段 : command 鼠标左键
返回上一层/进入下一层:control - / control shift -
高亮: shift fn f8
文件头尾: command ↑ / command ↓ -
其他:
vscode无法更新问题
在终端输入以下命令sudo chown -R $USER ~/Library/Caches/com.microsoft.VSCode.ShipIt
输入后,回车会提示输入密码。
xattr -dr com.apple.quarantine /Applications/Visual\ Studio\ Code.app
“/Applications/Visual\ Studio\ Code.app” 部分为vscode的目录。输入完后,回车。
这样就可以解决出现的问题。