vscode-syntax-scopedeprecated

Wrap around TextMate scope for VsCode

Usage no npm install needed!

<script type="module">
  import vscodeSyntaxScope from 'https://cdn.skypack.dev/vscode-syntax-scope';
</script>

README

VsCode TM Scopes

Usage

yarn add vscode-syntax-scope

Scope

The Scope class is a lightweight version of the TM scopes

import { Scope } from "vscode-syntax-scope";

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 "vscode-syntax-scope";

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

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