0.6.4 • Published 6 years ago
vscode-syntax-template v0.6.4
VsCode Syntax Template
The package does not contain templates! It represents entities for creating templates
Usage
yarn add vscode-syntax-template
Note: It is recommended to use with the package vscode-syntax-scope
Property Builder
Use this to create syntax properties
import { COMMENT, SOURCE } from "vscode-syntax-scope";
import { propertyBuilder } from "vscode-syntax-template";
// using strings
propertyBuilder
.setScope("source.python", "comment.block")
.setName("python-comment-block")
.build();
const BLOCK_COMMENT = COMMENT.instance.block;
const SOURCE_BASE = SOURCE.instance.base;
// using Scopes
propertyBuilder
.setScope(SOURCE_BASE.with("python"), BLOCK_COMMENT)
.setName("python-comment-block")
.build();
// using Scopes and strings
propertyBuilder
.setScope(SOURCE_BASE.with("python"), BLOCK_COMMENT, "string")
.setName("python-comment-block-string")
.build();
And you can also set options when building an instance
import { STRING } from "vscode-syntax-scope";
import {
FontStyle,
optionsFromData,
propertyBuilder
} from "vscode-syntax-template";
import { Color } from "vscode-theme-builder";
const colors = [new Color("#53d")];
propertyBuilder
.setScope(STRING.instance.regexp)
.setName("regexp")
.setOptions(
optionsFromData({ background: colors[0].base, fontStyle: FontStyle.ITALIC })
)
.build();