microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.35k stars 28.6k forks source link

files.exclude使用正则表达式匹配字符时出现问题 #54337

Closed jzz007 closed 6 years ago

jzz007 commented 6 years ago

Issue Type: Bug

首先我写了如下的配置文件,用于排除对我没用的BSP(板级支持包)(frist i wrote a setting.json like below, to remove useless BSP(board sport package) for me):

"files.exclude": {
        "**/bsp/l*":true,
        "**/bsp/m*":true,
        "**/bsp/n*":true,
        "**/bsp/c*":true,
        "**/bsp/i*":true,
        "**/bsp/a*":true,
        "**/bsp/b*":true,
        "**/bsp/C*":true,
        "**/bsp/d*":true,
        "**/bsp/f*":true,
        "**/bsp/g*":true,
        "**/bsp/h*":true,
        "**/bsp/p*":true,
        "**/bsp/r*":true,
        "**/bsp/q*":true,
        "**/bsp/t*":true,
        "**/bsp/x*":true,
        "**/bsp/e*":true,
        "**/bsp/u*":true,
        "**/bsp/w*":true,
        "**/bsp/z*":true,
        "**/bsp/sa*":true,
        "**/bsp/se*":true,
        "**/bsp/si*":true,
        "**/bsp/stm32l*":true,
        "**/bsp/stm32h*":true,
        "**/bsp/stm32f0*":true,
        "**/bsp/stm32f1*":true,
        "**/bsp/stm32f2*":true,
        "**/bsp/stm32f4*":false,
        "**/bsp/stm32f7*":true,
        "**/bsp/stm32f107":true,
        "**/bsp/stm32f10x-*":true,
        "**/bsp/stm32f40*":true,
        "**/bsp/stm32f41*":true,
        "**/bsp/stm32f42*":true,
    },

然后这么长看起来就很麻烦,于是简化了一下(then i want make it simple)

"files.exclude": {
        "**/bsp/[^s]*": true,
        "**/bsp/s[^t]*": true,
        "**/bsp/stm32[^f]*": true,
        "**/bsp/stm32f[^1]*": true,
        "**/bsp/stm32f1*L": true,
        "**/bsp/stm32f1*7": true,
    },

简化完发现这样写的表达式虽然简单了一些但是有一些问题出现了,intellisence貌似无法确定我的头文件到底是在哪一个BSP里面,当我按下F12,文件追踪自动打开了一个在上面的配置里面应该已经忽略了的文件(After doing this, I found that all the matched options disappeared in the left resource manager. But some problems happened, it seems the intellisence don't know whereis my headers in.When I pressing F12, the vscode may open a file located on the directions that should been ignore.) 实际代码在这个Github仓库 (the code I'm browsing now is located in this github repo) I hope it's useful for fix this bug.

VS Code version: Code 1.24.1 (24f62626b222e9a8313213fb64b10d741a326288, 2018-06-13T17:51:32.889Z) OS version: Windows_NT x64 10.0.17134

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz (4 x 2195)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: unavailable_software
webgl: enabled
webgl2: enabled| |Memory (System)|3.92GB (0.87GB free)| |Process Argv|D:\ProgramFiles(green)\VSCode-win32-x64-1.24.1\Code.exe| |Screen Reader|no| |VM|0%|
Extensions (10) Extension|Author (truncated)|Version ---|---|--- language-x86-64-assembly|13x|2.2.11 easy-cpp-projects|ACh|1.4.2 path-intellisense|chr|1.4.2 python|cod|0.9.0 arm|dan|0.2.0 code-runner|for|0.9.3 8051|jun|0.1.0 cortex-debug|mar|0.1.21 python|ms-|2018.6.0 cpptools|ms-|0.17.6
vscodebot[bot] commented 6 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

yume-chan commented 6 years ago
  1. issue 标题是可以修改的 (issue title can be edited)
  2. issue 内容是可以修改的 (issue content can be edited)
  3. 在代码块上下加上四个反点号可以避免格式化,还可以代码高亮 (use four backticks to provide code formatting and highlighting)

比如输入这样:(e.g. if you type)

```` json
{
    "files.exclude": {
        "/bsp/[^s]": true
    }
}
````

得到的是 (and you get)

{
    "files.exclude": {
        "/bsp/[^s]": true
    }
}

反正我还是看不出你的配置长成什么样 (anyway I still don't understand your settings)

  1. 我看你的描述似乎 IntelliSense 是 cpptools 扩展提供的,麻烦你参阅 扩展文档 查看如何配置 IntelliSense (from your description I guess you are working on a C project and the IntelliSense is provided by the cpptools extension, please refer to their documentation to configure IntelliSense)

  2. 关于 cpptools 扩展没有读取 files.exclude 设置的问题,你可以在 cpptools 的 repo 发一个 feature request (If you are complaining about the cpptools doesn't conform your files.exclude setting, you can send a feature request to there)

jzz007 commented 6 years ago

@yume-chan 十分感谢大佬,我还以为会沉了没人理的。。。issue内容格式已改,标题暂时没想好,我发现确实是我不会用造成的,具体在这里有介绍,根据intellisence engine的介绍,我应该设置两个变量includePath和browse path,然而只设置了一个includePath,browse path处于默认状态所以直接递归把所有文件都纳入了intellisence感知范围,第一个配置能正确跳转到指定的BSP目录应该是intellsence简单的判断了一下file.exclude里面的内容,在内容解析上面没有做完全,所以才会出现我这个问题,所以好像我确实需要往cpptools的repo里面发一个issue。。。

Tyriar commented 6 years ago

https://github.com/Microsoft/vscode-cpptools

vscodebot[bot] commented 6 years ago

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!