فهرست منبع

terraform Fix heredoc

Hugo Fonseca 4 سال پیش
والد
کامیت
c16c8958e5
2فایلهای تغییر یافته به همراه30 افزوده شده و 1 حذف شده
  1. 29 0
      src/hcl/hcl.test.ts
  2. 1 1
      src/hcl/hcl.ts

+ 29 - 0
src/hcl/hcl.test.ts

@@ -992,6 +992,35 @@ testTokenization('hcl', [
 		}
 	],
 	/*
+      foo = <<-EOF
+      bar
+      EOF
+    */
+	[
+		{
+			line: '  foo = <<-EOF',
+			tokens: [
+				{ startIndex: 0, type: '' },
+				{ startIndex: 2, type: 'variable.hcl' },
+				{ startIndex: 5, type: '' },
+				{ startIndex: 6, type: 'operator.hcl' },
+				{ startIndex: 7, type: '' },
+				{ startIndex: 8, type: 'string.heredoc.delimiter.hcl' }
+			]
+		},
+		{
+			line: '  bar',
+			tokens: [{ startIndex: 0, type: 'string.heredoc.hcl' }]
+		},
+		{
+			line: '  EOF',
+			tokens: [
+				{ startIndex: 0, type: 'string.heredoc.hcl' },
+				{ startIndex: 2, type: 'string.heredoc.delimiter.hcl' }
+			]
+		}
+	],
+	/*
     foo = <<EOF
     bar
     EOF

+ 1 - 1
src/hcl/hcl.ts

@@ -143,7 +143,7 @@ export const language = <languages.IMonarchLanguage>{
 		],
 		heredocBody: [
 			[
-				/^([\w\-]+)$/,
+				/([\w\-]+)$/,
 				{
 					cases: {
 						'$1==$S2': [