Commit 009233bc authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'fix-lang-syntax-terraform' into 'master'

Fix terraform language syntax in IDE

See merge request gitlab-org/gitlab!44826
parents bff9f09d 260f47b0
...@@ -144,7 +144,7 @@ const language = { ...@@ -144,7 +144,7 @@ const language = {
], ],
heredocBody: [ heredocBody: [
[ [
/^([\w\-]+)$/, /([\w\-]+)$/,
{ {
cases: { cases: {
'$1==$S2': [ '$1==$S2': [
......
...@@ -284,6 +284,42 @@ describe('tokenization for .tf files', () => { ...@@ -284,6 +284,42 @@ describe('tokenization for .tf files', () => {
], ],
], ],
], ],
[
` foo = <<-EOF
bar
EOF`,
[
[
{ language: 'hcl', offset: 0, type: '' },
{ language: 'hcl', offset: 2, type: 'variable.hcl' },
{ language: 'hcl', offset: 5, type: '' },
{ language: 'hcl', offset: 6, type: 'operator.hcl' },
{ language: 'hcl', offset: 7, type: '' },
{ language: 'hcl', offset: 8, type: 'string.heredoc.delimiter.hcl' },
],
[{ language: 'hcl', offset: 0, type: 'string.heredoc.hcl' }],
[
{ language: 'hcl', offset: 0, type: 'string.heredoc.hcl' },
{ language: 'hcl', offset: 2, type: 'string.heredoc.delimiter.hcl' },
],
],
],
[
`foo = <<-EOF
bar
EOF`,
[
[
{ language: 'hcl', offset: 0, type: 'variable.hcl' },
{ language: 'hcl', offset: 3, type: '' },
{ language: 'hcl', offset: 4, type: 'operator.hcl' },
{ language: 'hcl', offset: 5, type: '' },
{ language: 'hcl', offset: 6, type: 'string.heredoc.delimiter.hcl' },
],
[{ language: 'hcl', offset: 0, type: 'string.heredoc.hcl' }],
[{ language: 'hcl', offset: 0, type: 'string.heredoc.delimiter.hcl' }],
],
],
])('%s', (string, tokens) => { ])('%s', (string, tokens) => {
expect(editor.tokenize(string, 'hcl')).toEqual(tokens); expect(editor.tokenize(string, 'hcl')).toEqual(tokens);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment