Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/ayecue/monaco-textmate-provider
- Owner: ayecue
- License: mit
- Created: 2023-06-23T16:33:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-17T20:01:54.000Z (5 months ago)
- Last Synced: 2024-12-08T19:43:00.391Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 953 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)