Repository: vscode
Issue: Why do snippets with isFileTemplate=true also show in the middle of the file?
Labels: feature-request,snippets,under-discussion

Type: <b>Bug</b>

Doesn't make a lot of sense.  I had hoped isFileTemplate=true would solve my bug (https://github.com/orgs/Azure/projects/115/views/39?pane=issue&itemId=28512515) where a snippet intended for "bicepconfig.json" files shows up in the middle of *all* JSONC files.  If it only showed up in an *empty* JSONC file that would be an improvement.

I don't understand why an isFileTemplate=true template would show up when the file is no longer empty.

REPRO:
1) install ms-azuretools.vscode-bicep extension
2) open vscode's settings.json file
3) put cursor onto an empty line in the middle of the file
4) CTRL+SPACE
!) the "Default Bicep Configuration" snippet shows up.  This happens even if I set isFileTemplate=true on the snippet.
DESIRED:  I *really* want this snippet to only show up for files named "bicepconfig.json", but there seems to be no way to do that.  If isFileTemplate=true restricted it to empty JSONC files, that would at least be a big improvement.  Thx.

<img width="1126" alt="image" src="https://github.com/Azure/bicep/assets/8599/e3454dfd-2225-4ed4-8a47-354d5c1e8024">

VS Code version: Code - Insiders 1.80.0-insider (Universal) (8c85702bca51b08005ada7fc4eaf52a61623b2b6, 2023-06-20T05:36:10.312Z)
OS version: Darwin x64 22.5.0
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>metal: disabled_off<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|2, 3, 3|
|Memory (System)|16.00GB (0.03GB free)|
|Process Argv|--enable-proposed-api ms-azuretools.vscode-bicep --crash-reporter-id 39d91d6b-0aa9-4ae4-8826-427cf9cf9ecb|
|Screen Reader|yes|
|VM|0%|
</details><details><summary>Extensions (40)</summary>

Extension|Author (truncated)|Version
---|---|---
vscode-json|and|1.5.2
vscode-eslint|dba|2.4.0
gitlens|eam|14.0.1
EditorConfig|Edi|0.16.4
prettier-vscode|esb|9.15.0
copilot|Git|1.90.174
vscode-github-actions|git|0.25.8
vscode-pull-request-github|Git|0.67.2023062009
debug-visualizer|hed|2.4.0
json-escaper|jos|1.1.2
package-json-dependencies-navigation|mam|0.1.8
vscode-antlr4|mik|2.3.1
vscode-azureresourcegroups|ms-|0.7.5
vscode-bicep|ms-|0.18.4
vscode-cosmosdb|ms-|0.19.4
vscode-docker|ms-|1.25.1
extension-manifest-editor|ms-|0.1.5
csharp|ms-|1.25.9
vscode-dotnet-runtime|ms-|1.6.0
remote-containers|ms-|0.296.0
remote-ssh|ms-|0.102.0
remote-ssh-edit|ms-|0.86.0
remote-wsl|ms-|0.79.5
vscode-remote-extensionpack|ms-|0.24.0
azure-account|ms-|0.11.5
powershell|ms-|2023.6.0
remote-explorer|ms-|0.4.0
remote-server|ms-|1.2.1
vscode-selfhost-test-provider|ms-|0.3.15
azurerm-vscode-tools|msa|0.15.10
json-parse-stringify|nex|1.0.2
vscode-json-editor|nic|0.3.0
vscode-yaml|red|1.13.0
vscode-sort-json|ric|1.20.0
vscode-javascript-booster|sbu|14.0.1
scope-info|sie|0.2.0
tmcolor|sle|0.0.1
sort-lines|Tyr|1.10.1
win-ca|uko|3.5.0
vscode-todo-highlight|way|1.0.5


</details><details>
<summary>A/B Experiments</summary>

```
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256197
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30404738
vsclangdf:30492506
c4g48928:30535728
dsvsc012:30540252
pynewext54:30618038
pylantcb52:30590116
pyind779:30611226
pythonsymbol12:30651887
showlangstatbar:30737417
pythonms35:30671666
03d35959:30757351
ecj1e332:30687743
pythonfmttext:30716741
pythoncmvfstr:30726892
fixshowwlkth:30771523
hideindicator:30766887
pythongtdpath:30726887
gsof1:30771514
dh2dc718:30770000
pythonidxpt:30768918
pythondjangots:30768917
pythonnocebcf:30766856
copilotsettingt:30767686
e537b577:30772214

```

</details>

<!-- generated by issue reporter -->