Installations
npm install vscode-textmate-webpack
Developer
Microsoft
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
NPM Version
Statistics
585 Stars
468 Commits
116 Forks
55 Watching
4 Branches
67 Contributors
Updated on 25 Nov 2024
Languages
TypeScript (83.52%)
JavaScript (2.33%)
SCSS (2.25%)
Groovy (1.47%)
CSS (1.22%)
HTML (0.94%)
Python (0.79%)
Perl (0.72%)
Ruby (0.64%)
PowerShell (0.53%)
Objective-C (0.52%)
Go (0.46%)
Clojure (0.45%)
Handlebars (0.4%)
Less (0.38%)
C++ (0.37%)
Visual Basic .NET (0.33%)
C (0.31%)
PHP (0.3%)
F# (0.24%)
Shell (0.24%)
CoffeeScript (0.22%)
Java (0.21%)
Makefile (0.21%)
Rust (0.2%)
Batchfile (0.18%)
Dockerfile (0.16%)
R (0.14%)
ShaderLab (0.12%)
Lua (0.09%)
Swift (0.08%)
Pug (0.01%)
Total Downloads
Cumulative downloads
Total Downloads
1,148
Last day
-90.9%
1
Compared to previous day
Last week
-95.5%
1
Compared to previous week
Last month
3,900%
40
Compared to previous month
Last year
28.4%
86
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
7
VSCode TextMate
An interpreter for grammar files as defined by TextMate. TextMate grammars use the oniguruma dialect (https://github.com/kkos/oniguruma). Supports loading grammar files from JSON or PLIST format. This library is used in VS Code. Cross - grammar injections are currently not supported.
Installing
1npm install vscode-textmate
Using
1const fs = require('fs'); 2const path = require('path'); 3const vsctm = require('vscode-textmate'); 4const oniguruma = require('vscode-oniguruma'); 5 6/** 7 * Utility to read a file as a promise 8 */ 9function readFile(path) { 10 return new Promise((resolve, reject) => { 11 fs.readFile(path, (error, data) => error ? reject(error) : resolve(data)); 12 }) 13} 14 15const wasmBin = fs.readFileSync(path.join(__dirname, './node_modules/vscode-oniguruma/release/onig.wasm')).buffer; 16const vscodeOnigurumaLib = oniguruma.loadWASM(wasmBin).then(() => { 17 return { 18 createOnigScanner(patterns) { return new oniguruma.OnigScanner(patterns); }, 19 createOnigString(s) { return new oniguruma.OnigString(s); } 20 }; 21}); 22 23// Create a registry that can create a grammar from a scope name. 24const registry = new vsctm.Registry({ 25 onigLib: vscodeOnigurumaLib, 26 loadGrammar: (scopeName) => { 27 if (scopeName === 'source.js') { 28 // https://github.com/textmate/javascript.tmbundle/blob/master/Syntaxes/JavaScript.plist 29 return readFile('./JavaScript.plist').then(data => vsctm.parseRawGrammar(data.toString())) 30 } 31 console.log(`Unknown scope name: ${scopeName}`); 32 return null; 33 } 34}); 35 36// Load the JavaScript grammar and any other grammars included by it async. 37registry.loadGrammar('source.js').then(grammar => { 38 const text = [ 39 `function sayHello(name) {`, 40 `\treturn "Hello, " + name;`, 41 `}` 42 ]; 43 let ruleStack = vsctm.INITIAL; 44 for (let i = 0; i < text.length; i++) { 45 const line = text[i]; 46 const lineTokens = grammar.tokenizeLine(line, ruleStack); 47 console.log(`\nTokenizing line: ${line}`); 48 for (let j = 0; j < lineTokens.tokens.length; j++) { 49 const token = lineTokens.tokens[j]; 50 console.log(` - token from ${token.startIndex} to ${token.endIndex} ` + 51 `(${line.substring(token.startIndex, token.endIndex)}) ` + 52 `with scopes ${token.scopes.join(', ')}` 53 ); 54 } 55 ruleStack = lineTokens.ruleStack; 56 } 57}); 58 59/* OUTPUT: 60 61Unknown scope name: source.js.regexp 62 63Tokenizing line: function sayHello(name) { 64 - token from 0 to 8 (function) with scopes source.js, meta.function.js, storage.type.function.js 65 - token from 8 to 9 ( ) with scopes source.js, meta.function.js 66 - token from 9 to 17 (sayHello) with scopes source.js, meta.function.js, entity.name.function.js 67 - token from 17 to 18 (() with scopes source.js, meta.function.js, punctuation.definition.parameters.begin.js 68 - token from 18 to 22 (name) with scopes source.js, meta.function.js, variable.parameter.function.js 69 - token from 22 to 23 ()) with scopes source.js, meta.function.js, punctuation.definition.parameters.end.js 70 - token from 23 to 24 ( ) with scopes source.js 71 - token from 24 to 25 ({) with scopes source.js, punctuation.section.scope.begin.js 72 73Tokenizing line: return "Hello, " + name; 74 - token from 0 to 1 ( ) with scopes source.js 75 - token from 1 to 7 (return) with scopes source.js, keyword.control.js 76 - token from 7 to 8 ( ) with scopes source.js 77 - token from 8 to 9 (") with scopes source.js, string.quoted.double.js, punctuation.definition.string.begin.js 78 - token from 9 to 16 (Hello, ) with scopes source.js, string.quoted.double.js 79 - token from 16 to 17 (") with scopes source.js, string.quoted.double.js, punctuation.definition.string.end.js 80 - token from 17 to 18 ( ) with scopes source.js 81 - token from 18 to 19 (+) with scopes source.js, keyword.operator.arithmetic.js 82 - token from 19 to 20 ( ) with scopes source.js 83 - token from 20 to 24 (name) with scopes source.js, support.constant.dom.js 84 - token from 24 to 25 (;) with scopes source.js, punctuation.terminator.statement.js 85 86Tokenizing line: } 87 - token from 0 to 1 (}) with scopes source.js, punctuation.section.scope.end.js 88 89*/ 90
For grammar authors
See vscode-tmgrammar-test that can help you write unit tests against your grammar.
API doc
See the main.ts file
Developing
- Clone the repository
- Run
npm install
- Compile in the background with
npm run watch
- Run tests with
npm test
- Run benchmark with
npm run benchmark
- Troubleshoot a grammar with
npm run inspect -- PATH_TO_GRAMMAR PATH_TO_FILE
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
License
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
2 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoft/vscode-textmate/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/microsoft/vscode-textmate/ci.yml/main?enable=pin
- Warn: containerImage not pinned by hash: test-cases/themes/tests/Dockerfile:1: pin your Docker image by updating ubuntu to ubuntu@sha256:278628f08d4979fb9af9ead44277dbc9c92c2465922310916ad0c46ec9999295
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 containerImage dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 30 are checked with a SAST tool
Score
5.4
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to vscode-textmate-webpack
vscode-textmate
VSCode TextMate grammar helpers
@shikijs/vscode-textmate
Shiki's fork of `vscode-textmate`
vscode-grammar-updater
Utility to update TextMate grammars that are part of VSCode language extensions
monaco-vscode-textmate-theme-converter
Converts VSCode themes to monaco editor themes.