Skip to content

vsce-toolroom/vscode-textmate-scope-selector

Repository files navigation

vscode-textmate-scope-selector

WASM binding for the textmate-scope-selector-peg Rust crate.

Usage

Web

import { loadWASM, parse } from 'vscode-textmate-scope-selector';

const response = fetch(import.meta.resolve('node_modules/vscode-textmate-scope-selector/build/selector.wasm'));
await loadWASM(response);

const selector = parse('source.matlab -comment -entity -support -string -variable -interpolation -source.shell');
console.log(selector.matches('source.matlab meta.class.matlab meta.class.declaration.matlab entity.name.type.class.matlab'));

Node.js

import { loadWASM, parse } from 'vscode-textmate-scope-selector';
import { readFileSync } from 'node:fs';

const bufview = readFileSync('vscode-textmate-scope-selector/build/selector.wasm');
await loadWASM(bufview);

const selector = parse('source.matlab -comment -entity -support -string -variable -interpolation -source.shell');
console.log(selector.matches('source.matlab meta.class.matlab meta.class.declaration.matlab entity.name.type.class.matlab'));

About

WASM binding for Textmate scope selector PEG (parser grammar)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published