@vadapty/tm-scopes

yarn add @vadapty/tm-scopes

Usage no npm install needed!

<script type="module">
  import vadaptyTmScopes from 'https://cdn.skypack.dev/@vadapty/tm-scopes';
</script>

README

TM Scopes

Usage

yarn add @vadapty/tm-scopes

Scope

The Scope class is a lightweight version of the TM scopes

import { Scope } from "@vadapty/tm-scopes";

It consist of two parts

  • include scope
  • exclude scope

Important! All methods of Scope class create new instance of a class, i.e. you don't need to make a manual copy or use clone method

Supports several extension methods

// "constant.numeric.float constant.numeric.hex"
new Scope("constant.numeric.float")
  .withNew("constant.numeric")
  .with(".hex")
  .toString();

// "constant.numeric - constant.numeric.hex"
new Scope("constant.numeric")
  .withoutNew("constant.numeric")
  .without(".hex")
  .toString();

// "constant.numeric.float constant.numeric.hex"
new Scope("constant.numeric.float").withNew("constant.numeric.hex").toString();

// "constant.numeric - constant.numeric.float"
new Scope("constant.numeric").withoutNew("constant.numeric.float").toString();

Predefined scopes

Represent scopes from Scope Naming – Sublime Text and some scope may not work

import { Comment, Entity, Invalid, Storage } from "@vadapty/tm-scopes";

new Storage().modifier.combine(new Invalid().deprecated);

new Invalid().deprecated.withNew("source.python", "source.java");