microsoft / vscode-textmate

A library that helps tokenize text using Text Mate grammars.
MIT License
581 stars 115 forks source link

Documentation for browser use? #244

Open mihailik opened 1 day ago

mihailik commented 1 day ago

I just want to use this library, as a library, not as VSCode accessory. Is that supported?

Do you need help making it useful for the community?

If you direct me towards understanding how this can be used for a browser project, I promise to make a PR for a sensible, helpful README and some use cases.

Because right now it's a total mess, like the original writer was promoted to management in 2018 or something.

![Image](https://github.com/user-attachments/assets/b352d246-5800-4443-9e05-a3a87f768880) ![Image](https://github.com/user-attachments/assets/fddff9de-6f26-48f9-9f85-a4353fa926ab)

What is this README???

Image

RedCMD commented 10 hours ago

that Readme shows a basic implementation of VSCode's TextMate in javascript I guess it assumes that you already know what TextMate grammars are

are you not able to import (require) other packages in the web?

oniguruma is the regex library that TextMate uses it is written in C, so it had to be converted to wasm to run on the web

source.js is the scope name that is assigned to the JavaScript language

you can use the await syntax instead of then()

Vue has a syntax playground, idk if it's any use to you here's my implementation (as a VSCode extension) https://github.com/RedCMD/TmLanguage-Syntax-Highlighter/blob/main/src/TextMate.ts

Why are you wanting to use the VSCode's TextMate library? There is also Tree-sitter and highlight.js