Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ayecue/monaco-textmate-provider

Language Provider and Theme Provider
https://github.com/ayecue/monaco-textmate-provider

Last synced: 29 days ago
JSON representation

Language Provider and Theme Provider

Awesome Lists containing this project

README

        

# monaco-textmate-provider

Language Provider and Theme Provider for Textmate within monaco.

# Usage

```ts
const onLoad = async (resolvedMonaco: typeof Monaco) => {
resolvedMonaco.languages.register({ id: 'myLanguage' });

const languageProvider = new LanguageProvider({
monaco: resolvedMonaco,
wasm: 'https://unpkg.com/[email protected]/release/onig.wasm',
grammars: {
greyscript: {
scopeName: 'source.src',
tmLanguageFile: 'https://unpkg.com/[email protected]/dist/myLanguage.tmLanguage.json',
languageConfigurationFile: 'https://unpkg.com/[email protected]/dist/myLanguageConfig.json',
},
},
});

const themeProvider = new ThemeProvider({
monaco: resolvedMonaco,
registry: await languageProvider.getRegistry(),
themes: {
default: 'https://unpkg.com/[email protected]/dist/myLanguage.theme.json',
}
});

const model = resolvedMonaco.editor.createModel(
initialContent,
'myLanguage'
);

themeProvider.setTheme('default');
};
```

For additional usage information, you can take a look at the provided [example code](/example).

# Credits

- Thanks to @bolinfest for [monaco-tm](https://github.com/bolinfest/monaco-tm)