@vadapty/syntax

Library for creating syntax modules using textmate-scopes

Usage no npm install needed!

<script type="module">
  import vadaptySyntax from 'https://cdn.skypack.dev/@vadapty/syntax';
</script>

README

Library for creating syntax modules using textmate-scopes

Usage

yarn add @vadapty/syntax

Note: It is recommended to use with the package tm-scopes

import { Color } from "@vadapty/color";
import { Comment, Source } from "@vadapty/tm-scopes";
import { FontStyle, Property } from "@vadapty/syntax";

const comment = new Comment();
const source = new Source();

class SomeLanguageModule {
  public pythonCommentBlock = new Property(
    name: "python-comment-block",
    scopes: new Scopes("source.python", "comment.block")
  );

  public javaCommentBlock = new Property(
    name: "python-comment-block",
    scopes: new Scopes(source.base.with("java"), comment.block)
  )

  public rustCommentBlock = new Property(
    name: "rust-comment-block",
    scopes: new Scopes(source.base.with("rust"), comment.block),
    settings: new Settings(
      foreground: new Color("#ddd"),
      fontStyle: FontStyle.Italic
    )
  )
}