diff --git a/syntaxes/src/template.ts b/syntaxes/src/template.ts index f59b5ae286..149af62bc4 100644 --- a/syntaxes/src/template.ts +++ b/syntaxes/src/template.ts @@ -36,7 +36,7 @@ export const Template: GrammarDefinition = { }, propertyBinding: { - begin: /(\[\s*@?[-_a-zA-Z0-9.$]*%?\s*])(=)(["'])/, + begin: /(?)(\[\s*@?[-_a-zA-Z0-9.$]*%?\s*])(=)(["'])/, beginCaptures: { 1: { name: 'entity.other.attribute-name.html entity.other.ng-binding-name.property.html', diff --git a/syntaxes/template.json b/syntaxes/template.json index aedbe7fc25..c498755754 100644 --- a/syntaxes/template.json +++ b/syntaxes/template.json @@ -40,7 +40,7 @@ ] }, "propertyBinding": { - "begin": "(\\[\\s*@?[-_a-zA-Z0-9.$]*%?\\s*])(=)([\"'])", + "begin": "(?)(\\[\\s*@?[-_a-zA-Z0-9.$]*%?\\s*])(=)([\"'])", "beginCaptures": { "1": { "name": "entity.other.attribute-name.html entity.other.ng-binding-name.property.html", diff --git a/syntaxes/test/data/template.html b/syntaxes/test/data/template.html index 966eed67d8..106eb6fa37 100644 --- a/syntaxes/test/data/template.html +++ b/syntaxes/test/data/template.html @@ -16,6 +16,7 @@
+
[my-property]="val"
diff --git a/syntaxes/test/data/template.html.snap b/syntaxes/test/data/template.html.snap index def5f74bcb..dd205da08c 100644 --- a/syntaxes/test/data/template.html.snap +++ b/syntaxes/test/data/template.html.snap @@ -149,6 +149,8 @@ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.ng >
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.ng +>
[my-property]="val"
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.ng > > #^^^^^^^^^^^^^^^^^^^^^^^^^^^^ template.ng diff --git a/syntaxes/test/driver.ts b/syntaxes/test/driver.ts index 9f904110ba..6b77bffaa0 100644 --- a/syntaxes/test/driver.ts +++ b/syntaxes/test/driver.ts @@ -10,7 +10,7 @@ import 'jasmine'; import * as cp from 'child_process'; import * as fs from 'fs'; import * as path from 'path'; -import {cases} from './cases'; +import { cases } from './cases'; interface TestCase { name: string; @@ -20,8 +20,7 @@ interface TestCase { } const dummyGrammarDir = 'syntaxes/test/dummy'; -const DUMMY_GRAMMARS = - fs.readdirSync(dummyGrammarDir).map((file: string) => path.join(dummyGrammarDir, file)); +const DUMMY_GRAMMARS = fs.readdirSync(dummyGrammarDir).map((file: string) => path.join(dummyGrammarDir, file)); /** Wraps node's spawn in a Promise. */ function spawn(...args: Parameters): Promise { @@ -29,24 +28,28 @@ function spawn(...args: Parameters): Promise { return new Promise((resolve, reject) => { child.on('exit', (code: number) => { - if (code === 0) - resolve(0); - else - reject(code); + if (code === 0) resolve(0); + else reject(code); }); }); } -async function snapshotTest({scopeName, grammarFiles, testFile}: TestCase): Promise { +async function snapshotTest({ scopeName, grammarFiles, testFile }: TestCase): Promise { grammarFiles.push(...DUMMY_GRAMMARS); const grammarOptions = grammarFiles.reduce((acc, file) => [...acc, '-g', file], [] as string[]); const extraArgs = process.argv.slice(3); const options = [ - 'node_modules/vscode-tmgrammar-test/dist/src/snapshot.js', '-s', scopeName, ...grammarOptions, - '-t', testFile, ...extraArgs + 'node_modules/vscode-tmgrammar-test/dist/src/snapshot.js', + '-s', + scopeName, + ...grammarOptions, + '-t', + testFile, + ...extraArgs, + '--expandDiff', ]; - return spawn('node', options, {stdio: 'inherit' /* use parent process IO */}).catch(code => code); + return spawn('node', options, { stdio: 'inherit' /* use parent process IO */ }).catch((code) => code); } describe('snapshot tests', () => {