# theme_importer: Handle comma-separated token scopes \(\#27740\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/4f4bbf264f11f89837d6b4bab7c9437817e67d91)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 4f4bbf264f11f89837d6b4bab7c9437817e67d91

Requested commit: 4f4bbf264f11f89837d6b4bab7c9437817e67d91

Commit: 4f4bbf264f11f89837d6b4bab7c9437817e67d91

Tree: 5788cd801ab42d35a1d2eaac587a368be49ec24f

Author: Variant9

Committer: GitHub

## Message

````
theme_importer: Handle comma-separated token scopes (#27740)

This PR allows the `theme-importer` utility to handle comma-separated
token scopes.

Normally, a token in a VS Code theme is defined as either a string or a
string array:
```json
    {
      "scope": "token.debug-token",
      "settings": {
        "foreground": "#d55fde"
      }
    },
    {
      "name": "String interpolation",
      "scope": [
        "punctuation.definition.template-expression.begin",
        "punctuation.definition.template-expression.end",
        "punctuation.section.embedded"
      ],
      "settings": {
        "foreground": "#d55fde"
      }
    },
```

However, [some
themes](https://github.com/tal7aouy/theme/blob/ac85540d6494cf3b7dffd6adc8a06af6c1dd4b0d/src/variants/TokenColors.ts#L1771-L1777)
seem to use comma-separated values in a single scope string which VS
Code seems to accept as well:
```json
    {
      "name": "Comments",
      "scope": "comment, punctuation.definition.comment",
      "settings": {
        "foreground": "#7f848e"
      }
    },
```

This PR handles these definitions by splitting scopes by commas before
trying to match them with the scopes that match Zed syntax tokens.

Release Notes:

- N/A
````

## Parents

- [990ca48744069e73d93357b292255e63abadbf28](https://git.cafe/gitcafe/zed/commit/990ca48744069e73d93357b292255e63abadbf28?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/4f4bbf264f11f89837d6b4bab7c9437817e67d91?format=markdown)
