diff --git a/src/ruby.ts b/src/ruby.ts index b91cd16a..bc5b14c1 100644 --- a/src/ruby.ts +++ b/src/ruby.ts @@ -179,7 +179,7 @@ export const language = { [/@@[\w]*/, 'namespace.class.identifier'], // class // here document - [/<<-(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], + [/<<[-~](@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], [/[ \t\r\n]+<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], [/^<<(@heredelim).*/, { token: 'string.heredoc.delimiter', next: '@heredoc.$1' }], diff --git a/test/ruby.test.ts b/test/ruby.test.ts index 9365f091..a67586b1 100644 --- a/test/ruby.test.ts +++ b/test/ruby.test.ts @@ -134,5 +134,13 @@ testTokenization('ruby', [ { startIndex: 0, type: 'identifier.ruby' }, { startIndex: 1, type: 'string.heredoc.delimiter.ruby' } ] + }], + + [{ + line: 'x<<~HERE', + tokens: [ + { startIndex: 0, type: 'identifier.ruby' }, + { startIndex: 1, type: 'string.heredoc.delimiter.ruby' } + ] }] ]);