VSCode Search: Exclude & Except

VSCode Search: Exclude & Except

Dec 14, 2022 01:11 AM
Last edited time
Dec 14, 2022 01:30 AM
Here is the Linux kernel code base.
❯ ls arch include mm tools Kbuild modules.order block init net usr Kconfig README certs io_uring rust virt MAINTAINERS System.map crypto ipc samples built-in.a Makefile vmlinux Documentation kernel scripts compile_commands.json Module.symvers vmlinux.a drivers lib security COPYING modules.builtin vmlinux.o fs LICENSES sound CREDITS modules.builtin.modinfo
I want to find all code that includes start_kernel. In VSCode, I can do this.
notion image
notion image
I don’t want to see the code of architecture other than RISC-V, so I can exclude them.
exclude: arch/[^r]*
This line means to exclude all files in the arch folder, except the one that starts with the letter ‘r’.
Notice that I still want to see all code including start_kernel out of the arch folder.
Or, I can use include to specify multiple architectures specifically.
include: ./[^a]*/**, ./arch/riscv/**
./[^a]*/** includes all files except those in the folder starting with the letter ‘a’. The only folder that starts with ‘a’ is arch. So it means to include all files except those in the arch folder.
notion image