├── .prettierignore ├── .gitignore ├── images ├── icon.png ├── example.png └── icon.svg ├── .vscodeignore ├── snippets └── snippets.json ├── tsconfig.json ├── .vscode └── launch.json ├── eslint.config.mjs ├── src ├── utils.ts ├── writable.ts ├── package.ts ├── generate.ts ├── extension.ts ├── injection-grammar.ts └── constants.ts ├── .github └── workflows │ └── pipeline.yml ├── LICENSE ├── CONTRIBUTING.md ├── CHANGELOG.md ├── README.md ├── example.yaml └── package.json /.prettierignore: -------------------------------------------------------------------------------- 1 | syntaxes/ 2 | package.json 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | *.vsix 4 | stats.json 5 | -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harrydowning/vscode-yaml-embedded-languages/HEAD/images/icon.png -------------------------------------------------------------------------------- /images/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harrydowning/vscode-yaml-embedded-languages/HEAD/images/example.png -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | ** 2 | 3 | !dist/extension.js 4 | !syntaxes/ 5 | !snippets/snippets.json 6 | !images/icon.png 7 | !package.json 8 | !README.md 9 | !CHANGELOG.md 10 | !LICENSE 11 | -------------------------------------------------------------------------------- /snippets/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "yaml-embedded-languages": { 3 | "prefix": "yaml-embedded-languages", 4 | "body": ["# yaml-embedded-languages: $1"], 5 | "description": "Highlight all blocks from this point onwards with the specified language" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2020", 5 | "lib": ["ES2020"], // Exclude DOM globals 6 | "sourceMap": true, 7 | "rootDir": "src", 8 | "outDir": "dist", 9 | "resolveJsonModule": true, 10 | "strict": true, 11 | "allowSyntheticDefaultImports": true, 12 | "esModuleInterop": true, 13 | "paths": { 14 | "@package": ["./package.json"] 15 | } 16 | }, 17 | "include": ["src/**/*"] 18 | } 19 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": ["--extensionDevelopmentPath=${workspaceFolder}"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | import globals from "globals"; 4 | import eslint from "@eslint/js"; 5 | import tseslint from "typescript-eslint"; 6 | import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; 7 | 8 | export default tseslint.config( 9 | eslint.configs.recommended, 10 | ...tseslint.configs.recommended, 11 | { 12 | ignores: ["dist/*"], 13 | }, 14 | { 15 | languageOptions: { 16 | globals: globals.node, 17 | }, 18 | }, 19 | eslintPluginPrettierRecommended, // Must be last 20 | ); 21 | -------------------------------------------------------------------------------- /images/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Y 5 | L 6 | AM 7 | EMBEDDED 8 | LANGUAGES 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | export function isObject(value: unknown): value is object { 2 | return typeof value === "object" && value !== null; 3 | } 4 | 5 | export function isString(value: unknown): value is string { 6 | return typeof value === "string"; 7 | } 8 | 9 | export function isBoolean(value: unknown): value is boolean { 10 | return typeof value === "boolean"; 11 | } 12 | 13 | type Index = string | number | symbol; 14 | 15 | function _hasKey( 16 | obj: object, 17 | key: K, 18 | ): obj is { [P in K]: unknown } { 19 | return key in obj; 20 | } 21 | 22 | export function hasKey( 23 | obj: object, 24 | key: K, 25 | isType: (value: unknown) => value is T, 26 | ): obj is { [P in K]: T } { 27 | return _hasKey(obj, key) && isType(obj[key]); 28 | } 29 | -------------------------------------------------------------------------------- /src/writable.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | 3 | export class Writable { 4 | path; 5 | #absolutePath; 6 | 7 | constructor(path: string) { 8 | this.path = path; 9 | this.#absolutePath = `${__dirname}/../${path}`; 10 | } 11 | 12 | serialize() { 13 | return Buffer.from(JSON.stringify(this.valueOf(), null, 2)); 14 | } 15 | 16 | write() { 17 | const data = this.serialize(); 18 | let fileData; 19 | 20 | try { 21 | fileData = fs.readFileSync(this.#absolutePath); 22 | } catch { 23 | fileData = null; 24 | } 25 | 26 | if (fileData !== null && fileData.equals(data)) { 27 | return false; 28 | } 29 | 30 | try { 31 | fs.writeFileSync(this.#absolutePath, data); 32 | } catch (err) { 33 | console.error(err); 34 | return false; 35 | } 36 | 37 | console.log(`File '${this.#absolutePath}' saved.`); 38 | return true; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /.github/workflows/pipeline.yml: -------------------------------------------------------------------------------- 1 | name: pipeline 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | 9 | jobs: 10 | node-pipeline: 11 | uses: harrydowning/github-workflows/.github/workflows/node-pipeline.yml@v1.0.0 12 | with: 13 | repository-owner: harrydowning 14 | check-run: | # shell 15 | set -x 16 | npm i 17 | npm run generate 18 | [[ -z $(git status --porcelain) ]] 19 | npm run type 20 | npm run lint 21 | npm run format 22 | release-run: | # shell 23 | set -x 24 | npm i 25 | npm run build 26 | npm run package 27 | npm run release 28 | npm run publish 29 | pre-release-run: | # shell 30 | set -x 31 | npm i 32 | PRE_RELEASE=true 33 | npm run generate 34 | npm run build 35 | npm run package -- --pre-release 36 | npm run release -- --prerelease 37 | npm run publish -- --pre-release 38 | secrets: inherit 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Harry Downing 4 | Copyright (c) 2015 FichteFoll 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 | sell copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 22 | IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /src/package.ts: -------------------------------------------------------------------------------- 1 | import packageJson from "@package"; 2 | import { InjectionGrammar } from "./injection-grammar"; 3 | import { Writable } from "./writable"; 4 | 5 | export class Package extends Writable { 6 | #injectionGrammars; 7 | constructor(injectionGrammars: InjectionGrammar[]) { 8 | super(`package.json`); 9 | this.#injectionGrammars = injectionGrammars; 10 | } 11 | 12 | #getEmbeddedLanguages(injectionGrammar: InjectionGrammar) { 13 | const languages = injectionGrammar.languages; 14 | const ids = Object.keys(languages); 15 | return Object.fromEntries( 16 | ids.map((id) => [ 17 | `${injectionGrammar.embeddedScopeNamePrefix}.${id}`, 18 | languages[id].name, 19 | ]), 20 | ); 21 | } 22 | 23 | valueOf() { 24 | return { 25 | ...packageJson, 26 | contributes: { 27 | ...packageJson.contributes, 28 | grammars: this.#injectionGrammars.map((injectionGrammar) => ({ 29 | path: injectionGrammar.path, 30 | scopeName: injectionGrammar.scopeName, 31 | injectTo: [injectionGrammar.injectionScopeName], 32 | embeddedLanguages: this.#getEmbeddedLanguages(injectionGrammar), 33 | })), 34 | }, 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you for taking an interest in contributing to this project. All contributions are welcome. Please find below the suggested contribution, development, and release workflows. 4 | 5 | ## Contribution Workflow 6 | 7 | - Raise/find an [issue](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues) to fix 8 | - Fork the repository 9 | - Implement changes (see [development workflow](#development-workflow)) 10 | - Create pull request 11 | 12 | ## Development Workflow 13 | 14 | - Implement changes 15 | - Run `npm run generate` to update `package.json` and `syntaxes` 16 | - Run `npm run build` to update `dist/extension.js` 17 | - Use F5 within VS Code to test the extension 18 | 19 | > [!NOTE] 20 | > 21 | > - `package.json` is partially generated and `syntaxes` is fully generated. Relevant changes to these should be made in `src`. 22 | > - Any features intended for pre-release should be kept behind the `PRE_RELEASE` flag. These features can be enabled by setting the environment variable `PRE_RELEASE=true` on build and generate. 23 | 24 | ## Release Workflow 25 | 26 | - Update `version` in `package.json` and run `npm i` to update `package-lock.json` 27 | - Update `CHANGELOG.md` (ensure version links are set) 28 | - Merge to master with `[release]` or `[pre-release]` in the commit message 29 | -------------------------------------------------------------------------------- /src/generate.ts: -------------------------------------------------------------------------------- 1 | import { LANGUAGES, Languages } from "./constants"; 2 | import { InjectionGrammar } from "./injection-grammar"; 3 | import { Package } from "./package"; 4 | import { hasKey, isBoolean, isObject, isString } from "./utils"; 5 | 6 | const parseLanguages = (languages: { [key: string]: unknown }): Languages => { 7 | const parsedLanguages: Languages = {}; 8 | for (const id in languages) { 9 | let language = languages[id]; 10 | if (isString(language)) { 11 | language = { scopeName: language }; 12 | } 13 | 14 | if (isObject(language)) { 15 | if (!hasKey(language, "scopeName", isString)) { 16 | continue; 17 | } 18 | 19 | parsedLanguages[id] = { 20 | name: hasKey(language, "name", isString) ? language.name : id, 21 | scopeName: language.scopeName, 22 | stripIndent: hasKey(language, "stripIndent", isBoolean) 23 | ? language.stripIndent 24 | : false, 25 | }; 26 | } 27 | } 28 | return parsedLanguages; 29 | }; 30 | 31 | export const generateFiles = (languages = LANGUAGES) => { 32 | const parsedLanguages = parseLanguages(languages); 33 | const grammars = [ 34 | new InjectionGrammar("source.yaml", parsedLanguages), 35 | new InjectionGrammar("source.github-actions-workflow", parsedLanguages), 36 | ]; 37 | 38 | const writables = [new Package(grammars), ...grammars]; 39 | 40 | return writables.map((writable) => writable.write()).some(Boolean); 41 | }; 42 | 43 | if (require.main === module) { 44 | generateFiles(); 45 | } 46 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | import vscode from "vscode"; 2 | import packageJson from "@package"; 3 | import { 4 | INCLUDE_CONFIG, 5 | LANGUAGES, 6 | SUB_INCLUDE_CONFIG, 7 | VERSION_STATE, 8 | } from "./constants"; 9 | import { generateFiles } from "./generate"; 10 | 11 | const updateExtension = () => { 12 | const settings = vscode.workspace.getConfiguration(packageJson.name); 13 | const includeLanguages = settings[SUB_INCLUDE_CONFIG]; 14 | const allLanguages = { ...LANGUAGES, ...includeLanguages }; 15 | 16 | const filesChanged = generateFiles(allLanguages); 17 | 18 | if (filesChanged) { 19 | const message = `Reload window to allow changes to take effect?`; 20 | const items = ["Yes", "No"]; 21 | vscode.window.showInformationMessage(message, ...items).then((item) => { 22 | if (item === items[0]) { 23 | vscode.commands.executeCommand("workbench.action.reloadWindow"); 24 | } 25 | }); 26 | } 27 | }; 28 | 29 | export const activate = (context: vscode.ExtensionContext) => { 30 | const currentVersion = packageJson.version; 31 | const previousVersion = context.globalState.get(VERSION_STATE); 32 | 33 | if (previousVersion !== currentVersion) { 34 | updateExtension(); 35 | context.globalState.update(VERSION_STATE, currentVersion); 36 | } 37 | 38 | const disposable = vscode.workspace.onDidChangeConfiguration((event) => { 39 | if (event.affectsConfiguration(INCLUDE_CONFIG)) { 40 | updateExtension(); 41 | } 42 | }); 43 | 44 | context.subscriptions.push(disposable); 45 | }; 46 | 47 | export const deactivate = () => {}; 48 | -------------------------------------------------------------------------------- /src/injection-grammar.ts: -------------------------------------------------------------------------------- 1 | import packageJson from "@package"; 2 | import { Languages } from "./constants"; 3 | import { Writable } from "./writable"; 4 | 5 | export class InjectionGrammar extends Writable { 6 | embeddedScopeNamePrefix = "meta.embedded.inline"; 7 | scopeName; 8 | injectionScopeName; 9 | languages; 10 | 11 | constructor(injectionScopeName: string, languages: Languages) { 12 | super(`./syntaxes/${injectionScopeName}.injection.tmLanguage.json`); 13 | this.scopeName = `${injectionScopeName}.injection`; 14 | this.injectionScopeName = injectionScopeName; 15 | this.languages = languages; 16 | } 17 | 18 | #getPatterns() { 19 | const entries = Object.entries(this.languages); 20 | const patterns = [ 21 | { 22 | begin: `#\\s*${packageJson.name}\\s*$`, 23 | beginCaptures: { 24 | 0: { name: "entity.name.type.yaml" }, 25 | }, 26 | patterns: [{ include: this.injectionScopeName }], 27 | }, 28 | ...entries.map(([id, { scopeName, stripIndent }]) => ({ 29 | begin: `#\\s*${packageJson.name}\\s*:\\s*${id}\\s*$`, 30 | beginCaptures: { 31 | 0: { name: "entity.name.type.yaml" }, 32 | }, 33 | patterns: [ 34 | { 35 | begin: `(?i)(?:(\\|)|(>))([1-9])?([-+])?(.*)\\s*$`, 36 | beginCaptures: { 37 | 1: { name: "keyword.control.flow.block-scalar.literal.yaml" }, 38 | 2: { name: "keyword.control.flow.block-scalar.folded.yaml" }, 39 | 3: { name: "constant.numeric.indentation-indicator.yaml" }, 40 | 4: { name: "storage.modifier.chomping-indicator.yaml" }, 41 | 5: { 42 | patterns: [ 43 | { include: `${this.injectionScopeName}#comment` }, 44 | { 45 | match: ".+", 46 | name: "invalid.illegal.expected-comment-or-newline.yaml", 47 | }, 48 | ], 49 | }, 50 | }, 51 | end: "^(?=\\S)|(?!\\G)", 52 | patterns: [ 53 | { 54 | begin: "(?>^|\\G)([ ]+)(?! )", 55 | end: "^(?!\\1|\\s*$)", 56 | while: stripIndent ? "^$|\\1" : undefined, 57 | name: `${this.embeddedScopeNamePrefix}.${id}`, 58 | patterns: [{ include: scopeName }], 59 | }, 60 | ], 61 | }, 62 | { include: this.injectionScopeName }, 63 | ], 64 | })), 65 | ...entries.map(([id, { scopeName, stripIndent }]) => ({ 66 | begin: `(?i)(?:(\\|)|(>))([1-9])?([-+])?\\s+(#\\s*(?:${id})\\s*)$`, 67 | beginCaptures: { 68 | 1: { name: "keyword.control.flow.block-scalar.literal.yaml" }, 69 | 2: { name: "keyword.control.flow.block-scalar.folded.yaml" }, 70 | 3: { name: "constant.numeric.indentation-indicator.yaml" }, 71 | 4: { name: "storage.modifier.chomping-indicator.yaml" }, 72 | 5: { name: "entity.name.type.yaml" }, 73 | }, 74 | end: "^(?=\\S)|(?!\\G)", 75 | patterns: [ 76 | { 77 | begin: "(?>^|\\G)([ ]+)(?! )", 78 | end: "^(?!\\1|\\s*$)", 79 | while: stripIndent ? "^$|\\1" : undefined, 80 | name: `${this.embeddedScopeNamePrefix}.${id}`, 81 | patterns: [{ include: scopeName }], 82 | }, 83 | ], 84 | })), 85 | ]; 86 | return patterns; 87 | } 88 | 89 | valueOf() { 90 | return { 91 | scopeName: this.scopeName, 92 | injectionSelector: `L:${this.injectionScopeName} -comment -string`, 93 | patterns: this.#getPatterns(), 94 | }; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/constants.ts: -------------------------------------------------------------------------------- 1 | import packageJson from "@package"; 2 | 3 | export const SUB_INCLUDE_CONFIG = "include"; 4 | export const INCLUDE_CONFIG = `${packageJson.name}.${SUB_INCLUDE_CONFIG}`; 5 | export const VERSION_STATE = "version"; 6 | export const PRE_RELEASE = process.env.PRE_RELEASE === "true"; 7 | 8 | export type Languages = { 9 | [key: string]: { 10 | name: string; 11 | scopeName: string; 12 | stripIndent: boolean; 13 | }; 14 | }; 15 | 16 | /* eslint sort-keys: ["error", "asc"] */ 17 | export const LANGUAGES = { 18 | bat: "source.batchfile", 19 | bibtex: "text.bibtex", 20 | c: "source.c", 21 | "c#": { 22 | name: "csharp", 23 | scopeName: "source.cs", 24 | }, 25 | "c\\+\\+": { 26 | name: "cpp", 27 | scopeName: "source.cpp", 28 | }, 29 | clojure: "source.clojure", 30 | coffee: { 31 | name: "coffeescript", 32 | scopeName: "source.coffee", 33 | }, 34 | cpp: "source.cpp", 35 | csharp: "source.cs", 36 | css: "source.css", 37 | cuda: { 38 | name: "cuda-cpp", 39 | scopeName: "source.cuda-cpp", 40 | }, 41 | dart: "source.dart", 42 | diff: { 43 | scopeName: "source.diff", 44 | stripIndent: true, 45 | }, 46 | dockercompose: { 47 | scopeName: "source.yaml", 48 | stripIndent: true, 49 | }, 50 | dockerfile: "source.dockerfile", 51 | "f#": { 52 | name: "fsharp", 53 | scopeName: "source.fsharp", 54 | }, 55 | fsharp: "source.fsharp", 56 | go: "source.go", 57 | groovy: "source.groovy", 58 | handlebars: "text.html.handlebars", 59 | hlsl: "source.hlsl", 60 | html: "text.html.derivative", 61 | ini: "source.ini", 62 | jade: "text.pug", 63 | java: "source.java", 64 | javascript: "source.js", 65 | js: { 66 | name: "javascript", 67 | scopeName: "source.js", 68 | }, 69 | json: "source.json", 70 | jsonc: "source.json.comments", 71 | jsonl: "source.json.lines", 72 | jsx: { 73 | name: "javascriptreact", 74 | scopeName: "source.js.jsx", 75 | }, 76 | julia: "source.julia", 77 | latex: { 78 | scopeName: "text.tex.latex", 79 | stripIndent: true, 80 | }, 81 | less: "source.css.less", 82 | log: "text.log", 83 | lua: "source.lua", 84 | make: { 85 | name: "makefile", 86 | scopeName: "source.makefile", 87 | }, 88 | makefile: "source.makefile", 89 | markdown: { 90 | scopeName: "text.html.markdown", 91 | stripIndent: true, 92 | }, 93 | math: { 94 | name: "markdown-math", 95 | scopeName: "text.html.markdown.math", 96 | }, 97 | objc: { 98 | name: "objective-c", 99 | scopeName: "source.objc", 100 | }, 101 | objcpp: { 102 | name: "objective-cpp", 103 | scopeName: "source.objcpp", 104 | }, 105 | perl: "source.perl", 106 | php: "text.html.php", 107 | pip: { 108 | name: "pip-requirements", 109 | scopeName: "source.pip-requirements", 110 | }, 111 | powerfx: { 112 | name: "javascript", 113 | scopeName: "source.js", 114 | }, 115 | powershell: "source.powershell", 116 | properties: "source.ini", 117 | py: { 118 | name: "python", 119 | scopeName: "source.python", 120 | }, 121 | python: "source.python", 122 | r: "source.r", 123 | raku: "source.perl.6", 124 | razor: "text.html.cshtml", 125 | regex: "source.js.regexp", 126 | requirements: { 127 | name: "pip-requirements", 128 | scopeName: "source.pip-requirements", 129 | }, 130 | rst: { 131 | name: "restructuredtext", 132 | scopeName: "source.rst", 133 | }, 134 | ruby: "source.ruby", 135 | rust: "source.rust", 136 | scss: "source.css.scss", 137 | shaderlab: "source.shaderlab", 138 | shell: { 139 | name: "shellscript", 140 | scopeName: "source.shell", 141 | }, 142 | sql: "source.sql", 143 | swift: "source.swift", 144 | tex: "text.tex", 145 | ts: { 146 | name: "typescript", 147 | scopeName: "source.ts", 148 | }, 149 | tsx: { 150 | name: "typescriptreact", 151 | scopeName: "source.tsx", 152 | }, 153 | typescript: "source.ts", 154 | vb: "source.asp.vb.net", 155 | xml: "text.xml", 156 | xsl: "text.xml.xsl", 157 | yaml: { 158 | scopeName: "source.yaml", 159 | stripIndent: true, 160 | }, 161 | }; 162 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this extension will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/). 6 | 7 | ## [Unreleased] 8 | 9 | ## [1.3.0] - 2024-10-15 10 | 11 | ### Changed 12 | 13 | - `injectionSelector` to allow nested embedded languages 14 | 15 | ## [1.2.0] - 2024-09-15 16 | 17 | ### Added 18 | 19 | - Ability to highlight all blocks from a point onwards 20 | - Comment snippet 21 | - Feature & settings documentation 22 | 23 | ### Changed 24 | 25 | - Extension icon 26 | 27 | ## [1.1.0] - 2024-09-14 (pre-release) 28 | 29 | ### Added 30 | 31 | - Ability to highlight all blocks from a point onwards 32 | 33 | ## [1.0.6] - 2024-09-12 34 | 35 | ### Fixed 36 | 37 | - Indentation in YAML-based embedded languages 38 | - Changelog markup 39 | 40 | ### Reverted 41 | 42 | - Grammar fix introduced in v1.0.5 43 | 44 | ## [1.0.5] - 2024-09-09 45 | 46 | ### Fixed 47 | 48 | - Grammar for VS Code 1.93.0 [microsoft/vscode#224978](https://github.com/microsoft/vscode/issues/224978) 49 | 50 | ## [1.0.4] - 2024-09-08 51 | 52 | ### Changed 53 | 54 | - Repository name to `vscode-yaml-embedded-languages` 55 | 56 | ## [1.0.3] - 2024-08-30 57 | 58 | ### Fixed 59 | 60 | - Highlighting of language identifier inside comments 61 | 62 | ## [1.0.2] - 2024-08-29 63 | 64 | ### Changed 65 | 66 | - `scopeName` to be required 67 | - Output to be bundled and minified 68 | - Injection grammar to be separated into `source.yaml.injection` and `source.github-actions-workflow.injection` 69 | 70 | ## [1.0.1] - 2024-08-26 71 | 72 | ### Fixed 73 | 74 | - `while` pattern used for `stripIndent` to allow empty lines 75 | 76 | ## [1.0.0] - 2024-08-26 77 | 78 | ### Added 79 | 80 | - `stripIndent` language config option 81 | - Languages `bat`, `bibtex`, `cuda-cpp`, `dart`, `dockercompose`, `handlebars`, `hlsl`, `ini`, `jade`, `jsonc`, `jsonl`, `javascriptreact`, `julia`, `less`, `log`, `markdown-math`, `objective-cpp`, `php`, `raku`, `razor`, `restructuredtext`, `vb`, and `xsl` 82 | - Language aliases `c#`, `f#`, `make` 83 | 84 | ### Fixed 85 | 86 | - Markdown indentation ([#13](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/13)) 87 | - Highlighting for new YAML grammar 88 | - `csharp` highlighting 89 | 90 | ### Changed 91 | 92 | - Fully generated `package.json` to be partially generated 93 | - `regex` language to use scope `source.js.regexp` 94 | - Extension icon 95 | - Scope of language identifier comment to highlight recognized languages 96 | 97 | ### Removed 98 | 99 | - Languages `dosbatch` and `slim` (no built-in VS Code support) 100 | 101 | ## [0.4.0] - 2024-08-18 102 | 103 | ### Added 104 | 105 | - Option to specify language name in `yaml-embedded-languages.include` config 106 | 107 | ### Fixed 108 | 109 | - Built-in language names ([#12](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/12)) 110 | 111 | ## [0.3.3] - 2024-07-06 112 | 113 | ### Changed 114 | 115 | - Extension to generate files on update 116 | - Doc formatting and links 117 | 118 | ## [0.3.2] - 2024-07-06 119 | 120 | ### Fixed 121 | 122 | - User languages reset on extension update ([#24](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/24)) 123 | - User language override precedence 124 | 125 | ## [0.3.1] - 2024-06-29 126 | 127 | ### Fixed 128 | 129 | - Broken link in CHANGELOG 130 | 131 | ## [0.3.0] - 2024-06-28 132 | 133 | ### Added 134 | 135 | - Support for Power Fx ([#17](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/17)) 136 | 137 | ## [0.2.0] - 2023-07-29 138 | 139 | ### Added 140 | 141 | - Support for GitHub Actions ([#9](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/9)) 142 | - `CONTRIBUTING.md` documentation 143 | - `-dev` flag on `extension.js` 144 | 145 | ### Fixed 146 | 147 | - Path separators on macOS ([#7](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/7)) 148 | 149 | ### Changed 150 | 151 | - All path separators to POSIX standard (`/`) 152 | - `README.md` 153 | 154 | ## [0.1.0] - 2023-03-30 155 | 156 | ### Added 157 | 158 | - `yaml-embedded-languages.include` config setting to allow user language extensibility 159 | 160 | ## [0.0.2] - 2023-03-29 161 | 162 | ### Fixed 163 | 164 | - Example image on README 165 | 166 | ## [0.0.1] - 2023-03-29 167 | 168 | ### Added 169 | 170 | - Highlighting support for 40 languages in YAML block-scalars 171 | 172 | [unreleased]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.3.0...HEAD 173 | [1.3.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.2.0...v1.3.0 174 | [1.2.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.1.0...v1.2.0 175 | [1.1.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.0.6...v1.1.0 176 | [1.0.6]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.0.5...v1.0.6 177 | [1.0.5]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.0.4...v1.0.5 178 | [1.0.4]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.0.3...v1.0.4 179 | [1.0.3]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.0.2...v1.0.3 180 | [1.0.2]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.0.1...v1.0.2 181 | [1.0.1]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v1.0.0...v1.0.1 182 | [1.0.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.4.0...v1.0.0 183 | [0.4.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.3.3...v0.4.0 184 | [0.3.3]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.3.2...v0.3.3 185 | [0.3.2]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.3.1...v0.3.2 186 | [0.3.1]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.3.0...v0.3.1 187 | [0.3.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.2.0...v0.3.0 188 | [0.2.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.1.0...v0.2.0 189 | [0.1.0]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.0.2...v0.1.0 190 | [0.0.2]: https://github.com/harrydowning/vscode-yaml-embedded-languages/compare/v0.0.1...v0.0.2 191 | [0.0.1]: https://github.com/harrydowning/vscode-yaml-embedded-languages/releases/tag/v0.0.1 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # YAML Embedded Languages 4 | 5 | ![GitHub License](https://img.shields.io/github/license/harrydowning/yaml-embedded-languages?style=for-the-badge) 6 | ![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/harrydowning.yaml-embedded-languages?style=for-the-badge) 7 | ![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/harrydowning.yaml-embedded-languages?style=for-the-badge&color=rebeccapurple) 8 | 9 |
10 | 11 | ## Features 12 | 13 | Syntax highlighting within YAML block-scalars for [50+ built-in languages](#built-in-languages "Built-In Languages") and the ability to add highlighting for any other language with the [yaml-embedded-languages.include](#extension-settings "Extension Settings") configuration setting. 14 | 15 | ![Example yaml file showing syntax highlighting](https://raw.githubusercontent.com/harrydowning/yaml-embedded-languages/master/images/example.png) 16 | 17 | ### Usage 18 | 19 | To highlight a single block, place a comment with the language identifier next to the block identifier. 20 | 21 | ```yaml 22 | example: | # 23 | highlighted 24 | ``` 25 | 26 | To highlight all blocks from a point onwards, place a comment with the extension name followed by the language identifier. 27 | 28 | ```yaml 29 | # yaml-embedded-languages: 30 | example: | 31 | highlighted 32 | ``` 33 | 34 | To stop highlighting blocks place a comment with the extension name. 35 | 36 | ```yaml 37 | # yaml-embedded-languages 38 | example: | 39 | not highlighted 40 | ``` 41 | 42 | ### Built-In Languages 43 | 44 | The following list shows all valid identifiers for the built-in languages: 45 | 46 | | Language | Identifier | 47 | | ---------------- | --------------------- | 48 | | bat | `bat` | 49 | | bibtex | `bibtex` | 50 | | c | `c` | 51 | | clojure | `clojure` | 52 | | coffeescript | `coffee` | 53 | | cpp | `cpp`, `c++` | 54 | | csharp | `csharp`, `c#` | 55 | | css | `css` | 56 | | cuda-cpp | `cuda` | 57 | | dart | `dart` | 58 | | diff | `diff` | 59 | | dockercompose | `dockercompose` | 60 | | dockerfile | `dockerfile` | 61 | | fsharp | `fsharp`, `f#` | 62 | | go | `go` | 63 | | groovy | `groovy` | 64 | | handlebars | `handlebars` | 65 | | hlsl | `hlsl` | 66 | | html | `html` | 67 | | ini | `ini` | 68 | | jade | `jade` | 69 | | java | `java` | 70 | | javascript | `js`, `javascript` | 71 | | javascriptreact | `jsx` | 72 | | json | `json` | 73 | | jsonc | `jsonc` | 74 | | jsonl | `jsonl` | 75 | | julia | `julia` | 76 | | latex | `latex` | 77 | | less | `less` | 78 | | log | `log` | 79 | | lua | `lua` | 80 | | makefile | `make`, `makefile` | 81 | | markdown | `markdown` | 82 | | markdown-math | `math` | 83 | | objective-c | `objc` | 84 | | objective-cpp | `objcpp` | 85 | | perl | `perl` | 86 | | php | `php` | 87 | | pip-requirements | `pip`, `requirements` | 88 | | powerfx\* | `powerfx` | 89 | | powershell | `powershell` | 90 | | properties | `properties` | 91 | | python | `py`, `python` | 92 | | r | `r` | 93 | | raku | `raku` | 94 | | razor | `razor` | 95 | | regex\* | `regex` | 96 | | restructuredtext | `rst` | 97 | | ruby | `ruby` | 98 | | rust | `rust` | 99 | | scss | `scss` | 100 | | shaderlab | `shaderlab` | 101 | | shellscript | `shell` | 102 | | sql | `sql` | 103 | | swift | `swift` | 104 | | tex | `tex` | 105 | | typescript | `ts`, `typescript` | 106 | | typescriptreact | `tsx` | 107 | | vb | `vb` | 108 | | xml | `xml` | 109 | | xsl | `xsl` | 110 | | yaml | `yaml` | 111 | 112 | \*_Not a valid VS Code language_ 113 | 114 | ## Requirements 115 | 116 | None 117 | 118 | ## Extension Settings 119 | 120 | | Name | Description | 121 | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 122 | | `yaml-embedded-languages.include` | An object where the key defines the language identifier with regex and the value specifies the language TextMate scope name. By default the language identifier will be used as the language name. To change this, the value can be specified as an object with properties including `name`, `scopeName` (required), and `stripIndent`. Hover over these in VS Code to find out more. | 123 | 124 | ## Known Issues 125 | 126 | See [Issues](https://github.com/harrydowning/vscode-yaml-embedded-languages/issues) 127 | 128 | ## Contribution Notes 129 | 130 | See [CONTRIBUTING](CONTRIBUTING.md) 131 | 132 | ## Release Notes 133 | 134 | See [CHANGELOG](CHANGELOG.md) 135 | -------------------------------------------------------------------------------- /example.yaml: -------------------------------------------------------------------------------- 1 | bat-example: | # bat 2 | ECHO Hello, World! 3 | 4 | bibtex-example: | # bibtex 5 | @book{HelloWorld} 6 | 7 | c-example: | # c 8 | // https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 9 | #include 10 | 11 | int main() { 12 | printf("Hello, World!"); 13 | return 0; 14 | } 15 | 16 | clojure-example: | # clojure 17 | (println "Hello, World!") 18 | 19 | coffeescript-example: | # coffee 20 | console.log "Hello, World!" 21 | 22 | cpp-example: | # c++ 23 | // https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 24 | #include 25 | 26 | int main() 27 | { 28 | std::cout << "Hello, World!" << std::endl; 29 | return 0; 30 | } 31 | 32 | csharp-example: | # csharp 33 | public class HelloWorld 34 | { 35 | public static void Main(string[] args) 36 | { 37 | System.Console.WriteLine("Hello, World!"); 38 | } 39 | } 40 | 41 | css-example: | # css 42 | h1::before { 43 | content: "Hello, World!"; 44 | } 45 | 46 | cuda-cpp-example: | # cuda 47 | // https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 48 | #include 49 | 50 | __global__ void hello_world(){ 51 | printf("Hello, World!"); 52 | } 53 | 54 | int main() { 55 | hello_world<<<1,1>>>(); 56 | return 0; 57 | } 58 | 59 | dart-example: | # dart 60 | void main() { 61 | print('Hello, World!'); 62 | } 63 | 64 | diff-example: | # diff 65 | - Hello World! 66 | + Hello, World! 67 | 68 | dockercompose-example: | # dockercompose 69 | services: 70 | hello-world: 71 | build: . 72 | 73 | dockerfile-example: | # dockerfile 74 | # https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 75 | FROM alpine:latest 76 | CMD ["echo", "Hello, World!"] 77 | 78 | fsharp-example: | # fsharp 79 | open System 80 | printfn "Hello, World!" 81 | 82 | go-example: | # go 83 | package main 84 | 85 | import "fmt" 86 | 87 | func main() { 88 | fmt.Println("Hello, World!") 89 | } 90 | 91 | groovy-example: | # groovy 92 | println 'Hello, World!' 93 | 94 | handlebars-example: | # handlebars 95 | {{Hello}}, {{World}}! 96 | 97 | hlsl-example: | # hlsl 98 | float4 PS_Main(float4 pos : SV_Position) : SV_Target 99 | { 100 | return float4(1.0f, 0.0f, 0.0f, 1.0f); 101 | } 102 | 103 | html-example: | # html 104 | 105 | 106 | 107 | Hello, World! 108 | 109 | 110 |

Hello, World!

111 | 112 | 113 | 114 | ini-example: | # ini 115 | [section] 116 | message="Hello, World!" 117 | 118 | jade-example: | # jade 119 | //- https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 120 | doctype html 121 | html 122 | head 123 | title Hello, World! 124 | body 125 | h1 Hello, World! 126 | 127 | java-example: | # java 128 | class HelloWorld { 129 | public static void main(String[] args) { 130 | System.out.println("Hello, World!"); 131 | } 132 | } 133 | 134 | javascript-example: | # js 135 | console.log("Hello, World!") 136 | 137 | javascriptreact-example: | # jsx 138 | function HelloWorld() { 139 | return

Hello, World!

; 140 | }; 141 | 142 | json-example: | # json 143 | { 144 | "message": "Hello, World!" 145 | } 146 | 147 | jsonc-example: | # jsonc 148 | { // comment 149 | "message": "Hello, World!" 150 | } 151 | 152 | jsonl-example: | # jsonl 153 | {"message": "Hello, World!"} 154 | {"message": "Hello, World!"} 155 | 156 | julia-example: | # julia 157 | println("hello world") 158 | 159 | latex-example: | # latex 160 | \documentclass[12pt]{article} 161 | \begin{document} 162 | Hello world! 163 | \end{document} 164 | 165 | less-example: | # less 166 | @content: "Hello, World!"; 167 | h1::before { 168 | content: @content; 169 | } 170 | 171 | log-example: | # log 172 | [DEBUG] 2024-08-25T10:05:07.470Z - Hello, World! example.js:1 173 | [VERBOSE] 2024-08-25T10:05:07.470Z - Hello, World! example.js:2 174 | [INFO] 2024-08-25T10:05:07.470Z - Hello, World! example.js:3 175 | [WARN] 2024-08-25T10:05:07.470Z - Hello, World! example.js:4 176 | [ERROR] 2024-08-25T10:05:07.470Z - Hello, World! example.js:5 177 | 178 | lua-example: | # lua 179 | print("Hello, World!") 180 | 181 | makefile-example: | # make 182 | # https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 183 | target: 184 | echo "Hello, World!" 185 | 186 | markdown-example: | # markdown 187 | # Hello, World! 188 | Text 189 | *Italic* 190 | **Bold** 191 | `Code` 192 | 193 | markdown-math-example: | # math 194 | When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are 195 | $$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$ 196 | 197 | objective-c-example: | # objc 198 | // https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 199 | #import 200 | 201 | int main(int argc, const char * argv[]) { 202 | @autoreleasepool { 203 | NSLog(@"Hello, World!"); 204 | } 205 | return 0; 206 | } 207 | 208 | objective-cpp-example: | # objcpp 209 | // https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 210 | #import 211 | #include 212 | 213 | int main(int argc, const char * argv[]) { 214 | @autoreleasepool { 215 | std::cout << "Hello, World!" << std::endl; 216 | } 217 | return 0; 218 | } 219 | 220 | perl-example: | # perl 221 | use strict; 222 | use warnings; 223 | print("Hello, World!"); 224 | 225 | php-example: | # php 226 | 227 | 228 | 229 | Hello, World! 230 | 231 | 232 |

233 | 234 | 235 | 236 | pip-requirements-example: | # pip 237 | # https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 238 | package==1.0.0 239 | 240 | powerfx-example: | # powerfx 241 | =Notify("Hello, World!") 242 | 243 | powershell-example: | # powershell 244 | Write-Host 'Hello, World!' 245 | 246 | properties: | # properties 247 | message="Hello, World!" 248 | 249 | python-example: | # python 250 | print("Hello, World!") 251 | 252 | r-example: | # r 253 | print("Hello, World!") 254 | 255 | raku-example: | # raku 256 | say 'Hello, World!'; 257 | 258 | razor-example: | # razor 259 | 260 | 261 | 262 | Hello, World! 263 | 264 | 265 | @{ var message = "Hello, World!"; } 266 |

@message

267 | 268 | 269 | 270 | regex-example: | # regex 271 | ^[Hh]ello, [Ww]orld!?$ 272 | 273 | restructuredtext-example: | # rst 274 | Hello, World! 275 | ============= 276 | Text 277 | *Italic* 278 | **Bold** 279 | ``Code`` 280 | 281 | ruby-example: | # ruby 282 | puts "Hello, World!" 283 | 284 | rust-example: | # rust 285 | fn main() { 286 | println!("Hello World!"); 287 | } 288 | 289 | scss-example: | # scss 290 | $content: "Hello, World!"; 291 | 292 | h1::before { 293 | content: $content; 294 | } 295 | 296 | shaderlab-example: | # shaderlab 297 | Shader "Examples/ShaderSyntax" 298 | { 299 | CustomEditor = "ExampleCustomEditor" 300 | 301 | Properties 302 | { 303 | // Material property declarations go here 304 | } 305 | SubShader 306 | { 307 | // The code that defines the rest of the SubShader goes here 308 | 309 | Pass 310 | { 311 | // The code that defines the Pass goes here 312 | } 313 | } 314 | 315 | Fallback "ExampleFallbackShader" 316 | } 317 | 318 | shellscript-example: | # shell 319 | # https://github.com/harrydowning/vscode-yaml-embedded-languages/issues/32 320 | echo "Hello, World!" 321 | 322 | sql-example: | # sql 323 | SELECT * FROM Example WHERE content="Hello, World!" 324 | 325 | swift-example: | # swift 326 | print("Hello, World!") 327 | 328 | tex-example: | # tex 329 | Hello, World! 330 | \bye 331 | 332 | typescript-example: | # ts 333 | console.log("Hello, World!") as void; 334 | 335 | typescriptreact-example: | # tsx 336 | function HelloWorld(): JSX.Element { 337 | return

Hello, World!

; 338 | }; 339 | 340 | vb-example: | # vb 341 | Module Program 342 | Sub Main() 343 | Console.WriteLine("Hello, World!") 344 | End Sub 345 | End Module 346 | 347 | xml-example: | # xml 348 | 349 | 350 | Hello, World! 351 | 352 | 353 | xsl-example: | # xsl 354 | 355 | 356 | 357 | 358 | 359 | <xsl:value-of select="/root/message"/> 360 | 361 | 362 |

363 | 364 | 365 |
366 |
367 | 368 | yaml-example: | # yaml 369 | message: Hello, World! 370 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yaml-embedded-languages", 3 | "version": "1.3.0", 4 | "displayName": "YAML Embedded Languages", 5 | "description": "Support for syntax highlighting within YAML block-scalars.", 6 | "icon": "images/icon.png", 7 | "publisher": "harrydowning", 8 | "author": { 9 | "name": "Harry Downing", 10 | "email": "harrydowning.dev@gmail.com" 11 | }, 12 | "homepage": "https://github.com/harrydowning/vscode-yaml-embedded-languages#readme", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/harrydowning/vscode-yaml-embedded-languages.git" 16 | }, 17 | "license": "MIT", 18 | "engines": { 19 | "vscode": "^1.74.0" 20 | }, 21 | "categories": [ 22 | "Programming Languages" 23 | ], 24 | "activationEvents": [ 25 | "onStartupFinished" 26 | ], 27 | "main": "dist/extension.js", 28 | "contributes": { 29 | "grammars": [ 30 | { 31 | "path": "./syntaxes/source.yaml.injection.tmLanguage.json", 32 | "scopeName": "source.yaml.injection", 33 | "injectTo": [ 34 | "source.yaml" 35 | ], 36 | "embeddedLanguages": { 37 | "meta.embedded.inline.bat": "bat", 38 | "meta.embedded.inline.bibtex": "bibtex", 39 | "meta.embedded.inline.c": "c", 40 | "meta.embedded.inline.c#": "csharp", 41 | "meta.embedded.inline.c\\+\\+": "cpp", 42 | "meta.embedded.inline.clojure": "clojure", 43 | "meta.embedded.inline.coffee": "coffeescript", 44 | "meta.embedded.inline.cpp": "cpp", 45 | "meta.embedded.inline.csharp": "csharp", 46 | "meta.embedded.inline.css": "css", 47 | "meta.embedded.inline.cuda": "cuda-cpp", 48 | "meta.embedded.inline.dart": "dart", 49 | "meta.embedded.inline.diff": "diff", 50 | "meta.embedded.inline.dockercompose": "dockercompose", 51 | "meta.embedded.inline.dockerfile": "dockerfile", 52 | "meta.embedded.inline.f#": "fsharp", 53 | "meta.embedded.inline.fsharp": "fsharp", 54 | "meta.embedded.inline.go": "go", 55 | "meta.embedded.inline.groovy": "groovy", 56 | "meta.embedded.inline.handlebars": "handlebars", 57 | "meta.embedded.inline.hlsl": "hlsl", 58 | "meta.embedded.inline.html": "html", 59 | "meta.embedded.inline.ini": "ini", 60 | "meta.embedded.inline.jade": "jade", 61 | "meta.embedded.inline.java": "java", 62 | "meta.embedded.inline.javascript": "javascript", 63 | "meta.embedded.inline.js": "javascript", 64 | "meta.embedded.inline.json": "json", 65 | "meta.embedded.inline.jsonc": "jsonc", 66 | "meta.embedded.inline.jsonl": "jsonl", 67 | "meta.embedded.inline.jsx": "javascriptreact", 68 | "meta.embedded.inline.julia": "julia", 69 | "meta.embedded.inline.latex": "latex", 70 | "meta.embedded.inline.less": "less", 71 | "meta.embedded.inline.log": "log", 72 | "meta.embedded.inline.lua": "lua", 73 | "meta.embedded.inline.make": "makefile", 74 | "meta.embedded.inline.makefile": "makefile", 75 | "meta.embedded.inline.markdown": "markdown", 76 | "meta.embedded.inline.math": "markdown-math", 77 | "meta.embedded.inline.objc": "objective-c", 78 | "meta.embedded.inline.objcpp": "objective-cpp", 79 | "meta.embedded.inline.perl": "perl", 80 | "meta.embedded.inline.php": "php", 81 | "meta.embedded.inline.pip": "pip-requirements", 82 | "meta.embedded.inline.powerfx": "javascript", 83 | "meta.embedded.inline.powershell": "powershell", 84 | "meta.embedded.inline.properties": "properties", 85 | "meta.embedded.inline.py": "python", 86 | "meta.embedded.inline.python": "python", 87 | "meta.embedded.inline.r": "r", 88 | "meta.embedded.inline.raku": "raku", 89 | "meta.embedded.inline.razor": "razor", 90 | "meta.embedded.inline.regex": "regex", 91 | "meta.embedded.inline.requirements": "pip-requirements", 92 | "meta.embedded.inline.rst": "restructuredtext", 93 | "meta.embedded.inline.ruby": "ruby", 94 | "meta.embedded.inline.rust": "rust", 95 | "meta.embedded.inline.scss": "scss", 96 | "meta.embedded.inline.shaderlab": "shaderlab", 97 | "meta.embedded.inline.shell": "shellscript", 98 | "meta.embedded.inline.sql": "sql", 99 | "meta.embedded.inline.swift": "swift", 100 | "meta.embedded.inline.tex": "tex", 101 | "meta.embedded.inline.ts": "typescript", 102 | "meta.embedded.inline.tsx": "typescriptreact", 103 | "meta.embedded.inline.typescript": "typescript", 104 | "meta.embedded.inline.vb": "vb", 105 | "meta.embedded.inline.xml": "xml", 106 | "meta.embedded.inline.xsl": "xsl", 107 | "meta.embedded.inline.yaml": "yaml" 108 | } 109 | }, 110 | { 111 | "path": "./syntaxes/source.github-actions-workflow.injection.tmLanguage.json", 112 | "scopeName": "source.github-actions-workflow.injection", 113 | "injectTo": [ 114 | "source.github-actions-workflow" 115 | ], 116 | "embeddedLanguages": { 117 | "meta.embedded.inline.bat": "bat", 118 | "meta.embedded.inline.bibtex": "bibtex", 119 | "meta.embedded.inline.c": "c", 120 | "meta.embedded.inline.c#": "csharp", 121 | "meta.embedded.inline.c\\+\\+": "cpp", 122 | "meta.embedded.inline.clojure": "clojure", 123 | "meta.embedded.inline.coffee": "coffeescript", 124 | "meta.embedded.inline.cpp": "cpp", 125 | "meta.embedded.inline.csharp": "csharp", 126 | "meta.embedded.inline.css": "css", 127 | "meta.embedded.inline.cuda": "cuda-cpp", 128 | "meta.embedded.inline.dart": "dart", 129 | "meta.embedded.inline.diff": "diff", 130 | "meta.embedded.inline.dockercompose": "dockercompose", 131 | "meta.embedded.inline.dockerfile": "dockerfile", 132 | "meta.embedded.inline.f#": "fsharp", 133 | "meta.embedded.inline.fsharp": "fsharp", 134 | "meta.embedded.inline.go": "go", 135 | "meta.embedded.inline.groovy": "groovy", 136 | "meta.embedded.inline.handlebars": "handlebars", 137 | "meta.embedded.inline.hlsl": "hlsl", 138 | "meta.embedded.inline.html": "html", 139 | "meta.embedded.inline.ini": "ini", 140 | "meta.embedded.inline.jade": "jade", 141 | "meta.embedded.inline.java": "java", 142 | "meta.embedded.inline.javascript": "javascript", 143 | "meta.embedded.inline.js": "javascript", 144 | "meta.embedded.inline.json": "json", 145 | "meta.embedded.inline.jsonc": "jsonc", 146 | "meta.embedded.inline.jsonl": "jsonl", 147 | "meta.embedded.inline.jsx": "javascriptreact", 148 | "meta.embedded.inline.julia": "julia", 149 | "meta.embedded.inline.latex": "latex", 150 | "meta.embedded.inline.less": "less", 151 | "meta.embedded.inline.log": "log", 152 | "meta.embedded.inline.lua": "lua", 153 | "meta.embedded.inline.make": "makefile", 154 | "meta.embedded.inline.makefile": "makefile", 155 | "meta.embedded.inline.markdown": "markdown", 156 | "meta.embedded.inline.math": "markdown-math", 157 | "meta.embedded.inline.objc": "objective-c", 158 | "meta.embedded.inline.objcpp": "objective-cpp", 159 | "meta.embedded.inline.perl": "perl", 160 | "meta.embedded.inline.php": "php", 161 | "meta.embedded.inline.pip": "pip-requirements", 162 | "meta.embedded.inline.powerfx": "javascript", 163 | "meta.embedded.inline.powershell": "powershell", 164 | "meta.embedded.inline.properties": "properties", 165 | "meta.embedded.inline.py": "python", 166 | "meta.embedded.inline.python": "python", 167 | "meta.embedded.inline.r": "r", 168 | "meta.embedded.inline.raku": "raku", 169 | "meta.embedded.inline.razor": "razor", 170 | "meta.embedded.inline.regex": "regex", 171 | "meta.embedded.inline.requirements": "pip-requirements", 172 | "meta.embedded.inline.rst": "restructuredtext", 173 | "meta.embedded.inline.ruby": "ruby", 174 | "meta.embedded.inline.rust": "rust", 175 | "meta.embedded.inline.scss": "scss", 176 | "meta.embedded.inline.shaderlab": "shaderlab", 177 | "meta.embedded.inline.shell": "shellscript", 178 | "meta.embedded.inline.sql": "sql", 179 | "meta.embedded.inline.swift": "swift", 180 | "meta.embedded.inline.tex": "tex", 181 | "meta.embedded.inline.ts": "typescript", 182 | "meta.embedded.inline.tsx": "typescriptreact", 183 | "meta.embedded.inline.typescript": "typescript", 184 | "meta.embedded.inline.vb": "vb", 185 | "meta.embedded.inline.xml": "xml", 186 | "meta.embedded.inline.xsl": "xsl", 187 | "meta.embedded.inline.yaml": "yaml" 188 | } 189 | } 190 | ], 191 | "configuration": { 192 | "title": "YAML Embedded Languages", 193 | "properties": { 194 | "yaml-embedded-languages.include": { 195 | "type": "object", 196 | "patternProperties": { 197 | "^.*$": { 198 | "type": [ 199 | "string", 200 | "object" 201 | ], 202 | "properties": { 203 | "name": { 204 | "type": "string", 205 | "description": "The name of the language" 206 | }, 207 | "scopeName": { 208 | "type": "string", 209 | "description": "The language TextMate scope name" 210 | }, 211 | "stripIndent": { 212 | "type": "boolean", 213 | "description": "Ignore any indentation caused by nested properties" 214 | } 215 | }, 216 | "required": [ 217 | "scopeName" 218 | ], 219 | "description": "The language identifier" 220 | } 221 | }, 222 | "default": {}, 223 | "description": "An object where the key defines the language identifier with regex and the value specifies the language TextMate scope name. By default the language identifier will be used as the language name. To change this, the value can be specified as an object with properties including `name`, `scopeName` (required), and `stripIndent`. Hover over these in VS Code to find out more." 224 | } 225 | } 226 | }, 227 | "snippets": [ 228 | { 229 | "language": "yaml", 230 | "path": "./snippets/snippets.json" 231 | } 232 | ] 233 | }, 234 | "devDependencies": { 235 | "@eslint/js": "^9.9.0", 236 | "@types/node": "~16.11", 237 | "@types/vscode": "1.74.0", 238 | "@vscode/vsce": "^2.29.0", 239 | "esbuild": "^0.23.1", 240 | "esbuild-plugin-auto-env": "^0.2.1", 241 | "eslint": "^9.9.0", 242 | "eslint-config-prettier": "^9.1.0", 243 | "eslint-plugin-prettier": "^5.2.1", 244 | "globals": "^15.9.0", 245 | "prettier": "^3.3.3", 246 | "ts-node": "^10.9.2", 247 | "tsconfig-paths": "^4.2.0", 248 | "typescript": "^5.5.4", 249 | "typescript-eslint": "^8.3.0" 250 | }, 251 | "scripts": { 252 | "build": "node build.mjs", 253 | "generate": "ts-node -r tsconfig-paths/register src/generate.ts", 254 | "lint": "eslint", 255 | "format": "prettier . --check", 256 | "type": "tsc --noEmit", 257 | "package": "vsce package", 258 | "release": "gh release create v$npm_package_version --generate-notes yaml-embedded-languages-$npm_package_version.vsix", 259 | "publish": "vsce publish" 260 | } 261 | } --------------------------------------------------------------------------------