| 1 | // Extensiones de VS Code SINTÉTICAS para las pruebas: se construyen aquí, en |
| 2 | // memoria, sin red ni licencias de terceros. Un .vsix es un zip con |
| 3 | // extension/package.json y los ficheros que citan sus contribuciones. |
| 4 | import zlib from 'node:zlib'; |
| 5 | |
| 6 | const CRC = (() => { |
| 7 | const t = new Uint32Array(256); |
| 8 | for (let n = 0; n < 256; n++) { let c = n; for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; t[n] = c >>> 0; } |
| 9 | return t; |
| 10 | })(); |
| 11 | const crc32 = b => { let c = 0xffffffff; for (const x of b) c = CRC[(c ^ x) & 0xff] ^ (c >>> 8); return (c ^ 0xffffffff) >>> 0; }; |
| 12 | |
| 13 | // files: [[nombre, contenido, { method }]] — method 8 (deflate, por defecto), |
| 14 | // 0 (sin comprimir) o cualquier otro número para fabricar una entrada ilegible. |
| 15 | export function zip(files) { |
| 16 | const locales = [], centrales = []; |
| 17 | let off = 0; |
| 18 | for (const [name, content, opts = {}] of files) { |
| 19 | const data = Buffer.isBuffer(content) ? content : Buffer.from(String(content), 'utf8'); |
| 20 | const method = opts.method ?? 8; |
| 21 | const comp = method === 8 ? zlib.deflateRawSync(data) : data; |
| 22 | const nb = Buffer.from(name, 'utf8'); |
| 23 | const crc = crc32(data); |
| 24 | const lh = Buffer.alloc(30); |
| 25 | lh.writeUInt32LE(0x04034b50, 0); lh.writeUInt16LE(20, 4); lh.writeUInt16LE(0x0800, 6); lh.writeUInt16LE(method, 8); |
| 26 | lh.writeUInt32LE(crc, 14); lh.writeUInt32LE(comp.length, 18); lh.writeUInt32LE(data.length, 22); |
| 27 | lh.writeUInt16LE(nb.length, 26); lh.writeUInt16LE(0, 28); |
| 28 | locales.push(lh, nb, comp); |
| 29 | const ch = Buffer.alloc(46); |
| 30 | ch.writeUInt32LE(0x02014b50, 0); ch.writeUInt16LE(20, 4); ch.writeUInt16LE(20, 6); ch.writeUInt16LE(0x0800, 8); ch.writeUInt16LE(method, 10); |
| 31 | ch.writeUInt32LE(crc, 16); ch.writeUInt32LE(comp.length, 20); ch.writeUInt32LE(opts.declaredSize ?? data.length, 24); |
| 32 | ch.writeUInt16LE(nb.length, 28); ch.writeUInt32LE(off, 42); |
| 33 | centrales.push(ch, nb); |
| 34 | off += 30 + nb.length + comp.length; |
| 35 | } |
| 36 | const cd = Buffer.concat(centrales); |
| 37 | const eocd = Buffer.alloc(22); |
| 38 | eocd.writeUInt32LE(0x06054b50, 0); eocd.writeUInt16LE(files.length, 8); eocd.writeUInt16LE(files.length, 10); |
| 39 | eocd.writeUInt32LE(cd.length, 12); eocd.writeUInt32LE(off, 16); |
| 40 | return new Uint8Array(Buffer.concat([...locales, cd, eocd])); |
| 41 | } |
| 42 | |
| 43 | const ENVOLTORIO = [ |
| 44 | ['extension.vsixmanifest', '<?xml version="1.0" encoding="utf-8"?><PackageManifest Version="2.0.0"/>'], |
| 45 | ['[Content_Types].xml', '<?xml version="1.0" encoding="utf-8"?><Types/>'], |
| 46 | ]; |
| 47 | |
| 48 | // ── tema: JSONC con comentarios y comas finales, include encadenado, un color |
| 49 | // malicioso que no debe pasar, y un segundo tema en .tmTheme (plist). |
| 50 | export const THEME_DARK = { bg: '#102030', fg: '#E0E0E0', keyword: '#CC66FF', control: '#FF0055', comment: '#00AA44', string: '#FFAA00', number: '#33CCFF', tabActive: '#203040' }; |
| 51 | export function themeVsix() { |
| 52 | const pkg = { |
| 53 | name: 'elf-theme', publisher: 'elffuss-test', version: '1.0.0', displayName: '%displayName%', description: '%description%', |
| 54 | license: 'MIT', engines: { vscode: '^1.80.0' }, categories: ['Themes'], |
| 55 | main: './out/extension.js', // código: NO se ejecuta nunca |
| 56 | contributes: { |
| 57 | themes: [ |
| 58 | { id: 'Elf Dark', label: '%darkLabel%', uiTheme: 'vs-dark', path: './themes/elf-dark.json' }, |
| 59 | { label: 'Elf Light (tmTheme)', uiTheme: 'vs', path: './themes/elf-light.tmTheme' }, |
| 60 | ], |
| 61 | commands: [{ command: 'elf.hello', title: 'Hola' }], |
| 62 | iconThemes: [{ id: 'elf-icons', label: 'Elf icons', path: './icons.json' }], |
| 63 | }, |
| 64 | }; |
| 65 | const base = `{ |
| 66 | // base que incluye el tema oscuro |
| 67 | "colors": { "editorCursor.foreground": "#FFCC00", "editor.background": "#000000" }, |
| 68 | "tokenColors": [ |
| 69 | { "scope": "keyword, storage.type", "settings": { "foreground": "${THEME_DARK.keyword}" } }, |
| 70 | { "scope": "string", "settings": { "foreground": "${THEME_DARK.string}" } }, |
| 71 | { "scope": "constant.numeric", "settings": { "foreground": "${THEME_DARK.number}" } }, |
| 72 | ], |
| 73 | }`; |
| 74 | const dark = `{ |
| 75 | "$schema": "vscode://schemas/color-theme", // comentario con "comillas" y // barras |
| 76 | "name": "Elf Dark", |
| 77 | "include": "./base.json", |
| 78 | /* bloque |
| 79 | de comentario */ |
| 80 | "colors": { |
| 81 | "editor.background": "${THEME_DARK.bg}", |
| 82 | "editor.foreground": "${THEME_DARK.fg}", |
| 83 | "tab.activeBackground": "${THEME_DARK.tabActive}", |
| 84 | "editor.lineHighlightBackground": "#ffffff10", |
| 85 | "sideBar.background": "url(https://example.invalid/track.png)", |
| 86 | }, |
| 87 | "tokenColors": [ |
| 88 | { "scope": "keyword.control", "settings": { "foreground": "${THEME_DARK.control}" } }, |
| 89 | { "scope": ["comment"], "settings": { "foreground": "${THEME_DARK.comment}", "fontStyle": "italic" } }, |
| 90 | { "scope": "source.elfs keyword", "settings": { "foreground": "#123456" } }, |
| 91 | ], |
| 92 | }`; |
| 93 | const light = `<?xml version="1.0" encoding="UTF-8"?> |
| 94 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 95 | <plist version="1.0"><dict> |
| 96 | <key>name</key><string>Elf & Light</string> |
| 97 | <key>settings</key> |
| 98 | <array> |
| 99 | <dict><key>settings</key><dict> |
| 100 | <key>background</key><string>#FAFAF0</string> |
| 101 | <key>foreground</key><string>#202020</string> |
| 102 | <key>caret</key><string>#FF0000</string> |
| 103 | </dict></dict> |
| 104 | <!-- comentario --> |
| 105 | <dict><key>name</key><string>Comment</string><key>scope</key><string>comment</string> |
| 106 | <key>settings</key><dict><key>foreground</key><string>#808080</string><key>fontStyle</key><string>italic</string></dict></dict> |
| 107 | <dict><key>scope</key><string>keyword, storage</string> |
| 108 | <key>settings</key><dict><key>foreground</key><string>#AA0000</string></dict></dict> |
| 109 | </array> |
| 110 | <key>uuid</key><string><![CDATA[1234-<cdata>]]></string> |
| 111 | <key>count</key><integer>3</integer> |
| 112 | <key>flag</key><true/> |
| 113 | </dict></plist>`; |
| 114 | return zip([ |
| 115 | ...ENVOLTORIO, |
| 116 | ['extension/package.json', JSON.stringify(pkg, null, 2)], |
| 117 | ['extension/package.nls.json', JSON.stringify({ displayName: 'Elf Theme', description: 'Synthetic test theme', darkLabel: 'Elf Dark' })], |
| 118 | ['extension/package.nls.es.json', JSON.stringify({ displayName: 'Tema Elfo', darkLabel: 'Elfo Oscuro' })], |
| 119 | ['extension/LICENSE.txt', 'MIT License — test fixture'], |
| 120 | ['extension/themes/base.json', base], |
| 121 | ['extension/themes/elf-dark.json', dark], |
| 122 | ['extension/themes/elf-light.tmTheme', light], |
| 123 | ['extension/icons.json', '{}'], |
| 124 | // si alguien intentara leer el JS, esta entrada lanza (compresión 99) |
| 125 | ['extension/out/extension.js', 'throw new Error("must never run")', { method: 99 }], |
| 126 | ]); |
| 127 | } |
| 128 | |
| 129 | // ── lenguaje nuevo + gramática + configuración + snippets (también para JS) |
| 130 | export const ELFS = { lang: 'elfscript', ext: '.elfs', scope: 'source.elfs' }; |
| 131 | export function elfscriptVsix({ version = '1.0.0' } = {}) { |
| 132 | const pkg = { |
| 133 | name: 'elfscript', publisher: 'elffuss-test', version, displayName: 'ElfScript', description: 'Synthetic language for tests', |
| 134 | license: 'SEE LICENSE IN NOTICE.md', engines: { vscode: '^1.80.0' }, categories: ['Programming Languages', 'Snippets'], |
| 135 | contributes: { |
| 136 | languages: [{ id: ELFS.lang, aliases: ['ElfScript', 'elfs'], extensions: [ELFS.ext], filenames: ['Elffile'], filenamePatterns: ['**/spells/*.spell'], firstLine: '^#!.*\\belfs\\b', configuration: './language-configuration.json' }], |
| 137 | grammars: [ |
| 138 | { language: ELFS.lang, scopeName: ELFS.scope, path: './syntaxes/elfs.tmLanguage.json', tokenTypes: { 'string.quoted.single.elfs': 'other' } }, |
| 139 | { scopeName: 'source.elfs.rune', path: './syntaxes/rune.tmLanguage' }, |
| 140 | ], |
| 141 | snippets: [ |
| 142 | { language: ELFS.lang, path: './snippets/elfs.code-snippets' }, |
| 143 | { language: 'javascript', path: './snippets/js.json' }, |
| 144 | ], |
| 145 | configurationDefaults: { '[elfscript]': { 'editor.tabSize': 2 } }, |
| 146 | }, |
| 147 | }; |
| 148 | const grammar = { |
| 149 | name: 'ElfScript', scopeName: ELFS.scope, |
| 150 | patterns: [ |
| 151 | { include: '#comment' }, { include: '#keywords' }, { include: '#strings' }, { include: '#numbers' }, { include: 'source.elfs.rune' }, |
| 152 | ], |
| 153 | repository: { |
| 154 | comment: { match: '#.*$', name: 'comment.line.number-sign.elfs' }, |
| 155 | keywords: { patterns: [{ match: '\\b(spell|cast|end)\\b', name: 'keyword.control.elfs' }, { match: '\\bwith\\b', name: 'keyword.other.elfs' }] }, |
| 156 | strings: { begin: '"', end: '"', name: 'string.quoted.double.elfs' }, |
| 157 | numbers: { match: '\\b[0-9]+\\b', name: 'constant.numeric.elfs' }, |
| 158 | }, |
| 159 | }; |
| 160 | const rune = `<?xml version="1.0" encoding="UTF-8"?> |
| 161 | <plist version="1.0"><dict> |
| 162 | <key>scopeName</key><string>source.elfs.rune</string> |
| 163 | <key>patterns</key><array> |
| 164 | <dict><key>match</key><string>\\bᚱ\\w*</string><key>name</key><string>storage.type.rune.elfs</string></dict> |
| 165 | </array> |
| 166 | </dict></plist>`; |
| 167 | const config = `{ |
| 168 | "comments": { "lineComment": "#", "blockComment": ["#[", "]#"] }, |
| 169 | "brackets": [["{", "}"], ["[", "]"], ["(", ")"]], |
| 170 | "autoClosingPairs": [["{", "}"], ["[", "]"], { "open": "\\"", "close": "\\"", "notIn": ["string", "comment"] }], |
| 171 | "surroundingPairs": [["(", ")"], ["\\"", "\\""]], |
| 172 | "wordPattern": "[A-Za-z_][\\\\w-]*", |
| 173 | "indentationRules": { "increaseIndentPattern": "^\\\\s*spell\\\\b.*$", "decreaseIndentPattern": "^\\\\s*end\\\\b" }, |
| 174 | "onEnterRules": [{ "beforeText": "^\\\\s*spell\\\\b.*$", "action": { "indent": "indent" } }, { "beforeText": "(", "action": { "indent": "indent" } }], |
| 175 | "folding": { "markers": { "start": "^\\\\s*#region\\\\b", "end": "^\\\\s*#endregion\\\\b" } }, |
| 176 | }`; |
| 177 | const snippets = `{ |
| 178 | // un snippet con varios prefijos y cuerpo en varias líneas |
| 179 | "Spell": { "prefix": ["spell", "elfspell"], "body": ["spell \${1:name}", "\\tcast \${2:fire}", "end"], "description": "A spell block" }, |
| 180 | "Grupo": { |
| 181 | "Rune": { "prefix": "#rune", "body": "#rune \${1:ᚱ}", "description": "Rune comment" }, |
| 182 | }, |
| 183 | "Sin prefijo": { "body": "nada" }, |
| 184 | }`; |
| 185 | return zip([ |
| 186 | ...ENVOLTORIO, |
| 187 | ['extension/package.json', JSON.stringify(pkg, null, 2)], |
| 188 | ['extension/NOTICE.md', 'Synthetic fixture, public domain.'], |
| 189 | ['extension/language-configuration.json', config], |
| 190 | ['extension/syntaxes/elfs.tmLanguage.json', JSON.stringify(grammar)], |
| 191 | ['extension/syntaxes/rune.tmLanguage', rune], |
| 192 | ['extension/snippets/elfs.code-snippets', snippets], |
| 193 | ['extension/snippets/js.json', JSON.stringify({ 'Elf log': { prefix: 'elflog', body: "console.log('elf', $1);$0", description: 'Log with an elf' } })], |
| 194 | ]); |
| 195 | } |
| 196 | |
| 197 | // ── paquetes hostiles o rotos: seguridad y mensajes ────────────────────────── |
| 198 | const paquete = (pkg, ficheros) => zip([ |
| 199 | ...ENVOLTORIO, |
| 200 | ['extension/package.json', JSON.stringify({ publisher: 'elffuss-test', version: '1.0.0', engines: { vscode: '^1.80.0' }, license: 'MIT', ...pkg }, null, 2)], |
| 201 | ...ficheros, |
| 202 | ]); |
| 203 | |
| 204 | // Gramática que intenta sacar al motor de su repositorio con nombres de |
| 205 | // Object.prototype: «#__proto__» escribía Object.prototype.id para TODA la |
| 206 | // página. Lleva también reglas legítimas (#kw, y una que se llama |
| 207 | // «constructor») que tienen que seguir pintando. El texto va a mano: un objeto |
| 208 | // JS con clave __proto__ no la serializaría. Y un tema con un ámbito |
| 209 | // «hasOwnProperty», que tumbaba el árbol de temas del motor. |
| 210 | export const EVIL = { lang: 'evilscript', ext: '.evil', scope: 'source.evil', kw: '#DD2200', ctor: '#22AA44' }; |
| 211 | export const EVIL_GRAMMAR = `{ |
| 212 | "scopeName": "source.evil", |
| 213 | "patterns": [ |
| 214 | { "include": "#__proto__" }, { "include": "#constructor" }, { "include": "#toString" }, |
| 215 | { "include": "source.evil#__proto__" }, { "include": "hasOwnProperty" }, { "include": "__proto__#x" }, |
| 216 | { "include": "#kw" }, |
| 217 | { "begin": "\\\\(", "end": "\\\\)", "id": 1, "__proto__": { "match": "x" }, "patterns": [{ "include": "#valueOf" }], |
| 218 | "captures": { "__proto__": { "name": "x" }, "0": { "name": "punctuation.paren.evil" } } } |
| 219 | ], |
| 220 | "repository": { |
| 221 | "kw": { "match": "\\\\bevil\\\\b", "name": "keyword.control.evil" }, |
| 222 | "constructor": { "match": "\\\\bctor\\\\b", "name": "entity.name.function.ctor.evil" } |
| 223 | } |
| 224 | }`; |
| 225 | export function hostileGrammarVsix() { |
| 226 | const theme = { |
| 227 | colors: { 'editor.background': '#101010', 'editor.foreground': '#EEEEEE' }, |
| 228 | tokenColors: [ |
| 229 | { scope: 'hasOwnProperty', settings: { foreground: '#123123' } }, |
| 230 | { scope: ['__proto__.x', 'keyword.control'], settings: { foreground: EVIL.kw } }, |
| 231 | { scope: 'entity.name.function', settings: { foreground: EVIL.ctor } }, |
| 232 | ], |
| 233 | }; |
| 234 | return paquete({ |
| 235 | name: 'evil', displayName: 'Evil Grammar', |
| 236 | contributes: { |
| 237 | languages: [{ id: EVIL.lang, extensions: [EVIL.ext] }], |
| 238 | grammars: [ |
| 239 | { language: EVIL.lang, scopeName: EVIL.scope, path: './evil.tmLanguage.json' }, |
| 240 | { scopeName: '__proto__', path: './evil.tmLanguage.json' }, |
| 241 | ], |
| 242 | themes: [{ label: 'Evil Theme', uiTheme: 'vs-dark', path: './evil-theme.json' }], |
| 243 | }, |
| 244 | }, [['extension/evil.tmLanguage.json', EVIL_GRAMMAR], ['extension/evil-theme.json', JSON.stringify(theme)]]); |
| 245 | } |
| 246 | |
| 247 | // Snippet cuya descripción y cuerpo llevan imágenes y enlaces en Markdown: si |
| 248 | // el detalle se pintara como Markdown, el navegador los pediría a `base`. |
| 249 | export function beaconSnippetVsix(base) { |
| 250 | const snippets = { Beacon: { |
| 251 | prefix: 'zzbeacon', |
| 252 | description: ` [click](${base}/link)`, |
| 253 | body: ['x', '```', ``, '```'], |
| 254 | } }; |
| 255 | return paquete({ name: 'beacon', displayName: 'Beacon Snippets', contributes: { snippets: [{ language: 'javascript', path: './s.json' }] } }, |
| 256 | [['extension/s.json', JSON.stringify(snippets)]]); |
| 257 | } |
| 258 | |
| 259 | // Dos temas, uno con JSON roto; o (onlyBroken) solo temas que no se pueden leer. |
| 260 | export function brokenThemeVsix({ onlyBroken = false } = {}) { |
| 261 | const bueno = JSON.stringify({ colors: { 'editor.background': '#0A1A2A', 'tab.activeBackground': '#0A1A2A' }, tokenColors: [] }); |
| 262 | const themes = onlyBroken |
| 263 | ? [{ label: 'Broken One', path: './themes/broken.json' }, { label: 'Missing One', path: './themes/missing.json' }] |
| 264 | : [{ label: 'Good One', uiTheme: 'vs-dark', path: './themes/good.json' }, { label: 'Broken One', path: './themes/broken.json' }]; |
| 265 | return paquete({ name: onlyBroken ? 'broken-only' : 'half-broken', displayName: onlyBroken ? 'Broken Only' : 'Half Broken', contributes: { themes } }, |
| 266 | [['extension/themes/good.json', bueno], ['extension/themes/broken.json', '{ "colors": { "editor.background": "#000000" ']]); |
| 267 | } |
| 268 | |
| 269 | // Gramática y configuración para JSON: Monaco lo trae sin Monarch, así que ni |
| 270 | // la gramática ni la configuración se aplican. |
| 271 | export function jsonGrammarVsix() { |
| 272 | return paquete({ |
| 273 | name: 'json-x', displayName: 'JSON X', |
| 274 | contributes: { |
| 275 | languages: [{ id: 'json', extensions: ['.json'], configuration: './conf.json' }], |
| 276 | grammars: [{ language: 'json', scopeName: 'source.json.x', path: './json.tmLanguage.json' }], |
| 277 | }, |
| 278 | }, [['extension/conf.json', '{ "comments": { "lineComment": "//" } }'], |
| 279 | ['extension/json.tmLanguage.json', JSON.stringify({ scopeName: 'source.json.x', patterns: [{ match: '"', name: 'string.json' }] })]]); |
| 280 | } |
| 281 | |
| 282 | // package.json sin publisher. |
| 283 | export function noPublisherVsix() { |
| 284 | return zip([...ENVOLTORIO, ['extension/package.json', JSON.stringify({ name: 'nopub', version: '1.0.0', contributes: { themes: [] } })]]); |
| 285 | } |
| 286 | |
| 287 | // Expresiones que pueden no terminar: una firstLine con alternativas que se |
| 288 | // solapan (no es repetición anidada, así que pasa la comprobación estática y |
| 289 | // la para el Worker), otra con repetición anidada y un wordPattern igual. |
| 290 | export const SLOW = { lang: 'slowlang', nest: 'nestlang', firstLine: '^(.|\\s)*z' }; |
| 291 | export function slowRegexVsix() { |
| 292 | return paquete({ |
| 293 | name: 'slow', displayName: 'Slow Regex', |
| 294 | contributes: { |
| 295 | languages: [ |
| 296 | { id: SLOW.lang, extensions: ['.slow'], firstLine: SLOW.firstLine }, |
| 297 | { id: SLOW.nest, extensions: ['.nest'], firstLine: '^(a+)+$', configuration: './conf.json' }, |
| 298 | ], |
| 299 | }, |
| 300 | }, [['extension/conf.json', JSON.stringify({ wordPattern: '(a+)+$', brackets: [['(', ')']] })]]); |
| 301 | } |
| 302 | |
| 303 | // ── lo que se ve al instalar (ext_feedback.mjs) ────────────────────────────── |
| 304 | // Solo código: vistas previas propias, comandos, menús y dos lenguajes SIN |
| 305 | // gramática ni configuración (como una extensión real de vista previa). Aquí no |
| 306 | // aporta nada visible: no se ofrece instalarla. |
| 307 | export function codeOnlyVsix() { |
| 308 | return paquete({ |
| 309 | name: 'previewer', displayName: 'Rich Previewer', description: 'LaTeX, STL and video preview with right-click copy', |
| 310 | categories: ['Visualization', 'Other'], main: './dist/extension.js', |
| 311 | contributes: { |
| 312 | languages: [{ id: 'csv', aliases: ['CSV'], extensions: ['.csv'] }, { id: 'tsv', aliases: ['TSV'], extensions: ['.tsv'] }], |
| 313 | commands: [{ command: 'pv.copy', title: 'Copy' }], menus: { 'editor/context': [] }, |
| 314 | customEditors: [{ viewType: 'pv.stl', displayName: 'STL', selector: [{ filenamePattern: '*.stl' }] }], |
| 315 | configuration: { properties: {} }, |
| 316 | }, |
| 317 | }, [['extension/dist/extension.js', 'throw new Error("must never run")', { method: 99 }]]); |
| 318 | } |
| 319 | // Resaltado + configuración de un lenguaje nuevo, y además código para el |
| 320 | // navegador (formatear, comandos): funciona en parte. |
| 321 | export const TOMLISH = { lang: 'tomlish', ext: '.tomlish', scope: 'source.tomlish', key: '#E06C75' }; |
| 322 | export function partialLangVsix() { |
| 323 | const g = { scopeName: TOMLISH.scope, patterns: [{ match: '^\\s*[a-z]+(?=\\s*=)', name: 'variable.other.key.tomlish' }, { match: '#.*$', name: 'comment.line.tomlish' }] }; |
| 324 | return paquete({ |
| 325 | name: 'tomlish', displayName: 'Tomlish Support', description: 'Fully-featured Tomlish support', |
| 326 | categories: ['Programming Languages', 'Formatters'], main: './dist/extension.js', browser: './dist/browser.js', |
| 327 | contributes: { |
| 328 | languages: [{ id: TOMLISH.lang, aliases: ['Tomlish'], extensions: [TOMLISH.ext], configuration: './conf.json' }], |
| 329 | grammars: [{ language: TOMLISH.lang, scopeName: TOMLISH.scope, path: './g.json' }], |
| 330 | commands: [{ command: 't.fmt', title: 'Format' }], configuration: { properties: {} }, |
| 331 | }, |
| 332 | }, [['extension/g.json', JSON.stringify(g)], ['extension/conf.json', JSON.stringify({ comments: { lineComment: '#' }, brackets: [['[', ']'], ['{', '}']], autoClosingPairs: [{ open: '[', close: ']' }, { open: '"', close: '"' }] })], |
| 333 | ['extension/dist/extension.js', 'throw new Error("must never run")', { method: 99 }]]); |
| 334 | } |
| 335 | // Solo temas, sin código. |
| 336 | export const PURE_DARK = '#2A1B3D'; |
| 337 | export function pureThemeVsix() { |
| 338 | const t = bg => JSON.stringify({ colors: { 'editor.background': bg, 'editor.foreground': '#F8F8F2' }, tokenColors: [{ scope: 'keyword', settings: { foreground: '#FF79C6' } }] }); |
| 339 | return paquete({ name: 'pure-theme', displayName: 'Pure Theme', categories: ['Themes'], contributes: { themes: [ |
| 340 | { label: 'Pure Night', uiTheme: 'vs-dark', path: './night.json' }, { label: 'Pure Dusk', uiTheme: 'vs-dark', path: './dusk.json' }, |
| 341 | ] } }, [['extension/night.json', t(PURE_DARK)], ['extension/dusk.json', t('#3A2B4D')]]); |
| 342 | } |
| 343 | // Snippets para JavaScript, sin código. |
| 344 | export function jsSnippetsVsix() { |
| 345 | const s = { |
| 346 | 'Console log': { prefix: 'clg', body: 'console.log($1);' }, |
| 347 | 'Import': { prefix: 'imp', body: "import $1 from '$2';" }, |
| 348 | 'Arrow': { prefix: 'fn', body: 'const $1 = ($2) => {$0};' }, |
| 349 | 'Group': { Inner: { prefix: 'thr', body: 'throw new Error($1);' } }, |
| 350 | }; |
| 351 | return paquete({ name: 'js-snips', displayName: 'JS Snips', categories: ['Snippets'], contributes: { snippets: [{ language: 'javascript', path: './s.json' }, { language: 'typescript', path: './s.json' }] } }, |
| 352 | [['extension/s.json', JSON.stringify(s)]]); |
| 353 | } |