VScode 隐藏大量无用的文件比如在看Linux kernel或boot时候
作者:梅尔文.古
1. VScode 工程创建
先在 Ubuntu 下编译一下 uboot,然后将编译后的 uboot 文件夹复制到 windows 下,并创建VScode 工程。打开 VScode,选择:文件->打开文件夹…,选中 uboot 文件夹,如图所示:
点击“文件->将工作区另存为…”,打开保存工作区对话框,将工作区保存到 uboot 源码根目录下,设置文件名为“uboot”
2. 使用步骤
保存成功以后就会在 uboot 源码根目录下存在一个名为 uboot.code-workspace 的文件。这样一个完整的 VSCode 工程就建立起来了。但是这个 VSCode 工程包含了 uboot 的所有文件, uboot中有些文件是不需要的,比如 arch 目录下是各种架构的文件夹,
在 arch 目录下,我们只需要 arm 文件夹,所以需要将其它的目录从 VSCode 中给屏蔽掉,比如将 arch/avr32 这个目录给屏蔽掉。在 VSCode 上建名为“.vscode”的文件夹,
在.vscode 文件夹中新建一个名为“settings.json”的文件,然后在 settings.json 中输入如下内容:
{ "search.exclude": { "**/*.o":true, "**/*.su":true, "**/*.cmd":true, "arch/arc":true, "arch/avr32":true, "arch/blackfin":true, "arch/m68k":true, "arch/microblaze":true, "arch/mips":true, "arch/nds32":true, "arch/nios2":true, "arch/openrisc":true, "arch/powerpc":true, "arch/sandbox":true, "arch/sh":true, "arch/sparc":true, "arch/x86":true, "arch/arm/mach*":true, "arch/arm/cpu/arm11*":true, "arch/arm/cpu/arm720t":true, "arch/arm/cpu/arm9*":true, "arch/arm/cpu/armv7m":true, "arch/arm/cpu/armv8":true, "arch/arm/cpu/pxa":true, "arch/arm/cpu/sa1100":true, "board/[a-e]*":true, "board/[g-z]*":true, "board/[0-9]*":true, "board/[A-Z]*":true, "board/fir*":true, "board/freescale/b*":true, "board/freescale/l*":true, "board/freescale/m5*":true, "board/freescale/mp*":true, "board/freescale/c29*":true, "board/freescale/cor*":true, "board/freescale/mx7*":true, "board/freescale/mx2*":true, "board/freescale/mx3*":true, "board/freescale/mx5*":true, "board/freescale/p*":true, "board/freescale/q*":true, "board/freescale/t*":true, "board/freescale/v*":true, "configs/[a-l]*":true, "configs/[n-z]*":true, "configs/[A-Z]*":true, "configs/M[a-z]*":true, "configs/M[A-Z]*":true, "configs/M[0-9]*":true, "configs/m[a-w]*":true, "configs/m[0-9]*":true, "configs/[0-9]*":true, "include/configs/[a-l]*":true, "include/configs/[n-z]*":true, "include/configs/[A-Z]*":true, "include/configs/m[a-w]*":true, }, "files.exclude": { "**/*.o":true, "**/*.su":true, "**/*.cmd":true, "arch/arc":true, "arch/avr32":true, "arch/blackfin":true, "arch/m68k":true, "arch/microblaze":true, "arch/mips":true, "arch/nds32":true, "arch/nios2":true, "arch/openrisc":true, "arch/powerpc":true, "arch/sandbox":true, "arch/sh":true, "arch/sparc":true, "arch/x86":true, "arch/arm/mach*":true, "arch/arm/cpu/arm11*":true, "arch/arm/cpu/arm720t":true, "arch/arm/cpu/arm9*":true, "arch/arm/cpu/armv7m":true, "arch/arm/cpu/armv8":true, "arch/arm/cpu/pxa":true, "arch/arm/cpu/sa1100":true, "board/[a-e]*":true, "board/[g-z]*":true, "board/[0-9]*":true, "board/[A-Z]*":true, "board/fir*":true, "board/freescale/b*":true, "board/freescale/l*":true, "board/freescale/m5*":true, "board/freescale/mp*":true, "board/freescale/c29*":true, "board/freescale/cor*":true, "board/freescale/mx7*":true, "board/freescale/mx2*":true, "board/freescale/mx3*":true, "board/freescale/mx5*":true, "board/freescale/p*":true, "board/freescale/q*":true, "board/freescale/t*":true, "board/freescale/v*":true, "configs/[a-l]*":true, "configs/[n-z]*":true, "configs/[A-Z]*":true, "configs/M[a-z]*":true, "configs/M[A-Z]*":true, "configs/M[0-9]*":true, "configs/m[a-w]*":true, "configs/m[0-9]*":true, "configs/[0-9]*":true, "include/configs/[a-l]*":true, "include/configs/[n-z]*":true, "include/configs/[A-Z]*":true, "include/configs/m[a-w]*":true, } }
其中"search.exclude"里面是需要在搜索结果中排除的文件或者文件夹, "files.exclude"是左侧工程目录中需要排除的文件或者文件夹。我们需要将 在arc文件夹中除了 arm 以及board文件夹中除了freescale 文件夹下的所有文件从搜索结果和左侧的工程目录中都排除掉,因此在 "search.exclude"和"files.exclude"中输入如图
上述代码用到了通配符“”,比如“**/.o”表示所有.o 结尾的文件。“configs/[a-l]*”表示 configs 目录下所有以‘a’ ~‘l’开头的文件或者文件夹。 上述配置只是排除了一部分文件夹,大家在实际的使用中可以根据自己的实际需求来选择将哪些文件或者文件夹排除掉。排除以后我们的工程就会清爽很多,搜索的时候也不会跳出很多文件了。
3. 在Linux kernel中,要忽略掉的内容
{ "search.exclude": { "**/node_modules": true, "**/bower_components": true, "**/*.o":true, "**/*.su":true, "**/*.cmd":true, "Documentation":true, /* 屏蔽不用的架构相关的文件 */ "arch/alpha":true, "arch/arc":true, "arch/arm64":true, "arch/avr32":true, "arch/[b-z]*":true, "arch/arm/plat*":true, "arch/arm/mach-[a-h]*":true, "arch/arm/mach-[n-z]*":true, "arch/arm/mach-i[n-z]*":true, "arch/arm/mach-m[e-v]*":true, "arch/arm/mach-k*":true, "arch/arm/mach-l*":true, /* 屏蔽排除不用的配置文件 */ "arch/arm/configs/[a-h]*":true, "arch/arm/configs/[j-z]*":true, "arch/arm/configs/imo*":true, "arch/arm/configs/in*":true, "arch/arm/configs/io*":true, "arch/arm/configs/ix*":true, /* 屏蔽掉不用的DTB文件 */ "arch/arm/boot/dts/[a-h]*":true, "arch/arm/boot/dts/[k-z]*":true, "arch/arm/boot/dts/in*":true, "arch/arm/boot/dts/imx1*":true, "arch/arm/boot/dts/imx7*":true, "arch/arm/boot/dts/imx2*":true, "arch/arm/boot/dts/imx3*":true, "arch/arm/boot/dts/imx5*":true, "arch/arm/boot/dts/imx6d*":true, "arch/arm/boot/dts/imx6q*":true, "arch/arm/boot/dts/imx6s*":true, "arch/arm/boot/dts/imx6ull-9x9*":true, "arch/arm/boot/dts/imx6ull-14x14-ddr*":true, "arch/arm/boot/dts/*.tmp":true, }, "files.exclude": { "**/.git": true, "**/.svn": true, "**/.hg": true, "**/CVS": true, "**/.DS_Store": true, "**/*.o":true, "**/*.su":true, "**/*.cmd":true, "Documentation":true, /* 屏蔽不用的架构相关的文件 */ "arch/alpha":true, "arch/arc":true, "arch/arm64":true, "arch/avr32":true, "arch/[b-z]*":true, "arch/arm/plat*":true, "arch/arm/mach-[a-h]*":true, "arch/arm/mach-[n-z]*":true, "arch/arm/mach-i[n-z]*":true, "arch/arm/mach-m[e-v]*":true, "arch/arm/mach-k*":true, "arch/arm/mach-l*":true, /* 屏蔽排除不用的配置文件 */ "arch/arm/configs/[a-h]*":true, "arch/arm/configs/[j-z]*":true, "arch/arm/configs/imo*":true, "arch/arm/configs/in*":true, "arch/arm/configs/io*":true, "arch/arm/configs/ix*":true, /* 屏蔽掉不用的DTB文件 */ "arch/arm/boot/dts/[a-h]*":true, "arch/arm/boot/dts/[k-z]*":true, "arch/arm/boot/dts/in*":true, "arch/arm/boot/dts/imx1*":true, "arch/arm/boot/dts/imx7*":true, "arch/arm/boot/dts/imx2*":true, "arch/arm/boot/dts/imx3*":true, "arch/arm/boot/dts/imx5*":true, "arch/arm/boot/dts/imx6d*":true, "arch/arm/boot/dts/imx6q*":true, "arch/arm/boot/dts/imx6s*":true, "arch/arm/boot/dts/imx6ull-9x9*":true, "arch/arm/boot/dts/imx6ull-14x14-ddr*":true, "arch/arm/boot/dts/*.tmp":true, }, "files.associations": { "kernel.h": "c", "fs.h": "c", "list.h": "c", "init.h": "c", "i2c.h": "c", "uaccess.h": "c", "i2c-dev.h": "c", "module.h": "c", "slab.h": "c" }, }
到此这篇关于VScode 隐藏大量无用的文件比如在看Linux kernel或boot时候的文章就介绍到这了,更多相关VScode 隐藏无用文件内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!