google / google/playground-elements

Ability to register additional grammars

Open
#164 0 comments 0 reactions 0 assignees View on GitHub
Needs Discussion
Dominant language
TypeScript
Stars
648
Forks
61
PR merge metrics
No merged PRs in 30d

Description

```html

$('playground-ide').config = {
files: {
'query.graphql': {
content: 'query SomeQuery($var: Int) { someQuery(var: $var) }'
}
}
};

```

**Expected**: file syntax-highlights
**Actual**: no syntax-highlighting

**Desired solution**:
```js
// ostensibly fetches then registers an additional grammar
await $('playground-ide').registerGrammar('https://big.old.grammar.store/grammars/graphql.grammar');
```
or maybe
```js
await $('playground-ide').registerGrammar({
language: 'graphql',
extentions: ['graphql'],
src: 'https://big.old.grammar.store/grammars/graphql.grammar',
});
```
and even
```html

```
This doesn't replace existing grammars unless the grammar in question overwrites something in `google-modes`
Thanks for the wonderful package and for considering this feature request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.