How does VScode shield unnecessary files and add search header file paths

1. Block unwanted files

When doing embedded Linux development, there may be many files that we don't need in the entire project. When importing VScode, these project files will be imported. The entire project file looks very complicated. At this time, we can Shield the unnecessary related files. The shielding here is not to delete, but not to be displayed in VScode.

Create a folder named ".vscode" on VSCode

Create a new file named "settings.json" in the .vscode folder, and enter the following in settings.json

{
 	"search.exclude": {
 		"**/node_modules": true,
 		"**/bower_components": true,
 	},
 	"files.exclude": {
		 "**/.git": true,
 		"**/.svn": true,
 		"**/.hg": true,
 		"**/CVS": true,
 		"**/.DS_Store": true, 
 	}
}

Among them, "search.exclude" contains the files or folders that need to be excluded from the search results , and "files.exclude" contains the files or folders that need to be excluded in the project directory on the left .

2. How to add VScode search path

Under linux development, sometimes a Linux driver is written, so functions in the Linux source code are used. We need to add the header file path in the Linux source code in VScode.

Open VScode, press "Crtl+Shift+P" to open the VScode console, then enter "C/C++:Editconfigurations(JSON)" to open the C/C++ editing configuration file. After opening, a file will be automatically generated in the .vscode directory. A file named c_cpp_properties.json, the default content of this file is as follows:

{
 	"configurations": [
	 	{
 			"name": "Linux",
 			"includePath": [
 			"${workspaceFolder}/**",
			 ],
 			"defines": [],
 			"compilerPath": "/usr/bin/clang",
	 		"cStandard": "c11",
 			"cppStandard": "c++17",
 			"intelliSenseMode": "clang-x64"
	 	}
	 ],
 	"version": 4
 }

includePath indicates the header file path, we need to add the header file path in the Linux source code. In this way, when VScode searches for functions, these header file paths will also be traversed.

Guess you like

Origin blog.csdn.net/Damon_Sandy/article/details/130341689