Repository: vscode
Issue: [json] Intellisense doesn't suggest objects as a possibility when next to string enums
Labels: feature-request,json

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes (**issue even present in the bare monaco editor**)

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version:

```
Version: 1.83.1 (Universal)
Commit: f1b07bd25dfad64b0167beb15359ae573aecd2cc
Date: 2023-10-10T23:46:55.789Z
Electron: 25.8.4
ElectronBuildId: 24154031
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.4.0
```

I have JSON schema for which an example object like this is valid:

```json
{ "spells": ["lumos", { "accio": "thing" }] }
```

A simple JSON schema that demonstrates the issue:

`schema.json`

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "spells": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "enum": ["nox", "lumos"]
          },
          {
            "type": "object",
            "properties": {
              "accio": {
                "type": "string"
              }
            }
          }
        ]
      }
    }
  }
}
```

Note that the array item can be one of two strings, or an object.

When I select the schema to be used in VSCode like so:

`.vscode/settings.json`

```
{
  "json.schemas": [
    {
      "fileMatch": ["*.spells.json"],
      "url": "./schema.json"
    }
  ]
}
```


Intellisense always, and only, suggests the two string options: `"nox"`, `"lumos"` and not the object option `{"accio": thing}`.

![illustration of the bug](https://github.com/user-attachments/assets/fcf0a53f-6cf4-416f-ab57-dd89ec6449ee)

Of course, once I get started on typing an object (`{`) it shows `accio`:

![illustration of it being recognised](https://github.com/user-attachments/assets/97ed241f-b0f6-47ca-9054-b78064d4be11)

## Expected behavior

Other editors like JetBrains and Visual Studio will indicate the possibility of the choice also being an object by having a `{ ... }` in the list that can be selected, and which gives further information. Something like this:

<img width="200" alt="Screenshot 2024-09-04 at 20 58 09" src="https://github.com/user-attachments/assets/d20dcace-b88f-436b-bdb4-9f0901f7ca49">

--- 

## Steps to Reproduce:

1. Save the schema in a workspace as `schema.json`.
2. Save the vcode settings.
3. Create a new file `test.spells.json`
4. Get Intellisense started by typing `{"spells": [ <ctrl> + <space>`