add support for embedded language aliases
This commit is contained in:
parent
8f2f475043
commit
2a78eb3f2d
|
@ -5,21 +5,22 @@ const languages: {
|
|||
sourceScope: string;
|
||||
aliases?: string[];
|
||||
}[] = [
|
||||
{id: 'javascript', sourceScope: 'source.js'},
|
||||
{id: 'typescript', sourceScope: 'source.ts'},
|
||||
{id: 'javascriptreact', sourceScope: 'source.js.jsx'},
|
||||
{id: 'typescriptreact', sourceScope: 'source.tsx'},
|
||||
// TODO: sort this
|
||||
{id: 'javascript', sourceScope: 'source.js', aliases: ['js']},
|
||||
{id: 'typescript', sourceScope: 'source.ts', aliases: ['ts']},
|
||||
{id: 'javascriptreact', sourceScope: 'source.js.jsx', aliases: ['jsx']},
|
||||
{id: 'typescriptreact', sourceScope: 'source.tsx', aliases: ['tsx']},
|
||||
{id: 'json', sourceScope: 'source.json'},
|
||||
{id: 'jsonc', sourceScope: 'source.json.comments'},
|
||||
{id: 'jsonl', sourceScope: 'source.json.lines'},
|
||||
{id: 'shellscript', sourceScope: 'source.shell'},
|
||||
{id: 'rust', sourceScope: 'source.rust'},
|
||||
{id: 'shellscript', sourceScope: 'source.shell', aliases: ['sh']},
|
||||
{id: 'rust', sourceScope: 'source.rust', aliases: ['rs']},
|
||||
{id: 'css', sourceScope: 'source.css'},
|
||||
{id: 'scss', sourceScope: 'source.css.scss'},
|
||||
{id: 'less', sourceScope: 'source.css.less'},
|
||||
{id: 'html', sourceScope: 'text.html.derivative'},
|
||||
{id: 'sql', sourceScope: 'source.sql'},
|
||||
{id: 'markdown', sourceScope: 'text.html.markdown'},
|
||||
{id: 'markdown', sourceScope: 'text.html.markdown', aliases: ['md']},
|
||||
{id: 'xml', sourceScope: 'text.xml'},
|
||||
{id: 'yaml', sourceScope: 'source.yaml'},
|
||||
];
|
||||
|
|
|
@ -3,7 +3,7 @@ import {merge} from '../util.mjs';
|
|||
|
||||
const elements = merge(embeddedLanguages.map(embeddedLanguage => ({
|
||||
[`tagged-template-literal-block-${embeddedLanguage.id}`]: {
|
||||
begin: `(${embeddedLanguage.id})(\`)`,
|
||||
begin: `(${embeddedLanguage.tags.join('|')})(\`)`,
|
||||
end: '`',
|
||||
beginCaptures: {
|
||||
1: {
|
||||
|
|
Loading…
Reference in a new issue