vscode使用技巧汇总帖(visual studio code)
1.vscode选中变量后高亮显示的颜色
setting->command Palettre...

在输入框里输入setting.json,选择Preferences:Open Settings(JSON)

添加如下文本,并保存

参考:https://www.helloworld.net/p/7818308288
2.VS Code配置选中后相同内容高亮功能_类似于source insight 中的shift+F8高亮功能
highlight-words插件
参考:https://blog.csdn.net/u013171226/article/details/108868425
3.vs code经过一系列设置后,这些个人信息保存路径如下
C:\Users\pcName\AppData\Roaming\Code\User( 注意替换pcName为自己电脑设置的名称)
目前我本机的配置如下

也可以通过gui打开相同的文件

keybindings.json
// Place your key bindings in this file to override the defaultsauto[] [ { "key": "ctrl+right", "command": "workbench.action.navigateForward" }, { "key": "ctrl+left", "command": "workbench.action.navigateBack" }, { "key": "f8", "command": "highlightwords.addHighlight" }, { "key": "ctrl+enter", "command": "editor.action.revealDeclaration" }, { "key": "ctrl+k", "command": "editor.action.marker.nextInFiles", "when": "editorFocus" }, { "key": "ctrl+l", "command": "PowerShell.RunSelection", "when": "editorTextFocus && editorLangId == 'powershell'" } ]
settings.json
{ "workbench.colorCustomizations": { //"editor.selectionBackground": "#d1d1c6", //"editor.selectionHighlightBackground": "#c5293e" }, "editor.hover.enabled": false, "editor.minimap.enabled": false, "workbench.startupEditor": "none", "[python]": { "editor.formatOnType": true }, "editor.fontSize": 14, "workbench.colorTheme": "Default Light Modern", "remote.SSH.remotePlatform": { "192.168.56.101": "linux", "192.168.56.102": "linux", "192.168.56.103": "linux" }, "git.repositoryScanMaxDepth": 10, "window.zoomLevel": 0.5, "security.workspace.trust.untrustedFiles": "open", "terminal.integrated.copyOnSelection": true, "cmake.configureOnOpen": true, "files.exclude": { //for m55h project, it is softlink, so exclude these three. "**/rootfs/rootfs/lib/modules/4.19.125/source/**": true, //rootfs/rootfs/lib/modules/4.19.125/source -> kernel/linux/linux-4.19.125 "**/rootfs/rootfs/lib/modules/4.19.125/build/**": true, //rootfs/rootfs/lib/modules/4.19.125/build -> kernel/linux/linux-4.19.125 "**/rootfs/rootfs/lib32/**": true, //rootfs/rootfs/lib32 -> rootfs/rootfs/lib "**/kernel/linux/linux-4.19.125/scripts/dtc/include-prefixes/**": true, //all sub directory under kernel/linux/linux-4.19.125/scripts/dtc/include-prefixes are softlink // "**/.DS_Store": false, // "**/.git": false, // "**/.hg": false, // "**/.svn": false, // "**/CVS": false, // "**/Thumbs.db": false }, "search.exclude": { //for current project, it is softlink, so exclude these three. "**/rootfs/rootfs/lib/modules/4.19.125/source/**": true, //rootfs/rootfs/lib/modules/4.19.125/source -> kernel/linux/linux-4.19.125 "**/rootfs/rootfs/lib/modules/4.19.125/build/**": true, //rootfs/rootfs/lib/modules/4.19.125/build -> kernel/linux/linux-4.19.125 "**/rootfs/rootfs/lib32/**": true, //rootfs/rootfs/lib32 -> rootfs/rootfs/lib "**/kernel/linux/linux-4.19.125/scripts/dtc/include-prefixes/**": true, //all sub directory under kernel/linux/linux-4.19.125/scripts/dtc/include-prefixes are softlink // "**/*.code-search": false, // "**/bower_components": false, // "**/node_modules": false }, "C_Cpp.intelliSenseEngine": "Tag Parser", "cmake.showOptionsMovedNotification": false, "json.schemas": [ ] }
4.在source control下面显示 内嵌的git repo

打开setting,在里面搜索git.repositoryScanMaxDepth,并设置成 你想要的检测深度,即可,这里我设置成了10。

参考:https://github.com/microsoft/vscode/issues/161797
5.How To Always Open Files in New Tab in VSCode
https://www.automationdojos.com/how-to-always-open-files-in-new-tab-in-vscode/
6.vscode中通过ssh连接服务器时,不需要每次都输入密码
https://www.cnblogs.com/midhillzhou/p/18081415
7.在搜索结果中,忽略某些文件夹
可以按如下方式进行添加,也可以直接到setting.json中添加,更加本质化,具体参看上面第3节中的setting.json文件。


8.vscode跳转到定义的性能问题
8.1 在文件-首选项-设置中搜索C_Cpp.intelliSenseEngine
8.2 指定使用的引擎为Tag Parser
参考:https://blog.csdn.net/gzxb1995/article/details/137675838
9.向下滚动代码的时候,发现第一行会显示当前作用域的第一行的内容

在第一行上右键,不勾选sticky scroll。

恢复这个功能如下

10.搜索结果显示行号


浙公网安备 33010602011771号