microsoft / microsoft/vscode-custom-data
[Feature] Add `contentType` property to attributes
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 240
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
Currently, an attribute can take the following schema (this is an example that illustrates all the possible items that can be included in an attribute):
{
"name": "onclick",
"description": {
"kind": "markdown",
"value": "# Hello World"
},
"valueSet": "x",
"values": [{
"name": "test",
"description": "test test test",
"references": [{
"name": "example",
"url": "https://example.com"
}]
}],
"references": [{
"name": "example",
"url": "https://example.com"
}]
}
There currently is no way to suggest that an attribute may contain something other than a string. For instance, the above attribute, onclick, takes a JavaScript expression. Thus, the attribute should format its contents as JavaScript, not as plaintext.
Since onclick is a supported attribute, JavaScript syntax highlighting within it is already supported:

It would be great if we could extend this to custom attributes using a new property such as 'contentType' that would allow one to opt in to different content types. For instance, Alpine.js has a custom attribute called @click that would be styled as plain text when using custom data, but should be styled as JavaScript.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by reviewing the custom data attribute schema and the existing handling that gives supported attributes JavaScript syntax highlighting. Done should include a contentType property that lets custom attributes such as Alpine.js @click opt into JavaScript styling instead of plaintext.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100